LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in cycle sampling

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.

 

wsl7842_0-1579128225907.png

 

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

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:

  • there are comparison functions like ">=0", no need to wire additional constants.
  • there are functions like "+1" and "-1", no need for additional constants.
  • to multiply with 1 is Rube-Goldberg
  • when you want to compare with two limits you should use InRangeAndCoerce (read its help about changing its internal behaviour regarding "<"/">" and "<="/">="!)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,113 Views)

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). 

0 Kudos
Message 3 of 4
(1,780 Views)

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 monitoringsimplefgv.png

0 Kudos
Message 4 of 4
(1,774 Views)