LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Favorite way to run program without hardware?

Hi guys, just wanted to get some ideas for how you develop programs when you don't have access to the hardware.

 

Some ideas so far:

- Wrap code that talks to instruments in Conditional Disable Diagrams. Could there be any negative side effects of releasing an executable with these diagrams in it?

- Use a global variable with case structures. This looks a little bit messier but I'm more familiar with case structures than diagram disable structures.

 

 

0 Kudos
Message 1 of 11
(4,037 Views)

Using the conditional disable structure is a good way because it let's you change the code from one type to the other with just changing the conditional symbol in the project.

 

There should be no problems with releasing an executable.  The diagrams that aren't used will get stripped out.  And with an executable, you really can't see the block diagrams anyway.  (Well, maybe if you create a debuggable executable.)

Message 2 of 11
(4,031 Views)

Hardware Abstraction Layer (HAL)? Though this really requires an OOP based architecture (or something similar) to more easily pull it off.

0 Kudos
Message 3 of 11
(4,021 Views)

Tyk,

 

So if I am just working with a single instrument I would make 2 classes: Simulated Instrument and Manufacturer's Instrument? Then I would use dynamic dispatch to call the VIs depending on if I have the instrument connected or not? I think I get the gist of LVOOP but not necessarily the specifics.

0 Kudos
Message 4 of 11
(4,013 Views)

@Gregory wrote:

Tyk,

 

So if I am just working with a single instrument I would make 2 classes: Simulated Instrument and Manufacturer's Instrument? Then I would use dynamic dispatch to call the VIs depending on if I have the instrument connected or not? I think I get the gist of LVOOP but not necessarily the specifics.


Using LVOOP then yes you have the right idea. However you don't need to use LVOOP to do what you want, especially if it is only a single instrument. You could have a "simulate?" input for which each of your VI calls takes into account when performing either real calls to an instrument or some other simulation data.

 

Even better would be capturing this as part of the data shared amongst your instrument VIs (eg. class wire, cluster wire or even Action Engine style) so that your calling code only has to setup the 'type' once and minimise leaks across your abstraction boundary. This could also allow you to set simulation data programatically and store it in the data used by the instrument VIs so that you can control what they produce; very useful for unit testing your calling code.

 

But I caution against going for a "full-on" solution ot this as a first attempt in this arena. Try some simple ideas such as a "simulate" input to your VIs and go from there.

Message 5 of 11
(3,999 Views)

I put my hardware code in an AE and during startup, I check for the presence of my device and look at the config file to see the value of "Simulate".  If no device is present and/or "Simulate=TRUE", I set a global variable.  The variable determines (with a case structure) whether to use my DAQ device or my simulation dialog, which is simply a series of sliders and knobs. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 11
(3,992 Views)

In my works I use one of this method for this problem 

1)Use Conditional Disable Structure

2) Try to create a hardware that could simulate the main hardware data (I use arduino or some easy to use hardware modulus in this case)

3) use simulation vis inside the case structure and use visa or port check to use that as data or not  use hardware connection  

4) In some projects I use tab one for simulation second for real hardware and also tell the customer that it is option for work with software and get familiar with that  Smiley Wink

 

0 Kudos
Message 7 of 11
(3,969 Views)
Another way is to use IVI drivers. They have a simulation mode.
0 Kudos
Message 8 of 11
(3,949 Views)

gregoryj a écrit :

Hi guys, just wanted to get some ideas for how you develop programs when you don't have access to the hardware.

 

Some ideas so far:

- Wrap code that talks to instruments in Conditional Disable Diagrams. Could there be any negative side effects of releasing an executable with these diagrams in it?

- Use a global variable with case structures. This looks a little bit messier but I'm more familiar with case structures than diagram disable structures.

 

 


I use Conditional Disable Diagrams and the only issues I encountered with executables was when I forgot to change back a value before building it. I'm using different symbols depending on the application, I sometime only want to disable specific parts (motion vis or instruments or data acquisition) or I can have a simulation mode.

 

Ben64

Message 9 of 11
(3,938 Views)

If your hardware is a NI DAQ card, you can configure a simulated DAQ card in Measurement and Automation Explorer. You're obviously not going to get any realistic data through the simulated card, but your program will run.

0 Kudos
Message 10 of 11
(3,912 Views)