Package xdevs.core.simulation.profile
Class CoordinatorProfile
- java.lang.Object
-
- xdevs.core.simulation.AbstractSimulator
-
- xdevs.core.simulation.Coordinator
-
- xdevs.core.simulation.profile.CoordinatorProfile
-
public class CoordinatorProfile extends Coordinator
Coordinator to perform a profiling of the simulation. This class implements a coordinator to perform a profiling of the simulation.
-
-
Field Summary
Fields Modifier and Type Field Description protected double
executionTime
protected long
numCallsToClear
protected long
numCallsToDeltFcn
protected long
numCallsToExit
protected long
numCallsToGetClock
protected long
numCallsToGetSimulators
protected long
numCallsToGetTL
protected long
numCallsToGetTN
protected long
numCallsToInitialize
protected long
numCallsToLambda
protected long
numCallsToPropagateInput
protected long
numCallsToPropagateOutput
protected long
numCallsToSetTL
protected long
numCallsToSetTN
protected long
numCallsToTa
protected long
timeUsedByClear
protected long
timeUsedByDeltFcn
protected long
timeUsedByExit
protected long
timeUsedByGetClock
protected long
timeUsedByGetSimulators
protected long
timeUsedByGetTL
protected long
timeUsedByGetTN
protected long
timeUsedByInitialize
protected long
timeUsedByLambda
protected long
timeUsedByPropagateInput
protected long
timeUsedByPropagateOutput
protected long
timeUsedBySetTL
protected long
timeUsedBySetTN
protected long
timeUsedByTa
-
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 CoordinatorProfile(Coupled model)
Constructor for the profile coordinator.CoordinatorProfile(SimulationClock clock, Coupled model)
Constructor for the profile coordinator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildHierarchy()
Builds the hierarchy of simulators for the model.void
clear()
Empties the event list at the ports of the associated 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
exit()
This is a special function, out of the DEVS formalism, that allows to realize some actions when the simulation ends.SimulationClock
getClock()
Gets the simulation clock of the simulator.Collection<AbstractSimulator>
getSimulators()
Returns the simulators of the components of the model.double
getTL()
double
getTN()
Gets the time of the next event.void
initialize()
Initializes the simulator and the associated model.void
lambda()
Executes the output function of the DEVS simulation.static void
main(String[] args)
void
propagateInput()
Propagates the input of the model.void
propagateOutput()
Propagates the output of the model.void
setTL(double tL)
Sets the time of the last event.void
setTN(double tN)
Sets the time of the next event.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.double
ta()
Executes the time advance mechanism of the DEVS simulation.String
toString()
-
-
-
Field Detail
-
numCallsToInitialize
protected long numCallsToInitialize
-
timeUsedByInitialize
protected long timeUsedByInitialize
-
numCallsToExit
protected long numCallsToExit
-
timeUsedByExit
protected long timeUsedByExit
-
numCallsToTa
protected long numCallsToTa
-
timeUsedByTa
protected long timeUsedByTa
-
numCallsToDeltFcn
protected long numCallsToDeltFcn
-
timeUsedByDeltFcn
protected long timeUsedByDeltFcn
-
numCallsToLambda
protected long numCallsToLambda
-
timeUsedByLambda
protected long timeUsedByLambda
-
numCallsToClear
protected long numCallsToClear
-
timeUsedByClear
protected long timeUsedByClear
-
numCallsToGetTN
protected long numCallsToGetTN
-
timeUsedByGetTN
protected long timeUsedByGetTN
-
numCallsToGetTL
protected long numCallsToGetTL
-
timeUsedByGetTL
protected long timeUsedByGetTL
-
numCallsToSetTN
protected long numCallsToSetTN
-
timeUsedBySetTN
protected long timeUsedBySetTN
-
numCallsToSetTL
protected long numCallsToSetTL
-
timeUsedBySetTL
protected long timeUsedBySetTL
-
numCallsToGetClock
protected long numCallsToGetClock
-
timeUsedByGetClock
protected long timeUsedByGetClock
-
numCallsToGetSimulators
protected long numCallsToGetSimulators
-
timeUsedByGetSimulators
protected long timeUsedByGetSimulators
-
numCallsToPropagateOutput
protected long numCallsToPropagateOutput
-
timeUsedByPropagateOutput
protected long timeUsedByPropagateOutput
-
numCallsToPropagateInput
protected long numCallsToPropagateInput
-
timeUsedByPropagateInput
protected long timeUsedByPropagateInput
-
executionTime
protected double executionTime
-
-
Constructor Detail
-
CoordinatorProfile
public CoordinatorProfile(SimulationClock clock, Coupled model)
Constructor for the profile coordinator.- Parameters:
clock
- Simulation clockmodel
- Coupled model
-
CoordinatorProfile
public CoordinatorProfile(Coupled model)
Constructor for the profile coordinator.- Parameters:
model
- Coupled model
-
-
Method Detail
-
buildHierarchy
protected void buildHierarchy()
Description copied from class:Coordinator
Builds the hierarchy of simulators for the model.- Overrides:
buildHierarchy
in classCoordinator
-
initialize
public void initialize()
Description copied from class:AbstractSimulator
Initializes the simulator and the associated model. This is not part of the DEVS formalism, but it is a necessary step to prepare the simulator for the simulation.- Overrides:
initialize
in classCoordinator
-
exit
public void exit()
Description copied from class:AbstractSimulator
This is a special function, out of the DEVS formalism, that allows to realize some actions when the simulation ends.- Overrides:
exit
in classCoordinator
-
ta
public double ta()
Description copied from class:AbstractSimulator
Executes the time advance mechanism of the DEVS simulation.- Overrides:
ta
in classCoordinator
- Returns:
- the new DEVS sigma.
-
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
-
clear
public void clear()
Description copied from class:AbstractSimulator
Empties the event list at the ports of the associated model.- Overrides:
clear
in classCoordinator
-
getTL
public double getTL()
- Overrides:
getTL
in classAbstractSimulator
-
setTL
public void setTL(double tL)
Description copied from class:AbstractSimulator
Sets the time of the last event.- Overrides:
setTL
in classAbstractSimulator
- Parameters:
tL
- the time of the last event.
-
getTN
public double getTN()
Description copied from class:AbstractSimulator
Gets the time of the next event.- Overrides:
getTN
in classAbstractSimulator
- Returns:
- the time of the next event.
-
setTN
public void setTN(double tN)
Description copied from class:AbstractSimulator
Sets the time of the next event.- Overrides:
setTN
in classAbstractSimulator
- Parameters:
tN
- the time of the next event.
-
getClock
public SimulationClock getClock()
Description copied from class:AbstractSimulator
Gets the simulation clock of the simulator.- Overrides:
getClock
in classAbstractSimulator
- Returns:
- the simulation clock of the simulator.
-
getSimulators
public Collection<AbstractSimulator> getSimulators()
Description copied from class:Coordinator
Returns the simulators of the components of the model.- Overrides:
getSimulators
in classCoordinator
- Returns:
- the simulators of the components of the model.
-
propagateOutput
public void propagateOutput()
Description copied from class:Coordinator
Propagates the output of the model. This method is called after the lambda function of the simulators, and it propagates the output of the models to the input of the components connected to the previuous output ports.- Overrides:
propagateOutput
in classCoordinator
-
propagateInput
public void propagateInput()
Description copied from class:Coordinator
Propagates the input of the model. This method is called before the delta function of the simulators, and it propagates the input of the models to the input of the components connected to the previuous input ports.- Overrides:
propagateInput
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)
-
-