0
votes

How can I repeat a statechart under a certain condition? I don't want to make a transition back to the first state.

For example Agent A has a statechart. And Agent B also has a statechart. The last states in Agent A are contained at the beginning of the statechart in Agent B. And Agent B lists other states after that. In a state in Agent A, a code creates Agent B. Until a certain condition is met.

If I make a transition in agent B (if necessary with a message) from the last state back to the first one, new agents are created and all states are run through again and again. Now I want the statechart in agent b to be repeated. Does anyone have an idea?

(By the way, I have made a transition back to a state in agent A, but this is desired).

I am glad about every help. :)

New more details***** Agent A is a machine. The corresponding statechart describes what is currently happening in the machine, e.g. filling, pressing, ejecting. In the state e.g. "pressing" the agent B is created. It is a product. The product should leave the machine. For this reason, like agent A, it also has the state "Press" and the state "Eject". The "Eject" state in Agent B is divided into further levels of detail.

The product is created in the state "Press". Therefore, the first state in Agent B begins with "pressed". Common states run simultaneously. The difference is the "ejection" of the machine e.g. describes the movement of the machine parts. While "ejecting" in the product describes e.g. the movement of the product in the machine, i.e. "upward movement" etc. The reason why make state occurs twice is that I want to describe the agents as detailed as possible.

Agent A: When "Eject" is finished, a transition goes back to fill the state, because the machine continues to work until a certain condition is fulfilled. For example until there is no more raw material.

Agent B: After "ejection", the product is still being processed, e.g. it is collected in a container and is examined after a period of time, etc. After the last state, only a "final state" occurs. Reason: The product does not go through the same steps again and again, but a new product is created again and again.

When I run the simulation, the machine runs through the steps again and again. This is desired. But my product only passes its statechart once and remains in its final state. But this is wrong. For example, if I want to count the products that have fallen in the container, only a 1 is shown in the collection. But there should be many.

I hope you can open the photo enter image description here

1
what does it even mean to repeat a statechart?Felipe

1 Answers

0
votes

You cannot "repeat" a statechart. You have to work with transitions going back to the initial state. However, this is not a bug/limitation but a feature.

The last states in Agent A are contained at the beginning of the statechart in Agent B.

This does not sound like a good design.

You will have to rethink your statechart design. Very likely, there is a simple fix but your description is very unclear. Maybe clarify it and add some clear screenshots as well. Also check https://stackoverflow.com/help/how-to-ask