Author Topic: Specific Format of State Machine Diagram  (Read 11695 times)

saniea

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Specific Format of State Machine Diagram
« on: July 22, 2021, 08:17:07 pm »
Hi everyone,

I am relatively new to both UML and EA. I am attempting to model a state machine for our system. Every state in our system has multiple actions in the entry/do/exit actions. Somewhat like the image attached to the post, taken from https://sparxsystems.com/resources/gallery/diagrams/software/sw-state_machine-pedestrian_crossing.html



The problem I'm facing is that I cannot figure out how to add multiple actions in the entry/do/exit actions. I understand I might have to do something like marking "effect is behaviour" but I don't really get how to do that. I also couldn't find any tutorials or guides as to how I can achieve this.

Any help will be appreciated. Thank yoouuu!

Saniea  :) :)

Rethinking

  • EA Novice
  • *
  • Posts: 12
  • Karma: +1/-0
  • Curious about stuff ... including how to use EA
    • View Profile
    • Rethinking Transport
Re: Specific Format of State Machine Diagram
« Reply #1 on: July 28, 2021, 11:18:20 pm »
Hi Saniea,


Not sure if you've had any replies to your post. I'm relatively new to EA too, but am playing with simulations based on State Machines. I think we might have quite similar requirements.


To add multiple actions as an Effect, simply type something like: sim.var1.foo; sim.var1.bar; as Javascript into the Effect box on the Transitions. You can press Enter to get a new line. You don't need to click on "Effect is a Behaviour" - this is if you want to re-use some behaviours from your model itself and then you can link off to a behaviour that you've already modelled.


There are good resources on the Sparx website, such as:


https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_simulation/dynamic_simulation_with_javasc.html
Scott has done a number of videos such as: https://www.youtube.com/watch?v=0SFuzrVvL_A This one is quite a short, basic one. About three minutes in, it gets to an example of how to use State Models within simulations.


Hope this helps ...


Best Regards,


Rethinking Transport
« Last Edit: July 29, 2021, 08:27:47 am by Rethinking »
Rethinking Transport
- A Transport consultancy with a difference

saniea

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Specific Format of State Machine Diagram
« Reply #2 on: August 02, 2021, 07:06:27 pm »
Hey Rethinking,

Thank you for your reply! I had made no progress since my post despite looking around for possible solutions.

I'll try out what you suggested but I don't really want to do any simulations and essentially just want a State Machine diagram. Is it possible to write plain statements in the Effect box on the Transitions? (essentially where you suggested I write something like sim.var1.foo; sim.var1.bar;, can I write simple words? Would that produce the same outcome?

I'm going to watch the video you recommended and try this out anyway. Thanks once again. I hope this works!

Best,

Saniea

Rethinking

  • EA Novice
  • *
  • Posts: 12
  • Karma: +1/-0
  • Curious about stuff ... including how to use EA
    • View Profile
    • Rethinking Transport
Re: Specific Format of State Machine Diagram
« Reply #3 on: August 06, 2021, 04:09:27 am »
Saniea,


How are you getting on with EA and your State Models ?

I think I understand what you're trying to do better now - you're just using EA to draw your state model diagram, right ? In which case, I think I see the problem - as far as I can see, there appears to be a limit of three actions on a state diagram. So, I think you have two choices as illustrated by this diagram:https://pasteboard.co/KevQarG.png.


Hope that helps.


Rethinking Transport
Rethinking Transport
- A Transport consultancy with a difference

PeterHeintz

  • EA User
  • **
  • Posts: 894
  • Karma: +55/-18
    • View Profile
Re: Specific Format of State Machine Diagram
« Reply #4 on: August 06, 2021, 05:35:32 pm »
Hi,
I am not 100% sure, but I belief in UML there is only one entry-, do-, and exit- operation, but you can have many actions in those operations.

Those actions you can either put as text in the "Behavior" box or you can press the "Element" button to e.g. select an Activitie describing which actions will do what how.
To get some information visible in your SM diagram you have to check "Show Behaviour in Diagram".
I typicaliy always point to activities and to allow easy navigation to the activitiy diagram, I point to that diagram via the "select Composit Diagram" feature on the state.

Best regards,

Peter Heintz

saniea

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Specific Format of State Machine Diagram
« Reply #5 on: August 06, 2021, 10:59:46 pm »
Hi again,

Peter is right - though only one entry/do/exit operation are allowed, several actions can be carried out in each operation.

So I mostly figured out how to get what I want. The steps I took were:
 - Select the state you want to add the operations to
 - Go the "Features & Properties" window
 - In "Features & Properties" select the "Behavior" tab
 - In the "Behavior" tab, select the operation you want to add, e.g. entry and write in essentially a title in the "Name/Comment" section of the entry behavior
 - Then go the "Behavior Properties" window and under the "Behavior" tab, in the "Behavior" textbox, enter all the numerous actions you want to execute in the entry operation
 - Check "Show Behavior in Diagram" box, hit save and voila, all the actions will show up in the entry operation, exactly like in the picture I posted in my question. :)

The only issue now is that the entry/do/exit operations are not showing up in the correct order in the states, so I will be trying to figure that out next. If anyone has any clues about that, please let me know.

I hope this answer is useful to someone else as well! Thank you guys for your help!

Rethinking

  • EA Novice
  • *
  • Posts: 12
  • Karma: +1/-0
  • Curious about stuff ... including how to use EA
    • View Profile
    • Rethinking Transport
Re: Specific Format of State Machine Diagram
« Reply #6 on: August 09, 2021, 02:51:08 am »
Saniea,

I followed your instructions and it works well. Glad that you worked it out !!!

Rethinking
Rethinking Transport
- A Transport consultancy with a difference

mirca

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Specific Format of State Machine Diagram
« Reply #7 on: August 16, 2021, 09:36:12 pm »
In order to get the most out of your custom software development, you will need to hire a team that has experience in developing custom software https://mlsdev.com. A team that is experienced in this field will have a better understanding of what it takes to build your software and will be able to complete the job in a timely manner. For this reason, smaller companies often hire a part-time in-house developer or take on the services of a smaller firm that specializes in custom software development. However, if you have a large business that is growing, you will likely have to hire a larger team of developers to meet your goals. Regardless of the size of your company, a dedicated team that is experienced in custom software development will be invaluable.
« Last Edit: August 17, 2021, 05:55:58 pm by mirca »