LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

best architecture for multiple independent Timed Structures

Hi guys!

My software has to check and control multiple hardware with different frequency and protocols: voltmeters with 100 Hz, temperature sensors with 1 kHz, flow sensors with 25 Hz, water bath, climate chamber, PID,....

So in order to keep thing simple I've got a Timed Structure for each device group. But there are too many Timed Structures now....

I wanted to put timed structures into sub VIs so I can have just a one icon called "Voltmeters" instead of Timed Structure on main VI but it makes harder to show data from sub VIs on front panel and stop Timed Structures in sub VIs.

Do you have any recommendations how should I rewrite my software?

0 Kudos
Message 1 of 7
(2,862 Views)

It sounds to me as though most of your proposed independent VIs are doing hardware data acquisition.  If so, I recommend you use absolutely no Time Structures, but instead rely on letting the hardware do the timing, as it generally has much better "clocks" than does Windows (I'm assuming you are not talking about a LabVIEW RT system with a cRIO or PXI chassis running a Real-Time OS handling the DAQ tasks).

 

To do this, you'd be advised to learn how to use DAQmx instead of the DAQ Assistant Express VI.  The NI White Paper "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications" will get you started, as will other papers in NI's DAQmx section.

 

Bob Schor

0 Kudos
Message 2 of 7
(2,845 Views)

In my application I don't care about exact timing, I can replace Timed Structures with while loops, or do hardware triggering, but the main window will still be hard to read.

Ideally My main should allow you to navigate in program, so far the only way I know to do it is to put all Timed Structures into Sub VIs and start to play with global variables, etc

0 Kudos
Message 3 of 7
(2,841 Views)

@TomaszCiesla wrote:

[...] but the main window will still be hard to read.

[...]


What does that have to do with execution code? Or do you mean that interfacing with the application feel sluggish and has a lot of lag spikes?


@TomaszCiesla wrote:
[...] so far the only way I know to do it is to put all Timed Structures into Sub VIs and start to play with global variables, etc

Using timed structures and global data storage is the best way to bury execution speed and to create the risk for race conditions potentially crashing your application or at least corrupt data. So please never ever go down that road!

 

So what exactly is your issue? Please stop to describe what you consider to be a solution, but describe the situation as-is and what you do not like about it!

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 7
(2,836 Views)

1. Timed loops are next to worthless in a Windows system.  They add a lot of overhead, force the code to run single threaded, and you gain very little due to Windows.  So use normal While loops.

2. I use Queues and User Events to pass data around between loops.  Going with the subVIs for each measurement is a good idea.  If going to a central GUI VI, use User Events which work with the Event Structure (which you should be using anyways for a GUI).

3. If your GUI is getting unwieldy, you might want to look into using subpanels.  With subpanels, you load a VI into it and that VI's front panel is seen.  So you can load your subVI's panels into the subpanel based on what your user wants to see.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(2,814 Views)

Guys please forget that I've mentioned Timed Structures

- In my program I've got 6 parallel while loops with indicators and controls inside each while loop.

- I want to add two extra loops and it makes main VI look a bit complicated

- When I'll put while loops into sub VIs accessing its controls and indicators and stop becomes "not easy"

Is there a better way to clean up / arrange main VI?

0 Kudos
Message 6 of 7
(2,810 Views)

Refer to the second point of Tim's (crossrulz) post....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 7
(2,805 Views)