State Machine Diagram

I am evaluating VP-UML ver. 6.0 professional and have a few questions.
The reason for my questions is that I am comparing VP-UML with Visual State 5.3 from IAR-Systems.
The questions are all about state machine diagrams.

  1. Is it possible to specify a negative state condition?

  2. When I generate state machine code (which is what I want from VP-UML) I cant see the underlying code. There is practically no code despite the fact that I have several diagrams with several states and many signal triggers. The only code is the “default transition” code. (and of course a lot of class definitions) Why is that?

  3. I would like to know what happens when a trigger of a kind is being trigged. How is the state changed ( in code)?

I hope you can understand my questions!

Thanks in advance!


Hello Maya,

Concerning negative state condition, it looks like it is not defined in the UML specification. I regret that we do not support this currently.

For the questions about generating code for state machine, I believe that you can find the answers by watching the movies available at:

The movies there present how to model the state machine in order to generate code. Feel free to let me know if there are any questions.

Best regards,

Thanks but the tutorial video is too superficial and does not at all give an answer to my question. The video shows how to draw the model and how to generate code, but how do I use the code that has been generated??

The thing is, if I was to implement a state machine on my own I would write a function called ChangeState() that is called when a state has to change. If you have a state A and state B with a transition, A->B called eg “1”, and you are in state A you would have to call some kind of function (with “1” as your input parameter) that will start the transition and change the state from A to B.
I would like to know if there is a function like this, and where in the generated code it is.
All in all my question is how to use this state machine in my application?


Hi Maya,

Yes, the transition methods are generated to the class in class diagram as methods. Calling the method will trigger transition and change state.

Hope this helps.

Best regards,

Hey! thanks for the reply but I still havent got my question answered quite right.

Do you have any examples that contain both the state machine diagram, the generated code and an application that uses the generated code?
I would like to see how it is done. It doesnt need to be something fancy, a “hello world”-like project would be fine.


Hi Maya,

Here is a very simple diagram. You can generate sample code and try with it. To try, just new Door instance, and then call, door.close().

Best regards,