01-05-2017 11:52 PM
How to use this following process in DQMH
How to control multiple State machines using START STOP RESET BUTTONS
if i click start button - all the State machines have to run init state -- > End State
if i click stop button - all the State machines have to Stop at current state , if click start have to proceed from current state
if i click reset button - all the state machines have to go init state ..
Solved! Go to Solution.
01-06-2017 02:06 PM
Hi Saran,
Have you tried doing this with a single DQMH module?
You could create a DQMH module that creates the following DQMH Request Events:
* Start sequence
* Stop sequence
* Reset sequence
Then in the Main.vi, you would add the code to follow the sequence. There are different ways of implementing this. One way is to enqueue the different steps in your sequence as soon as the Start sequence Request event is received, and have the different steps be cases in your MHL case structure. Then when the Stop button is received, you could go into an idle state that waits until the start is received again.
Alternatively, you could have a single case in your MHL have the state machine VI itself in it, and inside the state machine, you would register for the Request Events.
Give it a try and share with us a simple code having the state machine just go from init state -> step 1-> step 2-> end state. We can then give you pointers on how to improve your solution. Once we have a single DQMH doing this, it is easier to escalate it to multiple State Machines.
Regards,
Fab
link to DQMH Request definition: http://delacor.com/documentation/dqmh-html/Overview.html#Request
link to documentation on how to create a new DQMH Event: http://delacor.com/documentation/dqmh-html/DQMHDocumentation.html?CreatingaNewDQMHEvent.html
video showing the different productivity tools, starting at 2:12 it shows how to create a new DQMH Event: https://youtu.be/atqvqBUJIYM?t=2m12s
MHL = Message Handling Loop
01-07-2017 01:00 PM
Hi Fab,
Please find the Attachment below,
I have created StateMachine Module with Start, Stop, Reset Request Events,
Start Event Calls Start Process State in State Machine Module . from that Init - Step1 - Step2 - EndState with 2Sec Interval. - able to do
Stop Event Calls Idle State. (But During this event calls other State Machine Has to stop. after triggering Start Button only my State machine have to Resume ) - Not able to Do
Waiting for you reply to proceed further,
Thanks,
Saran
01-08-2017 06:43 PM
Hi Saran,
You were on the right track. I suggest you create your DQMH modules without the "Do something" events, there is a check box for that when you create the module.
I see that you are having each state on your sequence enqueue the next state when the state is done. One option to having the stop process stop the sequence is to enqueue multiple messages at the same time. You can enqueue an array of InitState, step1, step2, EndState. Then, when the stop process is received, you can flush the queue and then enqueue the stop process message. Try it, so you can see what I am talking about.
Now, before we go too far with this approach, let's clarify something:
A queued message handler is not a State Machine. Even when you can enqueue start-step 1-step 2, you cannot guarantee that the operations are done atomically (there is always a risk of a different step getting enqueued in between your steps sequence).
In addition, if you have some action that is going to hold your MHL hostage (like the delays you have on your steps), the DQMH module becomes unresponsive to other requests while that state is busy. You need to be able to interrupt your state machine and you want to be able to stop in the middle of a state.
I created a 5 minutes video showing an alternative, which is having a state machine be its own subVI inside the MHL Start Process. I only implemented the Start Process and Stop Process. Alternatively, we could have put the state machine as a helper loop on the DQMH Main.vi block diagram.
Regards,
Fab
01-08-2017 11:29 PM
Hi Fab,
Please find the attachment below.
Here my Stop Process is going to End State,
But my need is to stop the Current State and click start will continue the state till end state. (It's like Pause and Resume).
Waiting for your reply.
Thanks,
Saran
01-09-2017 11:29 AM
Hi Saran,
You have all the information you need to implement the pause/un pause functionality you want.
This needs to be implemented within the StateMachine.vi.
There are multiple ways to implement this, one option is to have a separate shift register hold what was the state at pause time. Create a new state that is called pause and stay there until the un pause request is received and from there get the next state from the shift register that is holding the "state at pause".
Regards,
Fab
01-09-2017 09:20 PM
Hi Fab,
Now I am using Start Stop Reset Resume.
Problems I am facing is 1): If I Click Reset Button it directing to Init state - > Step1 -> Step2 -> End State,
But my Process needs Reset Button Should Direct Init State and Stop State machine.
I need to click Start button to Resume my stateMachine.
2) I don't want use Resume button to continue State machine. I need to use Start button to continue my State Machine state.
Kindly seek your advice.
Thanks,
Saran
01-12-2017 02:42 AM
Hi Fab,
Thanks so much for the help and support.
Really very good tool DQMH,