LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with temperature cycling application (LV 2010)

Hello,

 

I have a hot chuck that is heated by a solid state relay. The chuck has an inlet pipe and an outlet/drain pipe. When the chuck heats up to a certain temperature, it is switched off and a water valve opens letting water run through and cool the chuck. When the chuck is cooled an air valve is opened to purge any remaining water in the pipes. This process repeats.

 

I have created a VI that allows me to set the min and max temps and have the above process repeat for a given number of cycles (chosen by the user). The program uses a state machine architecture. I am currently manually changing the temperature using a vertical slider control to observe the accuracy of the program process using simple boolean indicators. These will be replaced by the actual devices in the future to control these processes.  However, there are a couple of problems that I need help solving:

 

1. I am timing the entire program using the Elapsed time express VI. The user can set the purge time. What I am doing is using 'Wait' to hold the purge for the given purge time. This however holds the entire program. The waveform chart doesn't update and the elapsed timer freezes until the given time has passed. I must be doing this wrong. How can hold the purge without holding the other indicators?

 

2. I am trying to implement a dwell state that will hold the temperature at the max temp limit for a given amount of time. I am having many problems implementing this. I am using a PID.vi that outputs its values to a PWM signal which will eventually switch my SSR. In my attached program, the dwell state is not accomplishing this function. I tried using a while loop but when the current temperature enters the loop, it retains this value and the PID cannot work. What is the best way to use the PID and then hold at this temperature for the given dwell time?

 

3. If I want to time the duration for each process separately (heating, cooling, dwell, and purging) How can I do this?

 

I have only been using labview for a month and I keep hitting dead ends. Some of these issues seem intuitively easy to fix but it hard to do them in the program.

 

I have attached my VI for the program, the PID PWM vi, and my typedef control file for the states. I tried to be as succinct as possible in describing problems. I hope to find a solution. Thanks

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

Hi Ace_NIST

 

One option would be to break out the purge State into three different states, purge start, standby and purge end. Obviously purge start would begin the purge process, but you will also want to get the time that this process starts. Then instead of waiting for the purge to end, your state machine should go back into a standby state where it is constantly looping and monitors how long the purge has been running and, when enough time has elapsed, it sets the state to purge end where you end your purge process and proceed to the next state.

 

<Brian A | Applications Engineering | National Instruments> 

Message 2 of 4
(2,793 Views)

Ace_NIST

 

Try using a multi-loop design. This article is a good introduction to general machine control architectures. http://zone.ni.com/devzone/cda/tut/p/id/6922

 

While this is intened for use on a real-time target (cFP, cRIO, etc...), the principle is the same. You want to break you program into diffrent priority loops, and share data between them. Example:

 

----IO Loop ----

-Take in values from hardware, write to variable

-read output value from variable, write to hardware

 

---Control Loop---

-PID Loop, calculate desired outputs based on inputs

-use variables to transfer data from IO Loop

 

---Display Loop---

-Update graph based on variables

 

 

By breaking the task into separted timed loops, you can set priorites for each loop, and the user interface will not "hang" as you have described.

 

Also, do not use the "Wait" vi to control timing. This is why your code is hanging. A better method would be to use an elapsed time check every time through the loop. Your loop rate can remain fast, and each time you check to see whether or not your "hold time" condition has been met. If it has, move on to the next step.

 

 

I suggest downloading the CLD (certified labview developer) sample exams from here: https://lumen.ni.com/nicif/us/ekitcldexmprp/content.xhtml. There is one in particular that is similar to what you are trying to do called "Boiler Contoller". You might get some ideas from that.

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
Message 3 of 4
(2,785 Views)

JimMacD is right if this is a long term solution, or part of a much larger application you are building.

 

If you are looking for some quick down and dirty things that might help ASAP, here are a few you could try.

 

As stated above, loss the wait vis.  These basically suspend the program until the time expires before allowing anything to continue.  Use the Wait Unit Next vi ,assuming that your timing needs are pretty course - like 1 second, vs. 1ms.  Wire in 5 or 10ms and convert your dwell/purge times accordingly to loop iterations.  Delete your inner While loop and just use your main outer while loop.  Then just use a greater than comparison (I'd use equal to or greater than personally) to move on to the next state.  This will allow your indicators and stop button to update while in those timed periods.  This will NOT give you a perfectly smooth user interface, but should get you working.

 

You may want to consider having your stop button go to you Stop state so you can shut down all your devices if labview stops, if you haven't already considered that.  Currently your heater could continue to heat if you press the stop button at the wrong time.

Message 4 of 4
(2,774 Views)