Modelling Hierarchical State Machine [HSM] Transitions to Parent

I apologize for the many threads and questions. Just been playing around a lot in the tool and trying to break my Cameo/SysML assumptions.

Follow up 3rd question here: As part of the above, I am modelling a hierarchical state machine (HSM).

Example, I have on overarching mode called “Base” that is entered upon initialization of some software actor. Within “Base” are three child modes: “Inactive”, “Normal”, “Secondary”, “Faulted”, etc. When Base is entered, the initial child state is “Inactive”. I have had no issue with modelling this.

However, here is where I am running into issues. While in inactive, there is one trigger to leave, which is a mode transition command from an external actor. This command contains an enum with multiple options, some of which are valid or invalid depending on the state.

I have modeled the transition as being triggered on the command message (data exchange item) into a choice block. The choice them splits to the other modes using the same trigger, but with guards depending on “Enum == X” that applies to the specific transition (Ex: if enum == NORMAL, then transition to Normal). However, there are invalid values of the enum that if will result in transitioning back to the “Base” state (Ex: else enum == X is invalid, transition to Base). However the MSM does not let me create a link from “Inactive” to “Base”. How do I model this?

It seems a bit odd that I can model a transition from Inactive to Inactive (ex: if enum == Inactive, transition back to Inactive), but I can’t transition to the parent mode at all.

Sorry I cannot help on this one as I am less familiar with the Modes and States modeling part of Capella.

In my experience states/modes in Capella work the same as they do for SysML and the transition rules are the same. Consequently, what I believe you’re trying to do would not work in SysML either. You are essentially trying to perform an external transition without exiting the current state, i.e. the Inactive state. This means you would need to terminate the entire region of the Base state.

I’m confused as to why you want to transition back to the Base state at all, as this would simply imply the Inactive state anyway as this is the default state for the Base region.

I suspect you should either use two regions within the Base state. Or, more likely, the Inactive state really belongs outside of the Base hierarchy.

I agree that the Inactive state really belongs outside the Base hierarchy, unfortunately, I am trying to model a system that is already implemented (because of course it is) and the HSM implementation uses QM to model states and everything is nested within a single mode called “Base”.

All I am really trying to do is show a transition from a child state to a parent state and it does not look like you can draw a transition line from a state contained within the region of another state (ie: childe state) back to the state that it is contained within (ie: parent state).

The reason for this could be that there is additional handle (entry actions) that may be done at the parent state that makes a direct child-to-child interaction not desirable.

Currently my work around is to have a choice or join element outside of all mode to show a transition back to the parent, but this is really clunky. I’d rather just be able to transition from a child back to a parent.

Is it convoluted and messy? Yes. Is it allowed (and often used) in the QM implementation? Also, Yes.

Screenshot of example showing the work-around as well as not being allowed to transition from a child to a parent:

I see your problem. I’m not familiar with QM but I believe it allows you to create UML state machines. Given that most of the SysML rules for state machines are encoded in the UML spec. I would have thought a QM model should be (mostly) compliant with SysML as well.

If I understand the intent, the Base re-entry transition from any of the child states is done to execute the entry behaviour of the Base state. However, this would not work without terminating the Base state. This is because during an internal state transition neither the exit or entry behaviour of that state is executed.

What you’re proposing above, i.e. using a join pseudo state is not valid though. The rules state that the transitions to a join vertex must have originated in different orthogonal regions. Which isn’t what you’ve modelled.

I’m sure there is a solution to this, but it’s not immediately obvious to me.