Class SimpleAgent

java.lang.Object
org.simplesim.model.BasicModelEntity
org.simplesim.model.BasicAgent<S,E>
org.simplesim.model.RoutingAgent<org.simplesim.examples.SimpleAgent.SimpleAgentState,org.simplesim.examples.SimpleAgent.Event>
org.simplesim.examples.SimpleAgent
All Implemented Interfaces:
Agent, ModelEntity

public class SimpleAgent extends RoutingAgent<org.simplesim.examples.SimpleAgent.SimpleAgentState,org.simplesim.examples.SimpleAgent.Event>
Simple implementation of a RoutingAgent as template for own implementations
  • Constructor Details

    • SimpleAgent

      public SimpleAgent()
  • Method Details

    • doEvent

      public Time doEvent(Time time)
      Description copied from interface: Agent
      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