04-15-2019 06:40 AM
Hi Guys,
I am trying to control a three axis machine movements using a sequence structure.
Suppose If I have to move x-axis from the current position to end position I make the machine to reach end position at 5 intervals, in case if I change the count to 3, it reaches the end position at 3 intervals.
The problem is I can do this by changing the code every time, but I have to make it user-defined. I use a sequence structure inside a state machine. And based on the no of intervals the sequence structure has to be placed. now the issue is I can change the x,y and z to move at any positions but not the intervals and make them stop at different no of positions as it is fixed. Example now I want the machine to reach end position at 4 intervals not at 5. And I use a for loop and control the no of iterations for the intervals. I have also attached my VI, is there any other way to get around this and able to control the no of intervals.
Thanks in advance for any assistance.
04-15-2019 06:51 AM
I don't know too much about the application but it looks like you might want each one of those frames to be its own state in the state machine. Then you could iterate through an array of states
04-15-2019 07:53 AM
I hate looking at tiny pictures of large Block Diagrams. [I don't like large Block Diagrams either, but if they are part of a VI, I can at least use the Navigation Window and scroll around without eyestrain]. So I won't comment on the code I looked at for 2 seconds at most.
You have a three-axis machine, and it sounds like you want to control the axes independently. This suggests a State Machine for each Axis, all running in parallel (easy to do with LabVIEW). Each State has a single, simple "rule" -- Do Movement X and stay there for time T. That's one State, characterized by two parameters, so with an array of Parameters, you could have a three-state State machine, "Initialize", "Do Move", and "Shut Down".
Bob Schor
04-15-2019 08:01 AM
Hi Guys,
Yes sorry for my big program.
The thing is controlling them seperately is not my issue, Infact I want to control them together. But the issue is to control the intervals, how do I configure the intervals each time to change the intervals. As I use 6 sequence structure is because that I need 6 intervals, is there any alternative to that 6 sequence structure, because now i cant change the intervals to 5 or 4 or 3 as there is already 6 sequence structure.
04-15-2019 08:15 AM
Yes. It is called a For Loop.
04-15-2019 04:06 PM
More specifically, it's a For Loop with a Case Statement inside it, wired to the Index ("i") element of the For loop so you first do Case 0, then Case 1, then Case 2, with common wires (like the Error Line) running in Shift Registers attached to the For loop and brought into the Case using Tunnels. Common data (arrays, DAQmx I/O channels, File Paths, etc.) can also be run through Shift Registers if they are used in this "sequence". Note you'll need a "default" case (unless you want to separately specify all possible LabVIEW integer case numbers).
Bob Schor
04-15-2019 04:15 PM
Since you didn't post any code, we can't see what's inside the subVI's. I'm can only assume that the X subVI moves in the x direction, Z subVI moves in the z direction but what does Y, Y1, Y2, Y3, Y4, Y5 and Y6 do that is so different that you need 7 different subVIs. This is the crux of your problem since you think you need a different subVI for each additional interval.
04-23-2019 08:50 AM
Yes now I understand it.
Thank you.
04-23-2019 01:15 PM - edited 04-23-2019 01:19 PM
I know this is no help but your program is a prime example of why sequence structures (flat and stacked) should be deprecated and no longer taught in LV training.
For future reference, whenever you find yourself reaching for a Sequence structure...
STOP!
Take a step back and think about what you are doing, because there is probably a better way.
One more thing...
The Flat Sequence structure in your code looks superfluous to begin with, you can remove it and the code will execute the same.