Package xdevs.core.simulation
Class Controller
- java.lang.Object
-
- java.lang.Thread
-
- xdevs.core.simulation.Controller
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected Coordinator
coordinator
The coordinator of the simulation.protected double
tF
The final time of the simulation.-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description Controller(Coordinator coordinator)
Creates a new controller with the given coordinator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimulationClock
getSimulationClock()
Returns the simulation clock.void
pauseSimulation()
Pauses the simulationvoid
resumeSimulation()
Resumes the simulationvoid
run()
void
runSimulation()
Runs the simulation during a given time intervalvoid
simInject(double e, Port<Object> port, Object value)
Injects a single value into the port "port", calling the transition function.void
simInject(double e, Port<Object> port, Collection<Object> values)
Injects a value into the port "port", calling the transition function.void
simInject(Port<Object> port, Object value)
Injects a single value into the port "port", calling the transition function.void
simInject(Port<Object> port, Collection<Object> values)
Injects a value into the port "port", calling the transition function.void
startSimulation(double timeInterval)
Starts the simulation, initializing the coordinatorvoid
stepSimulation()
Performs a single step in the simulation loopvoid
terminateSimulation()
Finishes the current simulation-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
coordinator
protected Coordinator coordinator
The coordinator of the simulation.
-
tF
protected double tF
The final time of the simulation.
-
-
Constructor Detail
-
Controller
public Controller(Coordinator coordinator)
Creates a new controller with the given coordinator.- Parameters:
coordinator
- the coordinator of the simulation.
-
-
Method Detail
-
startSimulation
public void startSimulation(double timeInterval)
Starts the simulation, initializing the coordinator- Parameters:
timeInterval
- Simulation time interval, in seconds
-
runSimulation
public void runSimulation()
Runs the simulation during a given time interval
-
pauseSimulation
public void pauseSimulation()
Pauses the simulation
-
resumeSimulation
public void resumeSimulation()
Resumes the simulation
-
stepSimulation
public void stepSimulation()
Performs a single step in the simulation loop
-
terminateSimulation
public void terminateSimulation()
Finishes the current simulation
-
simInject
public void simInject(double e, Port<Object> port, Collection<Object> values)
Injects a value into the port "port", calling the transition function.- Parameters:
e
- Elapsed timeport
- Input portvalues
- Set of values
-
simInject
public void simInject(Port<Object> port, Collection<Object> values)
Injects a value into the port "port", calling the transition function.- Parameters:
port
- Input portvalues
- Set of values
-
simInject
public void simInject(double e, Port<Object> port, Object value)
Injects a single value into the port "port", calling the transition function.- Parameters:
e
- Elapsed timeport
- Input portvalue
- value to inject
-
simInject
public void simInject(Port<Object> port, Object value)
Injects a single value into the port "port", calling the transition function.- Parameters:
port
- Input portvalue
- value to inject
-
getSimulationClock
public SimulationClock getSimulationClock()
Returns the simulation clock.- Returns:
- the simulation clock
-
-