anylogic

How to send a message between agents (to a specific state chart transition) while the agents are in the same class in Anylogic


I have four agents in the main of an Anylogic's model, as seen in the photo, in each agent I have a state chart, and in one of the transitions I want to send a message to another agent (neighbor agent not parent), in the same class as they are both in the main, meaning that I want to send a message from a transition in the compressor agent to the transport agent saying "system failure" and then from the transport agent back to the compressor agent.

enter image description here enter image description here

I tried the following trials:

  1. I first used the usual command "send ("System Failure", transport);", and it gave an error that the "transport" can't be resolved to a variable.
  2. I used one of the commands I found here "sendToAllConnected(transport);", and still the error persists.
  3. I tried the "Link Between Agents" and it kept the same error.
  4. I looked it up on YouTube and I found nothing new.
  5. I tried the "sendToAllConnected("SystemFailure" - it did not give any error in the "Problem View" but it gave an error in the Console view
  6. I tried "send("SystemFailure", main.transport(i).transition1" - I don't know if that code right I took it from the Anylogic help but it was for a parameter, not a state chart.
  7. I can't put them as "parent/child" agents as I need them connected to the main as they are directly affecting a system dynamic model in the main agent and it can't work when there is an agent in between.

Solution

  • Your question is ambiguous, some suggestions: