LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Maintain Temperature While Other Processes Execute

I would like to reach a temperature setpoint, and once that setpoint is reached index a stepper motor several times and record some voltages while maintaining the temperature at the setpoint (at 25 degrees, index the motor 5 times, then do the same for 35 and 45 degrees...)

 

I'm running a temperature control loop in parallel with the other tasks so the program would continue to maintain the temperature as the motor ran through it's routine. My question is how do I execute the top structure (the nested for loops) once I've reached the desired temperature. A case structure didn't work because if the temperature was not at the setpoint, the for loop just went on to the next temperature. Putting the for loops in an event structure is not working either. I tried triggering the event struture with a boolean value change (if the temp is in range - index the motor).

 

Position and Temp.vi is the highest level VI.

 

Andrew

Andrew
0 Kudos
Message 1 of 4
(2,211 Views)

The architecture you have is very odd.  A For loop inside an event structure inside a For Loop is something I have never seen done before.

 

The first problem you have is that your event structure will never fire (unless I'm missing something).  Your lone event is a Value change event for the At Temp indicator.  Since it is an indicator, user interaction on the front panel will not cause it to fire.  And since you never use the Value(signalling) property node, you can never programmatically cause the event to fire.

 

You should be using a State machine architecture.  You'd have a while loop with a case structure inside.  What you do is have some states such as intitialize and closeout, but also wait (for the temperature to stabilize) and advance to next temperature.  Perhaps also a log to file state.  Once you've determined in the wait state that temperature has stabilized, then you can go to the Next Temp state to pick off your next temperature setpoint from the array (you store the index of the array you are working on in a shift register).  Issue the commands necessary to change the temperature, and go into the wait state again.

0 Kudos
Message 2 of 4
(2,207 Views)

Okay - state machine: I'm on it.

 

Just out of curiosity, how should the At Temp Value(Signalling) property node be wired so that a change from a false to true will fire an event structure - that's what I was going for.

 

The while loop with the state machine in it - should this run in parallel with my temp acquisition/control loop or is acquisition /control going to be one of the states?

Andrew
0 Kudos
Message 3 of 4
(2,200 Views)

@arcranda wrote:

Okay - state machine: I'm on it.

 

Just out of curiosity, how should the At Temp Value(Signalling) property node be wired so that a change from a false to true will fire an event structure - that's what I was going for.

You could use a feedback node to compare the last boolean value with the current one.  So output from feedback NOT   AND output of current value (which gets fed to feedback for next iteration) would drive a case structure where the Value (signalling) is in the true case.  You could also let the event structure always fire and do a comparison of the OldVal and NewVal out of the terminals inside the event case then decide what to do.

 

 

The while loop with the state machine in it - should this run in parallel with my temp acquisition/control loop or is acquisition /control going to be one of the states?  I would make the acquistion control loop separate and parallel to the state machine.  And use queues, notifiers, local variables, or functional global variables (which is best and which I would avoid would depend on the situation) as a mechanism to communicate between the loops.


 

0 Kudos
Message 4 of 4
(2,198 Views)