Book a Demo

Author Topic: Executable StateMachine Artifact How to connect interacting statemachines right?  (Read 4627 times)

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Hi,

my goal is to understand how to create executable state machines which are interacting with each other.
There is an example in the EAExample.eap which i try to understand.

Its called "Interactive Simulation with Deferred Event".

So my Issue is now, that I created an "executable statemachine artifact" have draged down there the two propertys client and server. Then I have drawn a connector between these two propertys.

The expexted result from generating the SimulationManager.js of the example is the following:

function SimulationManager()
{
   this.base = new ContextManager(this, "SimulationManager");
   this.m_pCommand = "";
   this.m_commands = [];
   this.activeStates = [];
   this.activeStateCount=0;
   this.client = new TestClient(this, "client");
   this.base.lstContext.push(this.client.base);
   this.server = new TransactionServer(this, "server");
   this.base.lstContext.push(this.server.base);
   //setup instance associations
this.client.server = this.server;

};

but this.client.server = this.server; is missing in my SimulationManager.js

So I think, I need to change the connector behaviour or something like this. But I dont find a difference between my connector and the example connector.
Does anyone know how exactly this code is generated?
What action do I need to do while modeling?
« Last Edit: July 27, 2018, 03:18:31 pm by NikoWenz »

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
I found a solution  :)

I just draw the Connector in the diagram, but the association needs to have a specific direction.

This can be modelled by clicking on the Connector, then pressing "Ctrl+L" and choose the direction in the window which is showing up.

Then the code is showing up:

this.Client.server = this.Server;

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Ctrl-L on a connector? How does that work? Do you have some shortcut configured?

q.

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
This shortcut works on Connectors between Properties inside Executable Statemachine Artifacts

This is the standard:

"Once a connector exists between two properties, you can map it back to the
Association it represents in the Class model. To do this, select the connector and
use the keyboard shortcut Ctrl+L. The 'Choose an Association' dialog displays, which allows the generated StateMachine to send signals to the instance filling the
role specified in the relationship during execution."

This is copied from(Page 6):
https://www.sparxsystems.com/resources/user-guides/14.0/simulation/executable-state-machines.pdf

And this works fine for me =)

Greetings,

Niko
« Last Edit: August 03, 2018, 06:13:43 pm by NikoWenz »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Hmm. Doesn't work for me. Well, I was just curious. Probably another dark edge in EA.

q.

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Hmm. Doesn't work for me. Well, I was just curious. Probably another dark edge in EA.

q.

I think the soultion is you need to have an Association between the two Blocks in the Statemachine and an Connector in the Exectuable Statemachine Artifact.
Only then the Shortcut "Ctrl+L" is working.

And here is my next Question:

How to use this communication between actors and blocks?
The Problem I see is that I cant draw an Association between actors and blocks and this is required I think.
Is the only way to create a Block instead of an Actor element?

Greetings,

Niko