LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Network-Published Shared Variable for boolean communication between RT and Host

I am using Network-Shared Variable for boolean communication between RT vi and Host vi. However, it took more than one minute for RT vi getting the command. And when I try to stop the host vi. It also takes a while. It gives a no response after I hit the stop button. After several minutes, it stopped.

 

This is the RT vi.

boolean communication.JPG

 

This is the host vi.

Network Streams Reader.JPG

0 Kudos
Message 1 of 4
(2,415 Views)

I have not opened your application yet but have you included the Wait (ms) node in your loops? Be sure to give each loop some sort of timing otherwise it will not give the communication thread any time to communicate between host and controller.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 4
(2,410 Views)

Hi Adnan,

 

I want to do the control in real time. So will it give me some delay after I give this wait in my loops? Should I include the same delay in both host vi and RT vi?

 

Thank you

 

Zhaohao

0 Kudos
Message 3 of 4
(2,402 Views)

Hey Zhaohao,

 

When you say control do you mean the stop button control? Or what's being performed by your FPGA?

 

Without wait functions both your target and your host will run as fast as the processor will allow. On an Real-Time(RT) system this can be especially problematic as the processor will loose the ability to do any lower priority networkcommunication because it is too busy with your high priority VI. RT priorities are discussed in more detail here.  

 

I think the architecture of your RT program needs to be revisited. Currently you have the RT updating front panel objects directly (Charts and controls), which runs the RT VI in interactive mode. This can be less than ideal because thecommunication back to your host machine is likely non-deterministic and will cause the RT loop to be less deterministic.  

 

To best utilize the RT determinism you should be completing the data acquisition/processing/control in a high priority timed loop, and use either the RT FIFO or some other form of a queue to send the collected data to a lower priorityloop which will send the acquired data through network streams and/or shared variables back to your host VI for display and user interface.

 

The Zip file you attached doesn't seem to contain the RT.vi that you posted a screen shot of. It looks like you've started implementing a structure similar to what I described, but you'll also need to implement these methods with thecharts and controls you include in your RT.vi. You'll also want to write controls on the user interface(host.VI), such as the stop button, to shared variables in the high priority loop in order for them to occur as timely as possible. 

 

Just for reference here are our RT Best Practices Portal (also in the LabVIEW Real-Time Module help),  and Getting Started with the LabVIEW Real-Time Module. They contain a lot of useful documentation on RT programming. 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 4 of 4
(2,384 Views)