Package org.simplesim.examples
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-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.model.Agent
Agent.UnknownEventType
Nested classes/interfaces inherited from interface org.simplesim.model.ModelEntity
ModelEntity.PortConnectionException, ModelEntity.PortOperationException, ModelEntity.UniqueConstraintViolationException
-
Field Summary
Fields inherited from interface org.simplesim.model.ModelEntity
ROOT_LEVEL
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.simplesim.model.BasicAgent
getState, getTimeOfNextEvent, isSimulationRunning, pollModelChangeRequest, toggleSimulationIsRunning
Methods inherited from class org.simplesim.model.BasicModelEntity
addToDomain, equals, getAddress, getFullName, getInport, getLevel, getName, getOutport, getParent, removeFromDomain, toString
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.simplesim.model.ModelEntity
addToDomain, getAddress, getFullName, getInport, getLevel, getName, getOutport, getParent, removeFromDomain
-
Constructor Details
-
SimpleAgent
public SimpleAgent()
-
-
Method Details
-
doEvent
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)
Do not invoke from outside the simulation loop!
- Parameters:
time
- current simulation time- Returns:
- tone - time of next event
-