From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Software Simulator to test machine code

Solved!
Go to solution

When i am developing code for machine control, the normal challenge is to test the code for functionality before loading on to actual machine. This is much safer and almost the full sequence can be safely tested out.  For this currently i use a Hardwired simulator which has following functionality :

1. 32 Toggle switches to simulate Digital Inputs ( DI) 

2. 32 LEDs to check digital outputs ( DO)

3. 16 Potentiometers to simulate Analog Inputs ( AI)

4. 4 nos DPM to verify the Analog Outputs ( AO) 

But the problem this hardwired simulator is bulky and not portable. 

 

What i want to do instead is develop a simple LV interface with all of the above in Software and run that on another computer or tab. Then send the variables alone from that interface to the PC running actual code. In essence the variables will replace the DAQMx I/O signals. 

 

Doing this in software has many advantages like customized controls for each project, portability so i can test code on the move etc without having to contend with the large Hardwired stuff. 

 

Anybody done such a thing ... one of the challenges i have is to pass the variables via USB..Software Simulator.jpg

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 12
(3,657 Views)

( I had earlier posted this in LabVIEW forum and drew no response. Either what i want is very unusual or its not the right place to ask this Smiley Wink) So trying here.

 

When i am developing code for machine control, the normal challenge is to test the code for functionality before loading on to actual machine. This is much safer and almost the full sequence can be safely tested out.  For this currently i use a Hardwired simulator which has following functionality :

1. 32 Toggle switches to simulate Digital Inputs ( DI) 

2. 32 LEDs to check digital outputs ( DO)

3. 16 Potentiometers to simulate Analog Inputs ( AI)

4. 4 nos DPM to verify the Analog Outputs ( AO) 

But the problem this hardwired simulator is bulky and not portable. 

 

What i want to do instead is develop a simple LV interface with all of the above in Software and run that on another computer or tab. Then send the variables alone from that interface to the PC running actual code. In essence the variables will replace the DAQMx I/O signals. 

 

Doing this in software has many advantages like customized controls for each project, portability so i can test code on the move etc without having to contend with the large Hardwired stuff. 

 

Anybody done such a thing ... one of the challenges i have is to pass the variables via USB..

IMG_9349.jpg

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 2 of 12
(3,624 Views)

Hi MogaRaghu,

why additional computer for simulation, when you can test with the development system itself.

create a vi for simulation and exchange data, or create a simulation condition in your actual code itself.

bp
0 Kudos
Message 3 of 12
(3,605 Views)

@bharathp10 wrote:

Hi MogaRaghu,

why additional computer for simulation, when you can test with the development system itself.

create a vi for simulation and exchange data, or create a simulation condition in your actual code itself.


I actually was expecting this suggestion. Its OK for small code with a handful of IOs and I actually do it also  ....but when the machine code is  something like 20 DIs / 32 DOs / 14 AIs and 4 AOs its not the best or even a workable solution.  And another thing many times the client would like to handle the simulation himself to check out and for that the external simulator is the only way forward. 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 4 of 12
(3,601 Views)

Hi MogaRaghu,

The code you are using for the simulation can be used in the development system right?

I was suggesting why additional resources when you can do it with the single computer.

If the code is working in the external simulator for Large no of IOs, it should work in the development system too.

i have not worked on projects involving control through remote system, but for simulation its not a problem creating simulator version of the application.

bp
0 Kudos
Message 5 of 12
(3,598 Views)

@bharathp10 wrote:

Hi MogaRaghu,

The code you are using for the simulation can be used in the development system right?

I was suggesting why additional resources when you can do it with the single computer.

If the code is working in the external simulator for Large no of IOs, it should work in the development system too.

i have not worked on projects involving control through remote system, but for simulation its not a problem creating simulator version of the application.


Ok since you say you have not worked on systems with large I/O count, here is a typical screen for a medium size project. Now you will understand why I cannot add the simulator interface also to this screen.... I just don't have display space !!

 

IOStatus.PNG

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 12
(3,589 Views)
Solution
Accepted by topic author MogaRaghu

Hi Raghutan,

 

Then send the variables alone from that interface to the PC running actual code. In essence the variables will replace the DAQMx I/O signals. 

Then you need to program a "test mode" in your DAQ software to allow switching from DAQmx inputs to "variables" input…

 

one of the challenges i have is to pass the variables via USB.

Here I see a major problem: USB is not intended to connect two PCs!

Usually you have a "USB master" (PC) and "USB slave" (like thumbdrive, external harddisc, whatever). Having communication between two PCs using USB connection is "uncommon"…

I would prefer a Ethernet/LAN connection between your two PCs and use some kind of network communication!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 12
(3,560 Views)

@GerdW wrote:

Hi Raghutan,

 

Then send the variables alone from that interface to the PC running actual code. In essence the variables will replace the DAQMx I/O signals. 

Then you need to program a "test mode" in your DAQ software to allow switching from DAQmx inputs to "variables" input…

 

one of the challenges i have is to pass the variables via USB.

Here I see a major problem: USB is not intended to connect two PCs!

Usually you have a "USB master" (PC) and "USB slave" (like thumbdrive, external harddisc, whatever). Having communication between two PCs using USB connection is "uncommon"…

I would prefer a Ethernet/LAN connection between your two PCs and use some kind of network communication!


You are getting close to what I had in mind. Why USB ? Because I have a spare USB-6212 board which I can use in place of the actual DAQ Board on machine - of course I already have a selector called DEMO/ACTUAL to invoke the correct interface.  So in this arrangement I can of course use the USB without issues. 

 

But your idea of a Ethernet opens up a new line of thinking - why use a board for simulation at all ? Just use the right variables in a Array / cluster and pass instead of DAQMx  variables over the RJ45 ( or WiFi )  port.  So would this be done by the Shared Variables ? Never used them till date....

 

Thanks for the brain storming.

 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 8 of 12
(3,546 Views)

Hi MogaRaghu,

I was telling the same..why board? why additional pc? why communication?

when you can create another VI and communicate with that..

bp
0 Kudos
Message 9 of 12
(3,541 Views)

@bharathp10 wrote:

Hi MogaRaghu,

I was telling the same..why board? why additional pc? why communication?

when you can create another VI and communicate with that..


No. What GerdW proposed is different. Additional PC and Communication are very much there. 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 10 of 12
(3,538 Views)