LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with a sequential testing program

Hi everyone.  I'm relatively new to Labview, and I would appreciate some help with a challenge I am having.  I've been searching for days to try to find the eact way to approach and solve this code.  I would think it would be relatively common and straightforward, but I can't find any examples or documentation of exactly how to do this.

 

I currently have a working VI I programmed that allows a user to enter gas flow setpoints (for mass flow controllers), which are then converted to voltages and sent to a compact Fieldpoint module CFP-2110.  However, the program only works in real time; my desire is to allow someone to fill out a table specifying a time schedule of gas flow rates.  The program would then run sequentially, outputting each flow rate case for the specified amount of time before moving onto the next.  A simplified example of the table would be:

 

0 minutes - Flow rates array 1

1.5 minutes - Flow rates array 2

2.5 minutes - Flow rates array 3

4 minutes - Flow rates array 4

 

Granted, these wouldn't be using separate arrays but rather subarrays of some large input array, but I hope this explains my goal.

 

I have tried a while loop with nested case structure, but the problem with this is that it only outputs the final value of the case once it is complete, while I need the program to output each case at the desired time.  I know this is normal behavior for case structures and while loops, so I assume they are not the answer to this.  I can't find a structure or coding method that would output the intermediate values.  I have tried notifications as well, but this seems to have the same behavior of only outputting the final value.  Of course, with my limited experience I may be implementing notifications incorrectly, so I'm not taking that as meaning that notifications cannot be the solution.

 

I would appreciate suggestions on how to implement this idea.

 

A lower priority goal is to be able to pause this gas flow program and the timer in the middle and then resume at the same point; I don't even know how to being coding this.   I would also like to be able to stop and restart the program without terminating the main VI; I assume the best way to do this is to make this code a subVI.

 

Thank you for the help in advance!

 

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

Try

false.png

true.png

Message 2 of 7
(2,321 Views)

Thank you so much for the example.  This is almost exactly what I needed!  I modified it a little so that I could have it output an array of concentration values rather than the stage of the testing procedure.  I have two remaining questions.

 

I want the loop to stop at the last settings in the table; instead, this program continues to higher and higher indicies even though they are unfilled.  I could just add an extremely long time to the next stage, but I would have to believe there is a better way to do this.  What would you suggest?

 

EDIT: I just made the loop continue only when the number of iterations is less than or equal to the number of colums in the table. Problem solved.

 

The other question is how would I allow this program to be restarted (by a boolean control) without the VI terminating?

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

Have the boolean wire a zero into the shift register rather than the current wire.

0 Kudos
Message 4 of 7
(2,279 Views)

I have implemented the loop above as a subVI, but I still have a problem.  The loop does exactly what I want in that it times the output of values properly.  However, the main VI has other subVIs that execute writes of the settings to the FieldPoint module.

 

I want those write subVIs to run after each iteration of the loop so that it updates the FieldPoint module with new data.   However, LabView seems to only work on one subVI at a time, and it waits to complete one subVI before proceeding onto another one.  What feature would I be looking for to pause execution of a subVI and change to working on another subVI before continuing ths first subVI?

 

Alternatively, would the best option be to bring the fieldpoint module writes into the while loop?

 

Thanks for the continued help!

0 Kudos
Message 5 of 7
(2,228 Views)

Without seeing your code and seeing how all of these subVI's interact with each other, it is difficult to comment in detail.  It sounds like you don't have a complete concept of data flow and are either serializing things you want to run in parallel and possibly have no data dependencies on things you want to have happen in series.

 

When I have something communicating with a single device, whether it is a fieldpoint module, a DAQ card, or a serial-based instrument, I don't try to do things with it from multiple parts of the code.  I'll set aside one loop, or one subVI that runs in parallel, and gets messages from other parts of the code by way of queues in a producer/consumer architecture.

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

Hello Vonmatrices,

 

If this code is running on the FP 2110 (which it sounds like it is), then you need to keep in mind that this is an older single-core controller and can only crunch one thread at a time.  Despite that, LabVIEW should share time between threads as long as they aren't set to time critical priority or placed within a Timed Loop structure.  Have you modified the priority of these VIs in your application?

 

This help document discusses scheduling in LVRT:

 

Understand the Priority-Based Scheduling Model (Real-Time Module)

http://zone.ni.com/reference/en-XX/help/370622L-01/lvrtbestpractices/rt_priorities/

 

Regards,

Tom L.
0 Kudos
Message 7 of 7
(2,206 Views)