From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-01-2022 08:40 AM
I made a simple code with three cases (Main group, group 1, group 2). I would like my the flow to be as shown below:
I can smoothly move from Main Group to Group 1, from Group 1 back to Main Group. Now the problem that I am having is to move from Main Group to Group 2. Is there any way I can move from Main Group to Group 2 without duplicating/recreating Main Group code over and over.
I have attached my block diagram.
Solved! Go to Solution.
03-01-2022 09:15 AM - edited 03-01-2022 09:17 AM
You can make decisions in each state that decides what the next state will be:
Also you really should learn how to use a Type Def as this makes working with Enum's a lot easier as if you need to add or remove an item from your Enum. If that Enum is also a Type Def then you only need to change one and every copy of that Type Def Enum will be updated in your program
03-01-2022 09:30 AM
The thing is I don't want to move from Group 1 to Group 2.
Please here is the flow I want:
I want the flow to be from Main Group to Group 1, from Group 1 back to Main Group, then from main Group to Group 2, then from Group 2 back to main Group.
03-01-2022 09:35 AM - edited 03-01-2022 09:36 AM
@GRCK5000 wrote:
The thing is I don't want to move from Group 1 to Group 2.
Please here is the flow I want:
I want the flow to be from Main Group to Group 1, from Group 1 back to Main Group, then from main Group to Group 2, then from Group 2 back to main Group.
Oh... Okay then you will need to keep track of the states you have executed like with a Boolean and use some logic in your Main Group to select the next state.
Or consider a Queued Sate Machine. In a QSM you load a Queue with the states in the order you want to execute them.
03-01-2022 09:38 AM
Yes, I am trying my best to create some logic, but if you can, please let me know.
03-01-2022 09:55 AM
Try something like this.
03-01-2022 09:55 AM - edited 03-01-2022 09:57 AM
Honestly instead of coming up with come convoluted logic that is not going to scale well for a large application.
You really should think about moving to a Queued State Machine.
I also made your Type Def for you...
03-01-2022 09:57 AM
At a minimum I would suggest looking at the JKI State Machine as a starting point. But yes, I agree that to be a decent state machine, or QMH, there is quite a bit more needed to control the flow.
03-01-2022 10:04 AM
Thanks RTSLVU. I am not being able to open your block diagrams. Can you please save it as previous version. Then repost them.
The way to do it:
Open the block diagram: Go to File >> save for previous version . Then send back.
If you can't do it, I will just try to recreate using the picture you posted.
03-01-2022 10:16 AM
This is the error that I am getting: