Dependent Parallel states in Qt Statemachine
-
Hi,
I would like to design a dependent parallel states using qt statemachine.
I was try to understand the mechanism used in http://www.archivum.info/qt-interest@trolltech.com/2010-05/00713/Re-(Qt-interest)-Resolving-nearly-orthogonal-paralle-states.htmlI have a similar situation. I didnot understand how the author was able to determine the state in which the statemachine was. Unlike in the heirarchial statemachine where you know precisely in which state you are, how is it determined using the parallel states.
Case I am trying to solve at the moment is
I have two switches A, B like explained above in the link however the difference is B is dependent on A. And A and B are listening to signals which could change the state in which they are. Is there a possibility to use heirarchial parallel states. I tried modelling but could not understand the behaviour of it.The situation is i want the statemachine to be responsive without the need to add transitions to every possible state from each state.
Please advise.
-Srikanth
-
If B is dependent on A, they are not parallel. Simple as that.
-
Hi Andre,
Thanks for the quick answer. If A is not dependent on B, they are parallel and four possible state combinations assuming each state has two stages. How to determine in which state or comibination of states the state machine is in, like explained in here http://www.archivum.info/qt-interest@trolltech.com/2010-05/00713/Re-(Qt-interest)-Resolving-nearly-orthogonal-paralle-states.html
-Srikanth
-
No, if you need that information, that is, if the combination of the values of A and B results in differences to what you need to do, that what next state you can move, you do not encode the states of A and B in separate states, but instead make four states that indeed encode their combination: ab, aB, Ab, and AB (where an uppercase is ON and a lowercase OFF), and you end up with possible transitions between all of them.
At least, that is my understanding of state machines.
-
Hi Andre,
Thanks for answer. That increases the number states but it answers my dilemma.
-Srikanth
-
Funny thing is, that in the 2x2 case (two options that each can have only two values) it actually decreases the number of possible states (as also explained in the link you posted).
-
Hi Andre,
One more question from the link, the author was talking about the extended state data, how it could help in solving the exponential increasing states. Could you help me understanding it. I meant the below conversation"
Second, regarding guarded transitions:If you need to scale, i.e., m and/or n can get big, guarded
transitions (by which
I mean transitions that depend on "extended state data" -- data other than
the
formal states of the state machine) are the way to go. But in this
case, I would
not make the items that have settings (m) and their possible settings (n)
actual
formal states of the state machine -- I would make it all "extended state
data."
(If scaling is important to you, we could discuss this approach in more
detail.)" -
Actually I was looking at possible structure as mentioned here "Parallel structure":http://easycsm.sourceforge.net/SM_5.png .