Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Object doesn't work as described

I was receiving unexpected data from the Sample Object, so I did some testing on the object, and it doesn't work as described in the documentation.

The documentation for the Sample Object says this: "Any time the Sample expression transitions from OFF to ON and the Enable expression is TRUE, the Sample object samples and stores a Data expression."

This information is incorrect.

The Sample Object ALWAYS samples and stores data upon a 0-1 transition even if the Enable expression is FALSE.

I created a simple Process file to do testing on the Sample Object. This is my findings:

The only thing the Enable expression does is allow the transfer of the Sample expression into the Sample Object�s implicit value. When the Enable expression is off, the last value of the Sample expression is shown in the Sample�s implicit value (even though the Sample expression has changed values [this works as expected]). Even if the Enable Expression is OFF, the Sample Object will Store, and Increment the number of expressions saved. [this is not expected, documentation says Enable must be On to Store]

The workaround I am using is to change what I put in the Sample expression of the Sample Object.

Original (doesn�t work as expected)
Object: Pot named "Value"
Object: PushButton named "TakeSample"
Object: Switch named "EnableSample"
Object: Sample named "Sample1"
Data=Value.value
Sample=TakeSample
Enable=EnableSample

Workaround:
Object: Pot named "Value"
Object: PushButton named "TakeSample"
Object: Switch named "EnableSample"
Object: Sample named "Sample1"
Data=Value.value
Sample=TakeSample and EnableSample
Enable=EnableSample

Personally, I think you can leave the Sample Object. If I need to sample only when Enable is on, I just include it with the Sample expression. I suggest that you change the documentation.

Ok, how did I find this all out? I was trying to figure out a way to delete just the LAST Sample. The object wasn't working as described, so I investigated it.

What I Really Want: What I really want is an additional connection to the Sample Object. Currently the only connection available is DataReset. I would request that an additional connection be available that would allow me to delete the last sample. It could be called ResetLast. Also, it would be nice to get the "count" of samples taken. It could be a numeric data member. (currently to get this information, I have to create an additional Counter Object, with count and resets expressions using the same expressions in the Sample Object I am trying to count samples of.

Thanks for reading this long message. I hope it was helpful.

Rich Anderson
Automation Controls Engineer
Anamax Group
0 Kudos
Message 1 of 3
(3,195 Views)
Hi Rich,
I understand that you're having some trouble enabling and disabling a sample object in Lookout. I went through the steps you listed, but I was not able to replicate the error that you found. I have attached my test code to this post. Please look over what I've done and see if I understood you correctly, and if you are able to run this code successfully. Either way, if you post your code, I'll be able to test it to see if I can replicate the problem on my end.

Thanks for reporting this problem, and we'll try to get a resolution for it as quickly as possible.

Best regards,
Marcus G.
Applications Engineer
National Instruments
Download All
0 Kudos
Message 2 of 3
(3,193 Views)
Using your test code, create a few more displays for the sample data, say "sample1.2 thru "sample1.9"(you currently only show "sample1" and "sample1.1".

Now leave the "enable" off. Everything is fine. No data is entered when "push to take sample" is pressed. Go ahead, press "push to take sample" a few times. It works as expected.

Now, turn the pot to have some sample data other than zero, say 15.

Now, turn "enable" on. The value of the pot goes into "sample1". Do NOT press "push to take sample" yet.

Now, turn "enable" off.

Now, turn pot value to zero (note: actually, you can turn pot to any value, and it won't change the results of this test)

Now, press "push to take sample"

We see that the value of "sample1" is moved into "sampl
e1.1" with the push of "push to take sample"

Press "push to take sample" again, we see the value move to "sample1.2"

each press of "push to take sample" will insert the value of "sample1" into the sample stack (sample1.1, sample 1.2, sample1.3, etc.) even though "enable" is off, the samples are put into the sample stack.

So, the value of what the pot was when "enable" was on, is moved into the sample object, even if "enable" is now off.

Attached is my SampleTest project. There is a switch on the left side to enable or disable the "work-around" I talked about in my origional post. Leave it disabled to see how the sample object works nativly.

The project functions similar to your sample project.

I hope this helps show how I think the sample object doesn't function as described in the Developers Manual.

Rich Anderson
Automation Controls Engineer
Anamax Group
Download All
0 Kudos
Message 3 of 3
(3,195 Views)