Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: yck on May 02, 2013, 07:01:14 am
-
Is bidirectional communication between statemachines in simulation possible?
I have tried to establish such a communication but i could not succeed.
Example: I have a Statemachine(x) and i call an another statemachine(y) in a state(x.a) of statemachine(x).Statemachine(y) execute sand sends a signal(BroadcastSignal in state y.a) to statemachine(x) and the transition in statemachine(x.a to x.b) is triggered with this signal. Now Statemachine(y) is in state(y.a)and waiting for a signal to go to state(y.b). Statemachine(x in x.b) boradcasts a signal that should have been received by statemachine(y) but it does not.So the signal is lost and the statemachin(x) terminates.
So from this example i get the result that just a caller can receive a signal from called behaviour. But the called behaviour can not receive a signal from its caller.
Is there any possibility to establish such a connection? Can signals be send via classifiers with defined targets? Because both SendSignal action in activity diagrams and BroadcastSignal do not specifiy any special target behaviour that should receive the signal.
Any answer would be really helpful since Enterprise Architect is one of the software that i evaluate the simulation capabilities in terms of my university thesis.
thanks in advance, Kesen
Statemachine1
(http://i42.tinypic.com/28sm2kg.jpg)
Statemachine2
(http://i42.tinypic.com/4rcpw9.jpg)
-
Given the complexity of the text presented it might help to add an image of the proposed diagram. There is a lot more chance you will get feedback from that.
Also I suggest you check the options covered in the EAExamle model under:
Project Models.Model Simulation.Activity Models.Sending Signal.Sending Signals.Sending Signals
-
Thanks for the answer. I have already checked the example but its a very simple example since the signals will be sent in the same diagram.
so i upload 2 pictures describing the situation.
Actually the only question is = Can a state machine(x) send a signal to another statemache(y). If y is started as a behaviour from statemachine(x). Or can just statemachine(y) can send a signal to statemachine(x)?
-
Yes, they can.
The trick is to start the two state machines in the same simulation. The easiest way to do that is to have a launcher state machine that contains a subMachineState for both of the machines you want to communicate.
I have an example I just made (one machine broadcasting a tick, the other a tock and it looping between the two.) If you want to contact Sparx Systems support I can ensure that you get it.
-
hey thanks for the answer.I have written to [email protected].
What do you mean exactly "a substatemachine for both of the machines you want to communicate"? so i should have a state machine(x) that launches this two machines(a,b) and each statemachine(a,b) from a substatemachine in x? Is the order of substatemachines relevant?
So it is not possible in the case that i have described? But only in the case you have described?
Thanks!
-
Two (or more) state machines can communicate, but only if they are both running in the same simulation. In order to do that you need to initially start a setup behavior of some sort. You could do that with an activity that has two CallBehaviorActions or a subMachineState (which just means that the internal behavior of that state is specified by an external state machine)
I'm not sure I understand how that isn't what you want.
-
Two (or more) state machines can communicate, but only if they are both running in the same simulation. In order to do that you need to initially start a setup behavior of some sort. You could do that with an activity that has two CallBehaviorActions or a subMachineState (which just means that the internal behavior of that state is specified by an external state machine)
I'm not sure I understand how that isn't what you want.
thanks, i get what you mean. But that is not what i want :-/
-
So, what is it that you want?
-
So, what is it that you want?
A statemachine(x) calls a statemachine (y). Can the statemachine x send a signal to statemachine y ?
In this case y can send a signal to x. But a signal sent by x can not received by state machine y.
-
There is no distinction between X and Y as which was originally called except when exiting. Yes, you can broadcast messages picked up by the calling state machine.
-
There is no distinction between X and Y as which was originally called except when exiting. Yes, you can broadcast messages picked up by the calling state machine.
Here is again what i mean: a callee sends a signal to to its caller and the caller soes to next state.In same time the calle waits for a signal x. But this signal can not be activated from the caller.
As in the exemple in the first post. State machine 1 can not fire any trigger in statemachine 2. Those activate 1 and activate 2 must be triggered manually although the satet machine 1 broadcasts them. If it is possible and i can not model it, can you maybe show me an example showing the same case?
-
I believe that your problem is using the second state machine as entry behavior of a state. If you used a subMachineState (drag from the project browser while holding control and select instance) I think it would work.
-
I believe that your problem is using the second state machine as entry behavior of a state. If you used a subMachineState (drag from the project browser while holding control and select instance) I think it would work.
Yes i want to simulate it as a entry state behaviour but not as a substatemachine. It is clear for me that it works if i model it as a substatemachine.Since I want to evaluate the simulation semantic/syntax of EA. Such as :in which cases does a simulation work, in which cases can the diagrams can communicate and how. But i think as long as i use it as an entry state behaviour the broadcastsignal command just works in one way.direction callee to caller.
-
As far as I understand it, EA treats an entry or exit behavior as atomic in terms of the calling machine.