Interface Agent

All Superinterfaces:
ModelEntity
All Known Subinterfaces:
Visitor
All Known Implementing Classes:
BasicAgent, Cell, DynamicElevator, DynamicVisitor, InstrumentationDecorator, RoutingAgent, SimpleAgent, StaticElevator, StaticVisitor

public interface Agent extends ModelEntity
Agents are the acting entities of the simulation model.

Agents should implement a strategy within their doEvent method and provide the scheduler with the time of next event (tone). Data should be stored separately within the agent's state. Agents are always embedded within a Domain for compartmentalization of the model.

  • Method Details

    • getState

      <S extends State> S getState()
      Returns the agent's state containing all internal variables
      Returns:
      the agent's internal state
    • getTimeOfNextEvent

      Time getTimeOfNextEvent()
      Returns the time of the next event (tone).

      This method is called by the simulator to update the global event queue.

      Returns:
      time of the next event
    • doEvent

      Time doEvent(Time time)
      Calculates new outputs from the available inputs and implements the agent's strategy.

      This method is called by the simulator every time this agent is scheduled as an event in the global event queue. Outputs are basically massages that have to be put onto the outport of this agent. It should implement the general strategy of the agent and will acquire the actual simulation time from the simulator.

      This method is supposed to do the following steps:

      • read the messages from the inports
      • modify the agent's state
      • compute output and write messages to other entities to the outports
      • add events to the internal event queue if necessary
      • return the time of the next local event (=next time to call this method)
      If implemented, the agent may also refer read-only to a bulletin board implementation of its parent domain or the root domain for additional external parameters.

      Do not invoke from outside the simulation loop!

      Parameters:
      time - current simulation time
      Returns:
      tone - time of next event
    • log

      default void log(PrintStream stream, Time time, String msg)
      Provides simple logging functionality to a stream with time stamp, entity name and message output.

      Can be used to redirect output to a log file. May be overloaded by a more sophisticated implementation.

      Parameters:
      stream - stream to be used as output
      time - current time stamp
      msg - message to print
    • log

      default void log(PrintStream stream, String msg)
      Provides simple logging functionality to a stream - only message output.

      Can be used to redirect output to a log file. May be overloaded by a more sophisticated implementation.

      Parameters:
      stream - stream to be used as output
      msg - message to print
    • log

      default void log(Time time, String msg)
      Provides simple logging functionality to System.out with time stamp, entity name and message output.

      Can be used to redirect output to a log file. May be overloaded by a more sophisticated implementation.

      Parameters:
      time - current time stamp
      msg - message to print
    • log

      default void log(String msg)
      Provides simple logging functionality to System.out - only message output.

      Can be used to redirect output to a log file. May be overloaded by a more sophisticated implementation.

      Parameters:
      msg - message to print