01-15-2020 04:44 PM
Hi,
I'm working on controling two valves turn on for certain time sequently several times in long period time. For example, I would like each valve turn on 10 min sequently, the time for two valves turn on once is 20 min, and I want them do this cycle for 3 hrs. I write this using a case structure, shown in the attachment. I want both two valves can be open for at least 1 sec when switch to turn on the valve. However, what my program can do is turn on another valve after one valve turn off. Does anyone know how to fix it?
Thanks.
01-16-2020 01:03 AM
Hi wsl,
@wsl7842 wrote:
For example, I would like each valve turn on 10 min sequently, the time for two valves turn on once is 20 min, and I want them do this cycle for 3 hrs. I write this using a case structure, shown in the attachment. I want both two valves can be open for at least 1 sec when switch to turn on the valve. However, what my program can do is turn on another valve after one valve turn off. Does anyone know how to fix it?
Yes: use a statemachine!
Have states like "wait", "switch valve", "init", "exit"…
You also should simplify your VI:
10-22-2020 08:14 PM
Hi GredW,
Thanks for your reply. I still have some questions about the state machine. The state machine have a while loop outside. Since the process of valves I mentioned is just one step of my diagram, I'm using several time-limitation to control each step, how can I control the while loop start at certain time and end at certain time (I have a lapsed time to count the whole time of the running program). The other problem is that I need to put the daq assistant outside the while loop, because other processes are also control the valves connected to the daq. I have tried the state machine, but inside the case structure of the state machine I cannot control the valves state , although I wire the Ture/False inside the case structure to the daq assistant (outside the while loop).
10-22-2020 08:49 PM
For time control the best way to achieve it is to have your own Functional Global Variable (FGV) It would be like a clock variable, you can Start it, Reset, or ask how much time has it passed since you started it; and State Machine is required for the application you are describing, you can monitor the other controls of the valve on an "Idle" state, as you are monitoring the FGV, and when the FGV has detected that the required time has passed, you can use it as a Bolean value to change the state, Heres an example of FGV for time monitoring