Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directed entry to specific sub-state of nested machine #587

Open
aplotskin opened this issue Aug 9, 2023 · 4 comments
Open

Directed entry to specific sub-state of nested machine #587

aplotskin opened this issue Aug 9, 2023 · 4 comments

Comments

@aplotskin
Copy link

Expected Behavior

I am looking to implement a directed transition into a nested submachine state, roughly matching the following diagram
from this boost document:

image

I have tried to go directly to a substate in a nested state like the following (using the state names of the above picture):

state<State1> + event<GoToCompositeS2> = state<Composite::Sub2>

but that action does not trigger the on_entry<_> piece of the larger Composite state machine, so feels like I am breaking something and should be cautious.

Is there a recommended way to do this using SML? Thank you.

@aplotskin aplotskin changed the title Entry point pseudo-state Directed entry to specific sub-state of nested machine Aug 9, 2023
@ekigwana
Copy link

ekigwana commented Aug 9, 2023

What you need is an arrow from State 1 -> Composite. If the desired initial state is Sub2 and it makes sense, then make that the initial state. State 1 -> Composite, region 1 kicks off its initial state, region 2 -> Sub1

See https://boost-ext.github.io/sml/examples.html#composite

@aplotskin
Copy link
Author

aplotskin commented Aug 9, 2023

What you need is an arrow from State 1 -> Composite. If the desired initial state is Sub2 and it makes sense, then make that the initial state. State 1 -> Composite, region 1 kicks off its initial state, region 2 -> Sub1

Thank you, appreciate the reply and I see how my grabbing of that particular picture caused confusion. I only used that picture to show a directed transition example. My system is more complex, with a default initial state in Composite that is different from the one I want a particular upper state and event to transition into.

@ekigwana
Copy link

ekigwana commented Aug 9, 2023

What you need is an arrow from State 1 -> Composite. If the desired initial state is Sub2 and it makes sense, then make that the initial state. State 1 -> Composite, region 1 kicks off its initial state, region 2 -> Sub1

Thank you, appreciate the reply and I see how my grabbing of that particular picture caused confusion. I only used that picture to show a directed transition example. My system is more complex, with a default initial state in Composite that is different from the one I want a particular upper state and event to transition into.

Then what you need is a Sub0 state which auto transitions to Sub1 or Sub2 as you desire.

@aplotskin
Copy link
Author

@ekigwana thank you again. My Composite is actually pretty complex and is a History state, so does not have a normal initial entry path. So I was hoping this part of the UML state machine language was supported in SML. Seems like not.

I may be able to refactor my Composite into two pieces where this directed-to state is the initial state of a piece of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants