03-01-2017 07:06 AM
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?
03-01-2017 07:24 AM
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
03-01-2017 07:32 AM
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
03-01-2017 07:43 AM
@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!
03-01-2017 08:01 AM
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.
03-01-2017 08:16 AM
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?
03-01-2017 08:22 AM - edited 03-01-2017 08:23 AM
Refer to the second point of Tim's (crossrulz) post....