LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous loop for flat sequence

Hi, I currently using LabVIEW 8.2 and still learning about LabVIEW. Im doing a project on a FMS model using USB 6501 to run the program and Im required to run the program continuously. I was given a program from a previous student and Im supposed to modify the current program.  The purpose of the program is to gather stock from the warehouse and place it in a different slot.

 

 I have a sample of the program and layout of the model where the lift is to move to the left and back to the right. Im currently stuck as I cant figure out how to run the flat sequence continuously.

 

Firstly, it would just run once and stop at the right even when Im using while loop.

 

Secondly, when pressing the stop button it wouldnt stop the program midway, it would continue to run until the frame ends. Is there a way to stop the frame when an error occurs?

 

Please advice. Thanks.

 

warehouse.JPG

0 Kudos
Message 1 of 14
(7,812 Views)

In the middle of the flat sequence you cannot stop the while loop.Use state machine architecture to handle the states instead of flat sequences.

https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentat...

Message Edited by Baji on 07-24-2009 11:03 AM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 2 of 14
(7,808 Views)

I'm sorry Baji, I do not understand how am I going to use the state machine to implement the desired outcome. I'm supposed to use the lift to physically trigger the triggers in the model. If I would to use the example given, how to implement it in my program? I’m confused…

0 Kudos
Message 3 of 14
(7,798 Views)

I am not supposed to make your code but it was longer to explain by text instead of VI.

So see the attached image.

 

LIFT LOOP-1-LV82.png

 

As you can see, usually, it's not necessary to repeat such operation as Write a digital line so you can proceed once.

Think to use error cluster to sequence the code => double advantage : less structure and error treatment

 

 

I suggest you create SubVi to drive your digital line instead of multi call of DAQ Assistant because it's hard to read.

 

 

0 Kudos
Message 4 of 14
(7,782 Views)

You definetly have to switch to a reliable architecture!

I think that your application must have several security features to prevent damage of hardware or even humans. So you must not use a program which just moves the lift from startpoint to endpoint without any chance to break the movement!

 

That being said, i see two approaches:

a) Statemachine

b) Producer/Consumer

 

The backdraft of Statemachine is its polling character. So you can only react to "worst cases" only within your given timeframe. The timeframe is the polling time plus all latencies including signal delays and similar. This can easily add up to about 1s and more.

Producer/Consumer can possibly react a little faster if it is event based. The backdraft is that you need a rather good knowledge of LV in order to implement this properly.

 

Another thing for applications like this are latencies created by the OS. Maybe it is necessary (not only recommended) to switch to a RT system or even FPGA in order to keep proper reaction times.....

 

Maybe it is a good idea to talk about this application with an NI Alliance Member .

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 14
(7,780 Views)
Sure, my solution is just a minimum but a structured architecture will be better.
0 Kudos
Message 6 of 14
(7,773 Views)

Shelby Ho,

 

As Baji stated, flat sequence is not a good way to do this.  Think of each frame in your flat sequence as an individual state in a state machine.  The state machine can be programed to execute a preset sequence of states just like a flat sequence.  The difference is that the state machine has the flexibility to exit that preset sequence and react to things like external inputs, hardware errors or software errors.

0 Kudos
Message 7 of 14
(7,754 Views)
Thanks guys!!! I would try the solution from J.DECHET and see how it goes on the model. I believe that I really lack LV knowledge on how to implement it in the model. I've managed to do up the hardware part but the software requires quite some time to understand it. Greatly appreciate the help you guys are providing.
0 Kudos
Message 8 of 14
(7,733 Views)
Tried the solution given by J.DECHET , however I'm not able to solve the errors. I've attached the file, any advise would be greatly appreciated.
0 Kudos
Message 9 of 14
(7,723 Views)

You need to wire the error wire through the Error case of the middle case structure.

 

If you click on the broken run arrow, it will give a list of errors.  Pick and error (I only saw the one) and click show error and it will take you to it.

 

I would recommend you learn more about LabVIEW from here. How to Learn LV

0 Kudos
Message 10 of 14
(7,719 Views)