07-14-2011 06:15 PM
Hi LV_Enthu
Could you give us the name of the device? Do you know the model or part number? Do you have a serial number for it?
Perry S.
07-15-2011 02:36 AM
And again: Without concrete answers to our questions , only with that little information you provided.. sorry no answer possible. (My crystall ball is in recalibration 😉 )
Another important information: How fast are your signals changing?
Example: If you read voltages representing some temperatures, how fast will they change?
That would give an indicator how fast you need to sample and how close the sync needs to be.
The joy of engineering is to do what you want, with the stuff you can get! That joy drives us (me) to help you, but we get NO information 😞
If you don't have concrete numbers (The data needs to be in sync for ?h within +-???ms), you might explain the task you have to solve, explain the hardware you have. More details -> more sophisticated help. And before you start to guess numbers (well, or what happens quite often, give unrealistic high performance needs like 'need to sample the room temperature with 10kS/s') explain the main task.
07-15-2011 09:14 AM - edited 07-15-2011 09:16 AM
Henrik Volkers, i understand your agony...
like i mentioned, i have to sync data between 1 USB 6229 and 1 OEM part which does PID loop control of a Dyno. I would be ONLY COLLECTING and not controlling the data from the Dyno (torque and RPM) into my USB 6229. now, this OEM part has a facility to send signals to PC over USB port (using COM-Port driver software so that PC sees the OEM-serial as a com port) the baud rate on this COM port is configurable from 2400 to 115200 bps. the dataformat from the serial port is this..
\00\s\s\s\s0,\s\s\s\s11,\s\s\s\s\s0,\s\s\s\s\s0\r\n .. where the data is (0,11,0,0); there are 4 outputs, we would like to save only 2 of these..
on the USB-6229 we have other AI sampled at 2 differnet frequencies (thats the requirement)
i have attached the vi i developed till now, and gathered some data... the data on the serial port is not continous as it is on the AI channels.. it appears like a burst of data, that might be something with the OEM device and i have no control over it... becaus of this burst, i see in my data file, the times when there is no data, LV writes 0 in those particular times.
BY SYNC, what i really mean is to get rid of these '0' values, and make sure get some real-values at all the times in my data file (just like other channels). Moreover, when i read only the serial port data (i.e. no USB-6229) the data file is continous, i.e. no intermediate '0' values in consecutive rows...
attached is data-file, and vi in LV10 and LV8 format
07-15-2011 10:23 AM - edited 07-15-2011 10:30 AM
Ok, here is something for the weekend 😉
(Hey, my kids are waiting for me)
Take 3 producer loops
1. Userinterface
2. read the USB6229
3. read the OEM thing
2 actionengines (LV2StyleGlobals, aehh there is another name that just drops) to receive and hold the data from the DAQs together with a 'new data' flag (binary output) that is set true by writing and false after reading.
one consumer loop for reading the actionengines and writing the data with a timestamp and the two new data flags.
one stateMC for the control...could be merged with the userinterface
+ Each loop can be individually timed. (maybe your OEM controller don't like too much data requests)
+ you will always log the most recend data ( plus new/old data indicator)
- not the best sync of data
-------------------
Or
Configure the 6229 for continous read with a software trigger that never occurs. That way the card is continously acquiering data into a ring buffer and you can fetch the last n-samples from the (>n) buffer.(That should be confirment by a DAQmx Expert, I use scopecards and would use a multi-record acquisition)
Then you send the datarequest to the controller and arm a VISA event on serial character . when the first databyte arrive the event is fired and you fetch n-samples from your 6229 (take a mean value or the sample that is in best sync with your controller card.
Check the controller documentation, maybe you can set up a continous datastream without polling.
For the string :
use the scan from string vi
and pick the data you need. I asumed decimal values, If they are send in HEX use %x 🙂
Have a nice weekend
Maybe I have a chance to look into your code on Monday
For the readout: Have you called the controller manufactor and asked how they would continously fetch data? Sometimes you can be lucky, get the programmer and get the best tips.
PS: Kudos are wellcome
07-15-2011 11:47 AM - edited 07-15-2011 11:48 AM
oooo ... this is one of the complex replies i have received!!! pardon me for that..
@Henrik Volkers wrote:
Ok, here is something for the weekend 😉
(Hey, my kids are waiting for me)
Take 3 producer loops
1. Userinterface
2. read the USB6229
3. read the OEM thing
2 actionengines (LV2StyleGlobals, aehh there is another name that just drops) to receive and hold the data from the DAQs together with a 'new data' flag (binary output) that is set true by writing and false after reading.
one consumer loop for reading the actionengines and writing the data with a timestamp and the two new data flags.
one stateMC for the control...could be merged with the userinterface
+ Each loop can be individually timed. (maybe your OEM controller don't like too much data requests)
+ you will always log the most recend data ( plus new/old data indicator)
- not the best sync of data
-------------------
Or
2. read the USB6229
3. read the OEM thing
2 actionengines (LV2StyleGlobals, aehh there is another name that just drops) to receive and hold the data from the DAQs together with a 'new data' flag (binary output) that is set true by writing and false after reading.
one consumer loop for reading the actionengines and writing the data with a timestamp and the two new data flags.
one stateMC for the control...could be merged with the userinterface
+ Each loop can be individually timed. (maybe your OEM controller don't like too much data requests)
+ you will always log the most recend data ( plus new/old data indicator)
- not the best sync of data
I have never done this kind of stuff before, but definitely would like to give a shot to this... can you please give me a small example code of how to perform such tasks (producer/consumer) and all?
Configure the 6229 for continous read with a software trigger that never occurs. That way the card is continously acquiering data into a ring buffer and you can fetch the last n-samples from the (>n) buffer.(That should be confirment by a DAQmx Expert, I use scopecards and would use a multi-record acquisition)
Then you send the datarequest to the controller and arm a VISA event on serial character . when the first databyte arrive the event is fired and you fetch n-samples from your 6229 (take a mean value or the sample that is in best sync with your controller card.
Check the controller documentation, maybe you can set up a continous datastream without polling.
For the string :
use the scan from string vi
and pick the data you need. I asumed decimal values, If they are send in HEX use %x 🙂
Have a nice weekend
Maybe I have a chance to look into your code on Monday
For the readout: Have you called the controller manufactor and asked how they would continously fetch data? Sometimes you can be lucky, get the programmer and get the best tips.
PS: Kudos are wellcome
is scopecard a hardware that i would have to buy? also, whats a DAQmx Expert?
thanks for the detailed answer and your time.
07-15-2011 02:11 PM
compliments Henrik
because of your kids, mine are not living at home anymore...
The producer consumer pattern is a template in LabVIEW
On the startup window select new vi/from template/frameworks/design patterns/producer consumer
A lot of the background on producer consumer can also be found on the NI web page