Skip to main content



      Home
Home » Modeling » Papyrus » Finite State Machine - The sequel(Stiil trying to get an FSM simulating on screen .....)
Finite State Machine - The sequel [message #1870854] Tue, 10 September 2024 06:30 Go to next message
Eclipse UserFriend
Hello All,

Over the last few years I repeatedly made an effort to try and make a simple FSM work using the Moka simulation. I didn't succeed, and since we use software like Matlab StateFlow/Simulink and Itemis Create at the office I gave up on Papyrus.
But ..... purely out of interest for the hobby (bare metal programming) I thought it would be a great idea tot try the latest release (Papyrus 6.7.0 / 2024-06 (4.32))
After having solved the Moka installation by using a nightly build (found on this forum) I could create a Class 'owning' my state diagram. But now I'm confronted with the same frustration as every time in the past years :

Why can't I find documentation about things like Guards, Triggers, Entry/Exit etcetera. And when I want to run a simulation with delay's on transitions, how the heck am I going to create a Call/Signal event? Do I really have to create code that 'externally' keeps track of time and signals the FSM?

It would be great if you could give me some info, perhaps even a simple project with a 'lamp on / lamp off' based on a delay timer? I would be so gratefull ;-)

Regards,

Peter
Re: Finite State Machine - The sequel [message #1870998 is a reply to message #1870854] Thu, 12 September 2024 11:45 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Moka is base on norms : fUML [1], PSSM [2] and PSCS [3] which are specialization of UML [4]. There is no documentation about how to create a UML model but these spec can help.

Unfortunately, timeEvent are exclude from fUML (see 7.9.1 in the norm) so as far as I know it should not be possible to use timeEvent in Moka simulation.

I make a simple example using callEvent in attachment.

HTH,
Pauline

1] https://www.omg.org/spec/FUML/1.5/PDF
2] https://www.omg.org/spec/PSSM/1.0/PDF
3] https://www.omg.org/spec/PSCS/1.2/PDF
4] https://www.omg.org/spec/UML/2.5.1/PDF
Re: Finite State Machine - The sequel [message #1871013 is a reply to message #1870998] Thu, 12 September 2024 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Hello Pauline,

Thanks for the explanation. I've tried to simulate the statemachine in your example, but with no luck.
For starters I'm not familiar enough with UML to really understand the entire construcion with a system and the lamp class. But as I already found out its a Class for which the statemachine should be its classifier behaviour.
I read the fUML paragraph that describes the exclusion of a timeEvent (or the entire timing as a matter of fact), so I understand the construction of a trigger like 'after 5' or 'at 5' won't work. Since my job and hobby mainly concern embedded systems I would like to simulate the statemachine with an animated diagram reacting to simulated triggers. But now I'm still wondering, even after seeing your example how I can throw the events causing the triggers to occur.
And even more, when the statemachine would have to respond to a simple switch (manually actuated in the real world), how should I do this in Papyrus.
The programs like Matlab Stateflow/Simulink or Itemis Create allow for simple manual triggers by clicking a tickbox for instance.

So, perhaps for starters : How can I make the statemachine under simulation halt in the Off state, and let the trigger to On occur at my command?

I also added 2 attachments, because 'out of the box' your example yields several errors when trying to validate/simulate.

Looking forward to your response :-)

Peter

[Updated on: Thu, 12 September 2024 14:15] by Moderator

Re: Finite State Machine - The sequel [message #1871292 is a reply to message #1871013] Thu, 19 September 2024 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Hello Peter,

Can you give me why you cannot run the Factory I give you ? Do you have any error ? (can you open the error log view please)

For some explanation :
1. the Factory initialise the model
2. the Lamp class has a classifier behavior as a state machine which react on call of turnOn and turnOff operation
3. the activity in System call the operations turnOn and turnOff to change the state of the Lamp state machine

Using moka you cannot interact with the simulation at runtime so you will not be able to turn the lamp on manually. When we talk about events, it is event trigger by the model (as event send by the CallOperationAction and received by the transition in the state machine in the example I provided).

HTH,
Pauline

Re: Finite State Machine - The sequel [message #1871526 is a reply to message #1871292] Fri, 27 September 2024 12:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi Pauline,

Sorry for the delay, I've been rather busy lately. About the Papyrus model you made for me : I had previously installed a fresh new (latest) Papyrus and added Moka using the nightly build you mentioned in another post on this forum. Then I opened your LampOnOff. Next I tried to use the run configuration Lamp On Off. This lead me to my previous post.

So now, after you asked me why I cannot run the Factory I did the following :
1) I started Papyrus, the project Lamp On Off was already open. It produced a whole list of errors at startup. My environment is not oké? (see ide_open.png)
2) Then I tried the run configuration. This complained about the model (see model_behaviour.png)
3) When disabling model verification at startup the run configuration failed another way it seemed (see execution.png)

Perhaps I'm doing something wrong, but a new Papyrus install, Moka install en loading of your example should yield a properly functioning FSM I think?

Regards,
Peter
Re: Finite State Machine - The sequel [message #1871784 is a reply to message #1871526] Thu, 10 October 2024 08:48 Go to previous message
Eclipse UserFriend
Hello,

I may be do an error in the model. I upload a new version.

Validation errors are not worrying in this case. I add one or two comments in the model. If you wan tot understand it you should look mainly at : main activity and LampStateMachine.

Hope it will works better.
Pauline
Previous Topic:create diagrams as PNG files from notation file
Next Topic:EclipseCon 2023
Goto Forum:
  


Current Time: Fri Jul 11 08:57:04 EDT 2025

Powered by FUDForum. Page generated in 0.04450 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top