LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control states with feedback signal

Solved!
Go to solution

Hello all, first post here,

 

What I have is a VI that measures pressure continuously from a cDAQ 9237 and records to a file.  What I need is to do is react on that feedback data to open/close 4 solenoids as required with a cDAQ 9481  For this project, I need to fill a vessel cyclically to +2 then -2 psi for 100k cycles.  So far, I have solved this for a two state or limit level system as seen below.

 limit switching 1.jpg

 

I believe I need to expand this concept to a multiple state system with a "Fill", "Empty", "Hold" (and probably an Initialize and End state as well) that is selected by the feedback data.  I figure if I do this all with logic and limits, I still wont know if its time to fill or empty the tank, so some sort of sequencing is required.  At some point I will add a counter to one side of the cycles to count up to the 100k mark and end the test.

 

Do you have any suggestion for how to achieve this?  I am stumped.

 

Thanks,

Ken

 

 

 

0 Kudos
Message 1 of 8
(3,364 Views)

a quikck search with the words State machine design pattern (Sorted by Kudos) will turn up some interesting threads


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(3,362 Views)

It appears as though a state machine is the accepted choice for this sort of problem, so this is my first try at one.  Still not sure if I am using enum constants properly, or even built a state machine for that matter.  It did seem to control my solenoids as intended from the pressure feedback.

 

I still have not figured how to use the stop button as the final state or count the cycles correctly.  I am hoping to count every high pressure hold instance.  I think it may have something to do with local variables,but have not solved it yet.

 

I am also struggling how to implement a brief pause after the hold states occur; maybe for a second or so.  My first try did pause, but did not switch the solenoids until after the wait, which would be bad.

 

Any inputs/criticisms are welcome - Ken

Download All
0 Kudos
Message 3 of 8
(3,327 Views)

Well, no one seems to have any ideas, but here's an update anyways.

 

I figured out a way to include the stop button and a counter using some case structures and a shift register.  I'm sure there are cleaner ways, but it works.

 

Still struggling with how to implement a brief pause at the hold states while still switching the solenoids first.

0 Kudos
Message 4 of 8
(3,296 Views)
Solution
Accepted by topic author kakadyne

" I am hoping to count every high pressure hold instance.  I think it may have something to do with local variables,but have not solved it yet." add a Shift register that increments in that state. (A feedback node would be cleaner!)

 

I am also struggling how to implement a brief pause after the hold states occur; Look for the Time Delay vi on the timing palatte


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 8
(3,288 Views)

Thanks Jeff,

 

I will look into the feedback node again.  My first attempts were unsuccessful.

 

I may have set up my structures in a poor manner as every wait/pause I try causes either a global time delay for each loop or if placed in the state, delays when the solenoids are switch and overpressurizes the UUT.  I'm hoping to delay after the switch, but only in the two hold states.

 

Would it be better to place the DO read out inside the state?  It seemed cleaner outside of the state cases but may not functions as desired.

 

 

0 Kudos
Message 6 of 8
(3,274 Views)

just pass a time to wait out of the states (Usually 0)


"Should be" isn't "Is" -Jay
Message 7 of 8
(3,268 Views)

Ahh, I got it now.  Not sure how I missed that but it seems to work well.  Thanks again Jeff.

0 Kudos
Message 8 of 8
(3,261 Views)