02-21-2024 04:00 PM
Plan for this VI is to have a temperature based Trigger that once the temperature is high enough or low enough it will start a dwell timer of the set time in secs. then once the elapsed time has been reached it would then activate the next trigger to activate the next set of valves to go to the cold temperature. This should repeat for the x amount of cycles specified in cycles to complete.
the steps for this to follow are as follows but I'm unsure if even I am following them correctly
1 Enable circuit
2. Set high and low Temperature set points
3. Set dwell time.
4. Set cycles or iterations to complete
5. Start Circuit.
steps that should happen
1. The first circuit is supposed to open 2 valves and wait for the setpoint to be reached.
2. Once the setpoint has been reached the dwell time will start.
3. Once the dwell has completed, the first 2 valves close and next 2 valves open.
4. as soon as the next 2 valves open the circuit will wait until the next setpoint has been reached
5. Once the dwell has completed the process (1-4) should cycle for x amount of cycles.
The issue that I've been having is that once the first dwell time completes, the next event does not trigger nor will it keep track of cycles properly
The attached VI is a sample of what I've been working on, if you have any other thoughts or ideas on how this would work better please feel free to reach out.
02-21-2024 07:28 PM
There are two missing subVIs, 1 and 2.
02-21-2024 07:31 PM
sorry about that these are probably them
02-21-2024 08:20 PM
Ah what a mess! Your code violates all rules of dataflow and is full of race conditions. You have wired data dependencies such that the right-half of the code inside the FOR loop cannot start until the left part has completed. Let's assume that the right part should depend on the state of the "boolean" (I am sure can could come up with a more descriptive name), but that boolean has been read in parallel as soon as the current FOR loop iteration has started and will probably have a different values once the first inner while loop has completed.
You need to design this as a proper state machine without any inner loops buried deep inside case structures. All you need is a toplevel while loop running at a reasonable rate, and running code as a unction of state and user interactions. Most likely you don't need any local variables at all.
It also helps if all controls have reasonable default values. For example a value of zero for "C3 cycles to complete" is probably not reasonable.
I recommend to leave all DAQ out of it and do a pure simulation until the bugs are worked out. Much easier to debug. See how far you get.
02-21-2024 08:32 PM - edited 02-21-2024 08:34 PM
I appreciate your feedback as mentioned this is my first attempt at this. I'm just trying to figure out the best way to perform these actions one after another. the right half of the code needed to wait for the left to complete, as to why it is waiting on the left boolean to enable the right code. I will certainly look at it as a proper state machine perspective.
Thank you