LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating DAQmx measurements?

Hi All,

 

I'm working on a project where I wont have the physical hardware available for a while. But I know exactly what my incoming data is going to look like. I'll be making some current measurements through a NI 9203 and I have a simulated cDAQ setup in MAX with all my modules in it. The simulated device is working fine for debugging and letting my code run through but by default the simulated device only registers a sine wave. Is there a way I can control what the simulated device outputs? Perhaps turn a dial and have it output a corresponding signal between 4-20mA?

 

Any help will be greatly appreciated!

0 Kudos
Message 1 of 6
(3,094 Views)

DAQmx will return the same simulated signal for any simulated device and it cannot be changed. Your best bet would be to replace the DAQmx Read.vi with your own custom signal generation with the same timing parameters, etc. 

Nathan Murphy
0 Kudos
Message 2 of 6
(3,079 Views)

Nope.  But please go give this idea a kudo: Interactive DAQmx simulation interface


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(3,077 Views)

I'd love to Kudo it but it won't let me 😞

0 Kudos
Message 4 of 6
(3,063 Views)

As a general note to make it so you don't have to add too much else to your code, you should know that you can check whether a DAQmx device is simulated.  

 

Before running the "read" code, drop down a DAQmx Device property node (found in the palettes under "Measurement I/O → NI-DAQmx → Advanced → System Setup → Device Node").  Pull it down so there are two properties visible.  The first one should be "Active device" as an input and the second is "Device is simulated" as an output.  Wire in your device reference to the first node, and then with the Boolean output from the second property, use that to have your program do "something different" when it's True to output what your data should look like.

 

Doing it this way is much easier than trying to run a "simulation?" wire everywhere throughout all of your VIs and subVIs, or adding globals everywhere.

Message 5 of 6
(3,056 Views)

Kyle,

     A very clever idea, get MAX to tell you whether or not you have a Real or Simulated device connected.

     Often, when I'm doing development with fairly low-speed DAQ devices (1kHz samples, say), I have a Constant (sometimes a Global) called "Simulated" that either does, for example, a 1000-point DAQmx Read (if False) or generates 1000 numbers + a 1000 ms Wait (if True).  But then I have to remember to "flip the switch" ...

 

Bob Schor

0 Kudos
Message 6 of 6
(3,029 Views)