LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simulaton vs. hardware mode

i have a while loop that controls my program
outside 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 input
This so i can do programming while im at home, or away from the hardware
 
I 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.  in
 
 
there has to be a simple way to do this im overlooking?
 
0 Kudos
Message 1 of 8
(3,432 Views)


jimmyinCT wrote:
i have a while loop that controls my program
outside 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 input
This so i can do programming while im at home, or away from the hardware
 
I 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.  in
 
 
there has to be a simple way to do this im overlooking?
 


Your definitely going to have to hide the Daqmx functions each place you use them.  What do you mean by "program is still is looking for outputs from the true false case outside the loop when i initialize the harware".  A broken run arrow?  In the "simulation case" you may need to add in a default value for things like a task reference so that there is something to pass through on the wires, or wire those wires through.  It won't mattery that it will be empty default data, because any code that would have used them will all be hidden in the "real hardware" cases you won't be running.
 
If this isn't what you mean by your question, please post some code.
0 Kudos
Message 2 of 8
(3,422 Views)

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.

http://www.engr.uconn.edu/~jmacione/ni/

0 Kudos
Message 3 of 8
(3,419 Views)
Did you put the device close in a conditional statement as well so it doesn't try to run when you are in simulation mode?
 
I can't open your link.  It gives me a 404 webpage not found error.
0 Kudos
Message 4 of 8
(3,409 Views)

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?

 

 

 

 



Message Edited by jimmyinCT on 02-17-2008 08:57 PM

Message Edited by jimmyinCT on 02-17-2008 08:57 PM

Message Edited by jimmyinCT on 02-17-2008 08:58 PM

Message Edited by jimmyinCT on 02-17-2008 08:59 PM
0 Kudos
Message 5 of 8
(3,403 Views)
Two choices.
 
The easiest would be to right click on those white tunnels and select "use default if unwired."  The other choice is to go into the false cases, right click on the white tunnels and select create constant, which would create a constant of the default value.  You would need to do one or the other in the first case structure since this is where those values originate.
 
In the middle case structure, you can either do that, or better, you could just wire through the case structure from tunnel to tunnel which will carry through the error wire and the default value for the purple reference wire.  Since you don't actually use the reference in the simulation mode, it won't matter to the program that it is an empty default value for the reference.
 
 


Message Edited by Ravens Fan on 02-17-2008 10:19 PM
0 Kudos
Message 6 of 8
(3,395 Views)
that works, thanks again.
 
never knew you could right click the unused terminals and use those options.
 
0 Kudos
Message 7 of 8
(3,363 Views)

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.

0 Kudos
Message 8 of 8
(3,324 Views)