stateumlfsmstatechart

Hierarchical State Machine (HSM) Current State


I am researching HSM and I have a question about.

In HSM (for all system), is there only one current state? For example; In my project, there is two user type : normal user and technician user. There is no identicality between them. Normal user can login to system any time and logout. And technician same. Also, technician user can login to system when normal user logined. Also, technician user can login to system when normal user have already logined. But normal user does not do it.

Yes... I think that there is two current state : current state 1 = nomral user logined or quited. current state 2 = technician user logined or quited. Am I rigt?

I am a bit of confused about them. How can we show this states on HSM diagram as only one current state?


Solution

  • is there only one current state

    In a general way it is possible to have several current states in a state machine instantiation thank to the fork from where output vertices are in orthogonal regions of a composite state.

    For instance if the states indicate if there is or not at least one normal user logged and there is or not at least one technician logged :

    enter image description here

    where the two entry state behaviors setting the counters to 0 are not necessary. If there is at most one normal user and one technician the associated counters and the internal transitions disappear.

    The current states can be :


    But your statement is not clear at all :

    I think that there is two current state : current state 1 = nomral user logined or quited. current state 2 = technician user logined or quited. Am I rigt?

    your states seems the same as me except there is one and only one normal user and one and only one technician, but this machine is compatible with normal user can login to system any time and logout. And technician same and then probably contradictory with the obscure but normal user does not do it. The fact there is a dependency between the logged normal user(s) and technician(s) implies there is only one current state


    Edit after your remark

    The statement is :

    1. there is one normal user and one technician
    2. the technician can login and logout at any time
    3. the normal user cannot login nor logout when the technician is logged

    A normal way to do that is the machine :

    enter image description here

    where there is only one current state at a time.

    Of course you can also cheat to have a machine having two current states at a time :

    enter image description here

    but as you can see the fact the technician is logged is managed both by states and a variable, that has no sense and makes that machine artificially complicated for nothing.