LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

valve sequencing

Solved!
Go to solution

Hi!

 

I am relatively new to Labview (been doing some easy measurement (analog, digital,...) but have now stubled upon something new and don't know how to approach it. This is the problem:

Scan.jpg

 

I have 2 valves with 2 electromagnets. It the valve gets signal from left EM it goes into position 1, if it gets from right EM it goes to position 2. It there is no signal it stays in position 0. On the top with number 3 and 4 are inductive switches. So what I would like to do is next:

 

Stage 1: Valve1 and Valve2 both get in position 1 at the same time.

Stage 2: When top piston activates inductive switch (red number 4), Valve2 stays in position 0 for 2 seconds.

Stage 3: Both Valve1 and Valve2 go to position 2. (the top piston starts moving left)

Stage 4: When it activates inductive switch (red number 3), Valve 2 again stays in position 0 for 2 seconds.

Stage 5: The loop is repeated.

 

So the question is how to begin building code for sequencing. Should I build code in Flat Sequence Structure, Timed Sequence or something else?

 

Thanks for all the help you can give me.

 

Much appreciated!

 

Jure

 

0 Kudos
Message 1 of 16
(2,721 Views)

@koli99 wrote:

[...] 

So the question is how to begin building code for sequencing. Should I build code in Flat Sequence Structure, Timed Sequence or something else?

 


 

Neither! You should learn about State Machines.

 

Richard






Message 2 of 16
(2,703 Views)

Indeed the best thing will be to use state machine.

I am attaching a simple VI that will demonstrate you the overall idea of state machine.

 

As you will see in the example, the most important parts of state machine are:

- an enum that will define you the states

- a case structure, you will pass the enum in a shift register and the case structure will choose to switch between cases.

 

Kind regards,

0 Kudos
Message 3 of 16
(2,648 Views)

Thanks for giving me some direction... As I'm compleatly new in State Machines I have a couple of questions.

 

So far I have done is attached below. In the VI attached I have build a default case with a button to start sequence. If the button is pressed it goes to first case "1", where valves 200.0, 209.0 and 209.1 are opened (position 1).

Below I have simulated a signal, which represents inductive switch I4. When maximum peak is reached it goes to case "2", where valve 200.0 is opened in position 2, therefore it shouldn't receive signal for position 1, but for some reason I cannot shut down signal for position 1. I tried simply putting false statment but the valve keeps being open in both positions. How do I shut it down?

 

Thanks for all the help!

 

Jure Hrovatin

 

0 Kudos
Message 4 of 16
(2,639 Views)

Hey,

 

 another idea you can use - event structure.

 

As I understand more from your VI, you need to react when you press a button and than have an idle state where you measure some values and take some decision if the values exceed some level.

 

You can read about event structure here http://zone.ni.com/reference/en-XX/help/371361H-01/glang/event_structure/

and also look in examples in LabVIEW.

 

Kind regards,

Ion R.

0 Kudos
Message 5 of 16
(2,620 Views)

Actually no. When the program is completed, all I would like to do is to start sequence by pressing button and the loop would run for 10000 cycles. Still figuring out how to stop signal in next case... Any ideas?

0 Kudos
Message 6 of 16
(2,617 Views)

Hey, the problem that I saw in your VI is: where do you start the tasks? You can either use Start Task VI or you have an autostart on writing VI.

 

This should solve the problem with writign False Value.

 

Kind regards,

Ion R.

0 Kudos
Message 7 of 16
(2,594 Views)

Also, please don't forget to initialize all the shift registers you are using, and here the most important is the shift registers that contains the enum for the state machine.

0 Kudos
Message 8 of 16
(2,591 Views)

How do I initalize shift register if I already have wired Enum constant to it? Do I create another shift register and initialize it with 0?

0 Kudos
Message 9 of 16
(2,589 Views)

I was refering to the shift register of the state machine.

I attached a screenshot, this will force your state machine start from the same state anytime you run the VI.

 

Kind regards,

Ion R.

0 Kudos
Message 10 of 16
(2,587 Views)