06-28-2007 04:22 PM
I am relatively green, and self taught in my VI design methods, so in many way I know my VI is inefficient and clumsy. Because of this I have a screen shot of the specific problem I am having (I think). http://img521.imageshack.us/img521/2275/timercodepic3dh6.png
My focus is the Elapsed Time express VI. The purpose of this Vi is to automate a 3 tier temperature gradient (94 --> 50 --> 72°C) while holding the temperature constant at each temperature for a specified duration (30 seconds in this case). Holding the temperature constant for 30sec is where my VI is failing. For the first 6 iterations (Case Loop 0-5) the VI is fine, each temperature is reached and held correctly. However, after the 5th case, where the middle While Loop ends (atleast I think it does) then the main While Loop iterates, and the process starts over but the timers don’t seem to be resetting. Case 0 works fine (it's condition is not timed, instead it is based on reaching a temperature) but when Case 1 starts, it immediately kicks out to Case 2, which works fine (again not time dependant) and then Case 3 kicks out instantly which also has the Elapsed Time VI as its condition. To help any confusion, this is what is happening currently in the Case Structure:
Case 0 = heat to 90°C ; Case 1 = Hold Temp 30sec ; Case 2 = cool to 50°C ; Case 3 = Hold Temp 30sec ; Case 4 = heat to 72°C ; Case 5 = Hold Temp 30sec ; While loop ends, kicks out, main While iterates, back to Case 0 = heat to 90 °C ; Case 1 = LED lights up for split second ; Case 2 = cool to 50°C etc...
I want the temperature to be held for 30sec each time Case 1, 3, 5 are called. I have "Automatically reset after time target" option turned on, I also have a True Boolean tunneling into this loop every time the Case loop is called. Without this Boolean the end result is the same, I added it and it changed absolutely nothing. I tried having a True Boolean tunnel in to the "Reset" node on the Elapsed Time express vi, but that definitely did not work.
Any advice is welcome I will try anything. I know there are better, more efficient ways to program this type of timing using more basic functions, but I exasperated myself trying different ones from tutorials. Other than this timing issue I think my VI is operating as intended, albeit very inefficiently.
06-28-2007 05:24 PM
06-28-2007 08:01 PM - edited 06-28-2007 08:01 PM
Message Edited by Ravens Fan on 06-28-2007 09:02 PM
06-29-2007 11:34 AM
I thought I would post my code in its entirety. I’m not sure if my confounded while loop structure is the cause of the timing issue. It seems to me that on the second go around, the Elapsed Time express
PS: There are 4 Boolean controls on the Front Panel that don't do anything yet, I plan to implement them but they are not required for the VI to function as desired, they only give added safety shutoff control. And the shift registers in the 2 outer while loops don't do much yet either... infact I don’t know why I put them there... Side question: What is the difference between using a shift register to record the loop iteration, versus just using the iteration function default in any while loop?
Thanks again,
--Andrew
06-29-2007 12:18 PM
If the express VI's are giving problems, you may want to turn them into code you can look at. Right click in the express VI and select Open Front Panel. This will turn the code into a subVI that you can open up and look into. You may want to eliminate the express VI and replace them with a simple loop structure that keeps the start time in a shift register and continually subtracts that from the current time. Search the forums as I am sure there are numerous examples on how to do that.
@Anfu wrote:
Side question: What is the difference between using a shift register to record the loop iteration, versus just using the iteration function default in any while loop?