Class DynamicElevator
java.lang.Object
org.simplesim.model.BasicModelEntity
org.simplesim.model.BasicAgent<S,E>
org.simplesim.model.RoutingAgent<ElevatorState,Elevator.Event>
org.simplesim.examples.elevator.dyn.DynamicElevator
- All Implemented Interfaces:
Elevator
,Agent
,ModelEntity
public final class DynamicElevator
extends RoutingAgent<ElevatorState,Elevator.Event>
implements Elevator
Part of the dynamic elevator example
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.model.Agent
Agent.UnknownEventType
Nested classes/interfaces inherited from interface org.simplesim.examples.elevator.shared.Elevator
Elevator.Event
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
-
Method Summary
Modifier and TypeMethodDescriptionCalculates new outputs from the available inputs and implements the agent's strategy.void
enqueueEvent
(Elevator.Event event, Time time) getName()
Returns the name of this model entityvoid
void
sendMessage
(Agent recipient, Request content) 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, 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, getOutport, getParent, removeFromDomain
-
Constructor Details
-
DynamicElevator
public DynamicElevator()
-
-
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!
-
processMessages
public void processMessages()- Specified by:
processMessages
in interfaceElevator
-
getName
Description copied from interface:ModelEntity
Returns the name of this model entityReturns an empty string as default, may be overridden in derived classes.
- Specified by:
getName
in interfaceModelEntity
- Overrides:
getName
in classBasicModelEntity
- Returns:
- the name of this model entity, may be an empty string but not null
-