08-19-2015 04:21 AM
08-19-2015 05:25 AM
This is how you could do it with a while loop.
And you could replace the Event structure with a case structure as a state mashine.
I don't think Notifiers are the best for your application right now.
08-21-2015 04:30 AM
@dkfire wrote:
This is how you could do it with a while loop.
And you could replace the Event structure with a case structure as a state mashine.
I don't think Notifiers are the best for your application right now.
Hi dkfire:
I think that you just have solve my problem. It was very clever to replace a FOR loop for a WHILE loop that do the same function.
Now I can add to them states machines.
Instead of notifiers, I was using val (signl) from a LED, what do you think could be enough?
here is my new program state machine:
and here is the snippet of my program....
please, any comments on how can I improve my program is welcome,
looking forward to hear form anyone.....
08-21-2015 06:27 AM
My example was to show you how to turn your for-loop around and use a while loop.
Now, how to implement that in your program in the correct way, I still need to see a bigger and better picture of your program and its design.
How are you using the coordinate (the array element) outside this loop?
Is there anyone, beside a user, that is controlling/instructing this loop?
Remember that value signaling is generating an event for EVERY value you write to it, not just if the value change.
You should not need to place a wait in the case structure, let the Event structure timeout do the wait. Change the timeout value when needed, as I did in my example.
If you need a good answer and help to your program, you need to give us all the information, else we can only give standart general answers, that might not help you.
08-21-2015 08:48 AM
dkfire wrote:
My example was to show you how to turn your for-loop around and use a while loop.
Now, how to implement that in your program in the correct way, I still need to see a bigger and better picture of your program and its design.
How are you using the coordinate (the array element) outside this loop?
Is there anyone, beside a user, that is controlling/instructing this loop?
The bigger picture is that I have two processes a motor executing and a laser executing.
I use the coordinates to a Sub-VI that executes moves in the motor process, after the moves are finished then an event is triggered (by event reg callback) and the laser process should begin. During this laser process, the motor process should be "on pause" keeping the coordinate unchanged until an event is triggered from the laser process saying that it has finished (also by another event reg callback).
I am using this callback because the program is based on ControlX communication.
So the program is based in UI events (for start and stop button) and reg event (for motor finished and laser finished callback events). In this last ones, I was thinking on using value(signall) for triggering the events, what else can I use instead of it?
Remember that value signaling is generating an event for EVERY value you write to it, not just if the value change.
You should not need to place a wait in the case structure, let the Event structure timeout do the wait. Change the timeout value when needed, as I did in my example.
I know that about value signalling, I used for that purpose, because I don't know what else can I use to let the event structure know that something is triggered (besides buttons and leds).
The problem with the wait case in a case strcutre is that after I will need to have another process running (laser process) and I need to have the motor process in "pause". So using the -1 in the time out doesn't allowed me to enter into my states (case structure). if you know how can be do it, please send me a correction.
If you need a good answer and help to your program, you need to give us all the information, else we can only give standart general answers, that might not help you.
is there anything else you need to know?
08-21-2015 09:18 AM
Put the laser cutting process (as a separate VI) in the same for loop as your laser move process. Each iteration will take a new set of coords, move the laser to the proper position, and begin cutting. When that iteration finishes, the next set of coords is taken and the same operations happen, rinse and repeat untill all of the rows in the array are used. Here is how I might do it. (Note: I added some additional variables in the cluster on the left to show you how you can use this architecture for easily passing data or parameters thru your program. )
08-21-2015 10:03 AM
Stavrosyt wrote:The bigger picture is that I have two processes a motor executing and a laser executing.
I use the coordinates to a Sub-VI that executes moves in the motor process, after the moves are finished then an event is triggered (by event reg callback) and the laser process should begin. During this laser process, the motor process should be "on pause" keeping the coordinate unchanged until an event is triggered from the laser process saying that it has finished (also by another event reg callback).
I am using this callback because the program is based on ControlX communication.
What is ControlX communication?
I don't know what that is, and not something I see in LabVIEW every day. Do you mean ActiveX function?
To have a process in pause mode, is just a statemashine that is waiting for commands.
So the program is based in UI events (for start and stop button) and reg event (for motor finished and laser finished callback events). In this last ones, I was thinking on using value(signall) for triggering the events, what else can I use instead of it?
For communication to an Event Structure, you can use value signaling, or maybe better User Events.
I know that about value signalling, I used for that purpose, because I don't know what else can I use to let the event structure know that something is triggered (besides buttons and leds).
The problem with the wait case in a case strcutre is that after I will need to have another process running (laser process) and I need to have the motor process in "pause". So using the -1 in the time out doesn't allowed me to enter into my states (case structure). if you know how can be do it, please send me a correction.
It was not the Wait case that I was talking about, but the use of Wait(ms) function inside multiple cases in the case structure.
Take a look at my program again, the VI is included. In that I'm changing the timeout dynamicly.
is there anything else you need to know?
I still would like to see how you have design your register call back functions, and how you are using them.
Why not show the motor process, with the vi's for the motor communication.
08-26-2015 07:44 AM
@aputman wrote:
Put the laser cutting process (as a separate VI) in the same for loop as your laser move process. Each iteration will take a new set of coords, move the laser to the proper position, and begin cutting. When that iteration finishes, the next set of coords is taken and the same operations happen, rinse and repeat untill all of the rows in the array are used. Here is how I might do it. (Note: I added some additional variables in the cluster on the left to show you how you can use this architecture for easily passing data or parameters thru your program. )
Hi again,
can you explain a little about how this process works? because I see the two sending notifiers (one for the initialize and one for start cases), and which of the "start" correspond the state in the event case structure?
It looks promising but I need to really understand it.....thanks....
08-26-2015 07:56 AM
@dkfire wrote:
What is ControlX communication?
I don't know what that is, and not something I see in LabVIEW every day. Do you mean ActiveX function?
To have a process in pause mode, is just a statemashine that is waiting for commands.
Yes I meant ActiveX control that differs from ActiveX automation. This activeX does not have anything to do with the pause mode. I will use for sure the state machine for waiting an event, but the ActiveX is just how the machine comunicate with LABVIEW.
For communication to an Event Structure, you can use value signaling, or maybe better User Events.
Thanks, but I need to used both in anycase. User events for START and STOP buttons, and value signalling for triggering from reg callback events.
It was not the Wait case that I was talking about, but the use of Wait(ms) function inside multiple cases in the case structure.
Take a look at my program again, the VI is included. In that I'm changing the timeout dynamicly.
Ok, it was really clever the way you use the timeout changing to -1 if you need a pause, but when you build a case structure for the state machine, the enviroment somehow changes. I can't continue using -1 in the event structure, because it would never enter inside the states.
I still would like to see how you have design your register call back functions, and how you are using them.
Why not show the motor process, with the vi's for the motor communication.
Sure, I am attaching ansnippet of the Motor events process, that's before I was planning to use the state machine. (which now I realize is definitly important)
08-26-2015 10:49 AM
You need to run the VI with execution highlighting on. This will explain everything for you (or should explain it). After initializing, both loops just sit there waiting for an event to occur or a notification to be received.