02-17-2008 12:53 PM
02-17-2008 02:51 PM
jimmyinCT wrote:
i have a while loop that controls my programoutside the loop, i initialize the hardware and then close the same hardware outside teh loop after the program is closed.I also would like to make a simulation program that simulates a sinusoid inputThis so i can do programming while im at home, or away from the hardwareI figure having a boolean value called "simulation mode" would allow me to never initialize the hardware in a true false statement when i plan on doing simulations.This could be done at each place the hardware is called, but yet, the program is still is looking for outputs from the true false case outside the loop when i initialize the harware. inthere has to be a simple way to do this im overlooking?
02-17-2008 03:07 PM
it sounds like you understand what is going on.
I do ned to pass it some kind of value for the false case, ie, when the instrument is not being run, the "instruemnt handle out"
Its some weird purple wire though.
dont actually runthe example though, it will hang up your computer as its will end up looking to close the device:)
you can look at the code though and see whats going on.
02-17-2008 06:09 PM
02-17-2008 08:56 PM - edited 02-17-2008 08:59 PM
yes, i have all the device occurances in conditions true/false
at issue is that i dont know what to pass through the case statement in the "simulation mode" case, ie, hardware not being used.
This is important so i can do my coding at home, but also, allows controlled known inputs such as sine wave vis. for calibration.
those are the white boxes at teh edge of the conditional statements are a problem.
i did a print screen of the general concept
what can i pass through for a purple wire to make it run?
is there another way to do this?
02-17-2008 09:17 PM - edited 02-17-2008 09:19 PM
02-20-2008 01:29 PM
02-25-2008 08:08 AM
I have done exactly what you want to do. I have simulated operating machinery by mathematically generating waveforms that look (to the program) almost like real data. I can operate and debug code that calls DAQmx devices without any devices installed on the computer. I think it's a good idea to put calls to the DAQ devices in a state machine that remembers whether it's simulating.
My code uses simulated DAQ output to compute machine response. Then it makes DAQ waveforms that are read as "real" input by other parts of the program.
It's especially useful if the machinery you intend to operate is potentially dangerous.
I don't check the posts very often. If you need sample code please contact me. I will try to make a simple version to help explain the concepts.