Test Channel History Errors


Recommended Posts

I have attached a simple program loop that steps a D-A output on a Labjack, allows time for external circuitry to settle, then takes a block of A-D readings to build an average. This average is stored in my test channel. Everything works as expected. Both the raw input voltage (AIN0) and the "Voltage" channel plot correctly on the same graph even though there are only 50 samples in the "Voltage" channel and 509 readings in the AIN0 channel.

The problem appears when I try to define another test channel "Diff" where I would like to store the difference "Voltage[0]-Dac0[0]". As soon as I add the channel, without actually using it anywhere in the sequence, the history for my "Voltage" channel expands to include a bunch of near zero values between the average values I wrote to the channel. It's as if it has been filled with "something" at the same sample rate I am using in my sequence.

So the question is, why are these values here and what determines their values?

If you have access to a Labjack just jumper AIN0 to DAC0, then run the ramp sequence.

Thanks

ramp1.ctl

Link to comment
Share on other sites

I can't reproduce it, at least not after cleaning up your script. I don't have a LabJack so I changed your LJ channels to more test channels (making sure they have unique Chan #'s). A few things in your doc, that may or may not be an issue, but are for good form:

1) In the event for AIN0, you are subsetting using (). Use [] always: ain0[0] not ain0(0)

2) In ramp1, make sure that when you want to use the most recent value only (which in your case is always) on the right side of an =, put [0] after the channel name

3) on the same note, never put [0] on the left side of an equal when using a channel. With a variable you can do this and it will replace the 1st element of the array with that value, but you can't do that with a channel.

4) put 0 in front of all decimal places. I.e.: "0.1" not ".1" This is a personal pet peeve of mine. Not including the 0 is just asking for the values to be misread and is bad form whether in script or anywhere else.

Link to comment
Share on other sites

The core problem was not having a unique channel # for "diff" channel I added. I had two test channels with channel #0 selected. I corrected that and cleaned up the sequence as you had suggested and this is where it gets strange. I still had a corrupted history on the "diff" channel. In fact, I had history on the "diff" channel even after removing any reference to it in my sequence. I wasn't updating it all but it still generated history and I could plot that history. So I renamed the channel to something other than "diff" and added back the assignments to the new name in the sequence and what do you know, it all worked correctly. I added more to the sequence and everything continued to work properly. At some point I changed the channel name back to "diff"and changed the references in the sequence to once again refer to "diff". I imediately got the old history problem back. As a final check I created a new program and input all the same channel setup and sequence using the "diff" channel name. It worked perfectly.

I really don't expect you to answer this because you can't duplicate my system and hardware. But I wanted to let you know because it appears that somewhere in the program or the enviourment that data associated with the channel named "diff" was kept. And even though you could correct all settings, it would still be corrupted. The only way to use the channel name "diff" was with a new program.

Thank you very much for all your help!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.