Search code examples
connectionmodelingagentanylogic

Anylogic. Modelling proccess lib. Connections between stock elements (like Source or Queue) with custom classes


I have some troubles with finding a way to connect a Queue's exit with the enter point of the Sink, which is INSIDE my own custom agent.

I'm trying to make a model of a database system, so i have a couple of Sources (which are making queries as agents), Queues as connections between Nodes, and Nodes as agents with Sink and Source inside. Every node sinks the received query, and reacts on it by sending queries to the specified nodes.

So, as you can see, i am trying to connect different layers of model: Source is take place on the top layer of the model, Sink - inside of instance of my own custom agent.

It is something like this:

main layer of model

this is my custom agent called "Node"

I haven't found anything here, so decided to ask.


Solution

  • To send entities from one agent's process chart to another agent's process chart, use the "Exit" and "Enter" blocks from the process library.

    1. Place the "Exit" block after your queue.
    2. Place the "Enter" block into your agent before the sink
    3. In the "Exit" block's "on exit" code, write code to send the entity to the correct "Enter" block, for example myAgents.get(6).enter.take(agent) . Each "Enter" block has the method take() which will accept an agent to enter it.

    This is the standard way to send agents from one process chart to another.

    hope this helps