03-19-2013 12:34 AM
Hello, I am a senior in a mechanical engineering program working on my senior project. An optional part of the project is to create a user interface to automate the operation of a cylical tension rack my team has designed, and we would like to use LabView for this task. The tension rack is to provide tension to two cables via a hydraulic ram. The issue is, we are relatively inexperienced with LabView but it is the only program we have available to us. So, help would be appreciated.
The particular problem we are encountering is that we do not know how to continuously log and plot data to a waveform chart when using while-loops that must run in sequence within a for-loop. Here is some pseudo code to represent what we want accomplished:
User input:
Set max load desired (ML)
Set numer of cycles to perform (NC)
Set hold time at max load (HT)
To run continuously:
Receive data from pressure transducer (PT)
Receive and plot data in waveform chart from load cell 1 (LC1)
Receive and plot data in waveform chart from load cell 2 (LC2)
STOP program if value from PT > certain value
for i=1:NC
Sequence 1:
while(LC1 <= ML && LC2 <= ML)
increase pressure to hydraulic ram to increase tension in cables
Sequence 2:
if (LC1 >= ML && LC2 >= ML)
hold pressure to hydraulic ram to maintain tensile load for HT seconds
Sequence 3:
while(LC1 > 0 && LC2 > 0)
decrease pressure to hydraulic ram to decrease tension in cables to zero
i++
end for-loop
So, to clarify, we need continuous readings and plotting of data from the instruments to determine when a particular loop begins and ends. The problem we have encountered is that as soon as the code enters a while-loop or particular sequence, plotting to the waveform chart ceases. Further, we need the user to have access to an emergency stop button on the UI that will deactivate the hydraulic ram pump and stop the LabView program regardless of where the program is executing in the code.
Is there a simple way to accomplish this? Any help would be very much appreciated.
Please note I am not asking for someone to write the program for us. I'm just looking for guidance on the structure needed to accomplish these tasks. The rest we can figure out on our own.
Attached to this post is the current state of the program for reference. Note that as I am currently working on the program from my personal laptop with the student version of LabView I do not have the DAQ assist element to put into the code, so temporarily there are constants that are feedinging into formula elements that will convert voltage readings to forces/pressure with calibration equations.
Sincerely,
Holiday
03-19-2013 04:59 PM
Hello Holiday,
Looking at that sequence, I believe you could use the state machine design pattern for this application. You can run sequences and have a transition code to determine to which state are we moving to in the state machine. You could also configure a Shutdown case, so that if an error occurs or the user presses the Emergency button, the state machine would go to the shutdown case. Take a look at this tutorial for more information on this design pattern.
Application Design Patterns: State Machines
Best Regards,
Alina M
03-19-2013 07:11 PM
I believe this should work. Thank you kindly, Alina.