06-07-2011 06:59 AM
Hello my name is raghuram and i am a student working on labview 8.5......Well i would like to explain my whole scenario to understand my task better and answer my query.........Well i am working on a machine setup which has 6 values mounted on it and these values are extended (used) to be as actuators....Well now i need to actuate these actuators such that material which i am feeding should be folded for my desired shape....Well i am using a data acquisition board USB-DIO- 96OH...i preferred my program to be as XDBITOUT.VI ..........now my question arises.......in order to fold material to my desired shape i have sequence of operations to be performed using the actuators....now my question arises, as i told to i am using 6 actuators...each actuators is designated by a port number...and this port number are used in the program to call the actuator.....as i told you i have a sequence of operations to be performed...now i need to arrange the port numbers in a order of my choice to produce the desired one........i thought to use the flat sequence structure...but i don't want my program to be lengthy....so are there any controls which can handle this kind of flat sequence....(i think array works) i have no idea....can anyone help me with a better and good controls...to keep my actuators in a sequence...in a limited space...
Solved! Go to Solution.
06-07-2011 07:58 AM
flat sequence can be replace with stacked sequence to occupy lesser space, and use the sequence local (right click on sequence border to create it) if you want to pass sequence 1 data to sequence 2. What do you actually want to do ?
06-07-2011 08:46 AM
As i mentioned above, i have six actuators.each actuator is designated with a port number....so i call a particular actuator to perform its action using its port number in my lab view program.
In my task i have to fold the material to a definite shape (the shape i require) using the actuators multiple number of times one after the other by calling the port numbers ( to produce the required shape i have a sequence of calling the actuators). Now as i mentioned i have a sequence of calling the port numbers in labview......i can call them using the flat stacked structure which u mentioned before. By doing this i find my program to lengthy in the back panel.
So, now i want to arrange the sequence in such that it seems to be really short and simple (Eg. You arrange the numbers in an array). So i need a control by which i can do the above. I hope you understand what i want to convey.
Regards,
Raghuram
06-07-2011 08:50 AM
Could you post a image of your code or code itself, pls down convert the code to 8.6 if you are working on higher version of labview
06-07-2011 09:05 AM
Going down the flat sequence/stacked sequence route sounds like a bad plan. This will create duplication of the code and make upgrading and modifying the code harder, not to mention making unreadable code.
You mention arrays... that sounds good. For loops and arrays are best friends and work well together.
If you are outputting a single bit to one digital port at a time, then set up an array so that element 0 corresponds to port 0, element 1 to port 1 etc. I am not familiar with your hardware, but as an example you can use a for loop to autoindex your array and write to the port - each time the loop runs the data will get written to another port. A simplified version is shown below - the same piece of code updates all ports on after the other:
Alternatively (again, depending on your hardware and its drivers) you could write the whole array out at once so that all ports get updated simultaneously.
If this does not make sense, I recommend visiting the tutorials on the NI web site.
06-07-2011 09:15 AM
Thanks for your reply...I hope this should really work.......
Raghuram
06-07-2011 09:21 AM
This looks like a perfect time for a QSM (Queued State Machine).
I've attached a template in LabVIEW 8.5 (it suffers from a lack of a type def for the enum- You'll want to create this as a type def to make editing easier)
and I'll post a png here
Example 2 show the OK value change event from the original
Essentially you have 9 actions that you can do: initiallize resorces, activate actuator 1-6, close resources and exit but you want to be able to change the order to meet your needs on the fly. The PERFECT excuse for a state machine. In this example the user is allowed to create sequence as an array of states (actoins) that are then enqueued to the lower loop when the user presses OK. This array could be generated from (or saved to ) a file however you want to generate sequence. If additional states are needed changing the type def for "States" allows the change to propigate automaitcally for every Control, queue element, array element, or constant associated with the type def ENCLUDING the case selector.
Let me know if you need any explainations on this type of structure- its pretty powerful and useful to understand.
06-21-2011 03:05 PM
Thanks for your reply sir, Can you please explain me in detail...because i was not able to understand the code you gave me. And you said QSM (Queued State Machine) i would like to know more about it. And as i told you i have 6 actuators......one the actuator amongst the 6 is a linear actuator and i use this to move front and back using a stepper motor. So, i made a code already to move the linear actuator (stepper motor) front and back. Now the problem is how to join the code of the linear actuator to the other program where i am using the port numbers to actuate all the other actuators i.e the other five actuators using port numbers.
06-22-2011 07:21 PM
Hi,
Queued State Machine architecture will essentially combine the best aspects of Producer/Consumer architecture and a State Machine . This will ensure the controlled state transitions and execution of a State Machine and that every aspect or transition is enqueued and executed in proper order, like we see in Producer/Consumer architecture.
Examples and explanations of Queued State Machines can be found here and here and an in depth discussion of this application architecture can be found in this third party blog post.
I hope that information helps clarify things for you!