07-24-2009 12:20 AM
Hi, I currently using LabVIEW 8.2 and still learning about LabVIEW. I’m doing a project on a FMS model using USB 6501 to run the program and I’m required to run the program continuously. I was given a program from a previous student and I’m 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. I’m currently stuck as I can’t figure out how to run the flat sequence continuously.
Firstly, it would just run once and stop at the right even when I’m using while loop.
Secondly, when pressing the stop button it wouldn’t 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.
07-24-2009
12:32 AM
- last edited on
04-15-2025
08:50 AM
by
Content Cleaner
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.
07-24-2009 01:07 AM
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…
07-24-2009 02:47 AM
I am not supposed to make your code but it was longer to explain by text instead of VI.
So see the attached image.
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.
07-24-2009
03:04 AM
- last edited on
04-15-2025
08:50 AM
by
Content Cleaner
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
07-24-2009 03:19 AM
07-24-2009 07:44 AM
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.
07-24-2009 09:23 PM
07-24-2009 11:31 PM
07-24-2009 11:57 PM
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