Package xdevs.core.simulation.parallel
Class CoordinatorParallel
- java.lang.Object
-
- xdevs.core.simulation.AbstractSimulator
-
- xdevs.core.simulation.Coordinator
-
- xdevs.core.simulation.parallel.CoordinatorParallel
-
- Direct Known Subclasses:
RTCentralCoordinator
public class CoordinatorParallel extends Coordinator
Parallel coordinator This class implements a parallel coordinator for DEVS models.
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedList<TaskDeltFcn>
deltfcnTasks
protected ExecutorService
executor
protected LinkedList<TaskLambda>
lambdaTasks
protected int
numberOfThreads
-
Fields inherited from class xdevs.core.simulation.Coordinator
model, simulators
-
Fields inherited from class xdevs.core.simulation.AbstractSimulator
clock, tL, tN
-
-
Constructor Summary
Constructors Constructor Description CoordinatorParallel(Coupled model)
Constructor for the parallel coordinator.CoordinatorParallel(Coupled model, int numberOfThreads)
Constructor for the parallel coordinator.CoordinatorParallel(SimulationClock clock, Coupled model)
Constructor for the parallel coordinator.CoordinatorParallel(SimulationClock clock, Coupled model, int numberOfThreads)
Constructor for the parallel coordinator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildHierarchy()
Builds the hierarchy of simulators for the model.void
deltfcn()
Executes one of the transition functions of the DEVS simulation, depending on the current state of the model and whether there are new events or not.void
lambda()
Executes the output function of the DEVS simulation.static void
main(String[] args)
void
simulate(double timeInterval)
This function is used to simulate the model for a given time interval.void
simulate(long numIterations)
This function is used to simulate the model for a given number of iterations.-
Methods inherited from class xdevs.core.simulation.Coordinator
clear, exit, getModel, getSimulators, initialize, propagateInput, propagateOutput, simInject, simInject, simInject, simInject, ta
-
-
-
-
Field Detail
-
numberOfThreads
protected int numberOfThreads
-
lambdaTasks
protected LinkedList<TaskLambda> lambdaTasks
-
deltfcnTasks
protected LinkedList<TaskDeltFcn> deltfcnTasks
-
executor
protected ExecutorService executor
-
-
Constructor Detail
-
CoordinatorParallel
public CoordinatorParallel(SimulationClock clock, Coupled model, int numberOfThreads)
Constructor for the parallel coordinator.- Parameters:
clock
- Simulation clockmodel
- Coupled modelnumberOfThreads
- Number of threads
-
CoordinatorParallel
public CoordinatorParallel(Coupled model, int numberOfThreads)
Constructor for the parallel coordinator.- Parameters:
model
- Coupled modelnumberOfThreads
- Number of threads
-
CoordinatorParallel
public CoordinatorParallel(Coupled model)
Constructor for the parallel coordinator. It uses the number of available processors.- Parameters:
model
- Coupled model
-
CoordinatorParallel
public CoordinatorParallel(SimulationClock clock, Coupled model)
Constructor for the parallel coordinator. It uses the number of available processors.- Parameters:
clock
- Simulation clockmodel
- Coupled model
-
-
Method Detail
-
buildHierarchy
public void buildHierarchy()
Description copied from class:Coordinator
Builds the hierarchy of simulators for the model.- Overrides:
buildHierarchy
in classCoordinator
-
lambda
public void lambda()
Description copied from class:AbstractSimulator
Executes the output function of the DEVS simulation.- Overrides:
lambda
in classCoordinator
-
deltfcn
public void deltfcn()
Description copied from class:AbstractSimulator
Executes one of the transition functions of the DEVS simulation, depending on the current state of the model and whether there are new events or not.- Overrides:
deltfcn
in classCoordinator
-
simulate
public void simulate(long numIterations)
Description copied from class:Coordinator
This function is used to simulate the model for a given number of iterations.- Overrides:
simulate
in classCoordinator
- Parameters:
numIterations
- the number of iterations to simulate.
-
simulate
public void simulate(double timeInterval)
Description copied from class:Coordinator
This function is used to simulate the model for a given time interval.- Overrides:
simulate
in classCoordinator
- Parameters:
timeInterval
- the time interval to simulate.
-
main
public static void main(String[] args)
-
-