public class Coordinator extends AtomicSimulator implements ICoordinator
Modifier and Type | Class and Description |
---|---|
static class |
Coordinator.CoordinatorFactory
The factory of the Coordinator class.
|
AtomicSimulator.AtomicSimulatorFactory
Simulator.SimulatorFactory
Modifier and Type | Field and Description |
---|---|
protected static Factory<IAtomicSimulator> |
_coordinatorFactory
The factory for coordinators associated with this instance.
|
protected static Factory<IAtomicSimulator> |
_simulatorFactory
The factory for simulators associated with this instance.
|
protected MultiMap<Map.Entry<INamed,Port>,Map.Entry<INamed,Port>> |
extCoupInfo
The links from outside of this coordinator to itself.
|
protected Map<INamed,IAtomicSimulator> |
internalModelTosim
The internal model, that is to say the
|
_coordinators, _couplingInfo, _IMM_COMPUTE_O, _IMM_DELTFUNC, _inputMessage, _modelsToSimulate, _outputMessage, _parent, _rootParent, _scheduler, _simulators
Modifier | Constructor and Description |
---|---|
protected |
Coordinator(ICoupledDevs coupledModel,
ICoordinator parent)
Smaller constructor
|
protected |
Coordinator(ICoupledDevs coupledModel,
ICoordinator parent,
IScheduler si)
Biggest constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addCoordinator(ICoupledDevs d)
Add a coordinator to the given coupled model.
|
void |
addExtPair(Map.Entry<INamed,Port> cs,
Map.Entry<INamed,Port> cd)
Add an external pairing, that is to say a pairing from an external
model and its Port to this model and a given Port.
|
protected void |
addSimulator(IAtomicDevs d)
Create a simulator and assign it to the atomic model given in
parameter.
|
protected void |
buildImminents(Double t)
Get all imminent transitions from the scheduler.
|
void |
computeOutput(Double time)
Compute model's output message depending on it's state at a given date.
|
MultiMap<INamed,IContent> |
convertInput(Message x)
Converts an input to a map of model names to contents.
|
Set<ICoordinator> |
coordinators()
The set of coordinators in use in this simulation and under the level
of this coordinator.
|
Set<ICoordinator> |
getAllCoordinators()
A getter to the coordinators under this coordinator.
|
Set<IAtomicSimulator> |
getAllSimulators()
Returns all the simulators in use under this coordinator.
|
protected void |
informCoupling()
Creates the coupling information.
|
void |
initialize()
Initialize all subcomponents then itself, at time 0.0.
|
void |
initialize(Double currentTime)
Initialize this coordinator at a given time.
|
Map<INamed,IAtomicSimulator> |
internalModelToSim()
A getter to a dictionary to link the atomic models under the coupled
model associated with this coordinator, and their simulator.
|
ICoupledDevs |
model()
Getter on the simulated model.
|
Double |
nextTN()
Return the simulator real next event occurrence date. considering all
internal model in case of coupled model.
|
protected void |
prepareNextTurn()
Clears the sets of imminent transitions ans advance the time of this
coordinator.
|
void |
routeInMessages()
Route the messages coming from the outside of this model into this
model.
|
protected void |
routeMessages()
Sequentially routes the output messages out of this coordinator, then
the input messages inside of this model.
|
protected void |
setSimulators()
Every model under the coupled model managed by this coordinator is
assigned a Simulator or a Coordinator (depending on the class of the
model).
|
void |
simInject(Double e,
Message m)
Injects a message to this Coordinator.
|
void |
simulate(Integer itNb)
Run the simulation up to a specified iteration count.
|
protected void |
simulatorCreated(IAtomicSimulator s,
IDevs d)
When a simulator or a coordinator has been created by this coordinator,
adds it to the memory linked with their assigned model.
|
Set<IAtomicSimulator> |
simulators()
The set of all the simulators in use in this simulation and under the
level of this coordinator.
|
void |
tellAllRouteInMessages()
This method is only called by the root coordinator.
|
protected void |
tellAllRouteOutMessages()
This method is only called by the root coordinator.
|
protected void |
tellAllSimsSetModToSim(HashMap<INamed,IAtomicSimulator> inFunc)
Assigns models to simulators
|
protected void |
wrapDeltFunc(Double time)
A wrapper for calling all the transition functions of all transitioning
models.
|
addImmDelt, addInInputMessage, addInOutputMessage, addPair, convertMsg, deltFunc, deltFunc, inputMessage, outputMessage, parent, rootParent, routeOutMessages, scheduler, setModelsToSimulate, setParent, setRootParent, timeAdvance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addImmDelt, addInInputMessage, addInOutputMessage, addPair, convertMsg, inputMessage, outputMessage, parent, rootParent, routeOutMessages, scheduler, setModelsToSimulate, setParent, setRootParent
deltFunc, deltFunc, timeAdvance, tL, tN
compareTo
protected Map<INamed,IAtomicSimulator> internalModelTosim
protected MultiMap<Map.Entry<INamed,Port>,Map.Entry<INamed,Port>> extCoupInfo
protected static Factory<IAtomicSimulator> _simulatorFactory
protected static Factory<IAtomicSimulator> _coordinatorFactory
protected Coordinator(ICoupledDevs coupledModel, ICoordinator parent, IScheduler si)
coupledModel
- the modelparent
- the parentsi
- the schedulerprotected Coordinator(ICoupledDevs coupledModel, ICoordinator parent)
coupledModel
- the modelparent
- the parentpublic Map<INamed,IAtomicSimulator> internalModelToSim()
internalModelToSim
in interface ICoordinator
protected void setSimulators()
protected void tellAllSimsSetModToSim(HashMap<INamed,IAtomicSimulator> inFunc)
inFunc
- the dictionnary linking models to simulators.public void addCoordinator(ICoupledDevs d)
addCoordinator
in interface ICoordinator
d
- the coupled model.protected void simulatorCreated(IAtomicSimulator s, IDevs d)
s
- the created simulator.d
- the assigned model.public ICoupledDevs model()
model
in interface ISimulator
model
in class Simulator
public void addExtPair(Map.Entry<INamed,Port> cs, Map.Entry<INamed,Port> cd)
addExtPair
in interface ICoordinator
cs
- the source of the pairing.cd
- the destination of the pairing.protected void informCoupling()
public MultiMap<INamed,IContent> convertInput(Message x)
convertInput
in interface ICoordinator
x
- an input message.public void routeInMessages()
routeInMessages
in interface ICoordinator
public Set<ICoordinator> getAllCoordinators()
getAllCoordinators
in interface ICoordinator
protected void addSimulator(IAtomicDevs d)
d
- the atomic model that needs a simulator companion.public void simulate(Integer itNb)
simulate
in interface ISimulator
simulate
in class Simulator
itNb
- The maximum iteration count.protected void prepareNextTurn()
public Double nextTN()
nextTN
in interface IAtomicSimulator
nextTN
in class AtomicSimulator
protected void buildImminents(Double t)
t
- the time of the imminent event.public void computeOutput(Double time)
computeOutput
in interface IAtomicSimulator
computeOutput
in class AtomicSimulator
time
- The date to which compute output message.public void simInject(Double e, Message m)
simInject
in interface ISimulator
simInject
in class Simulator
e
- the time, since the last event, elapsed to this message.m
- the message to be injected.protected void routeMessages()
public Set<IAtomicSimulator> simulators()
simulators
in interface ICoordinator
public Set<ICoordinator> coordinators()
coordinators
in interface ICoordinator
protected void tellAllRouteOutMessages()
public void tellAllRouteInMessages()
tellAllRouteInMessages
in interface ICoordinator
protected void wrapDeltFunc(Double time)
time
- the time of the event.public void initialize()
initialize
in interface ISimulator
initialize
in class Simulator
public void initialize(Double currentTime)
initialize
in interface ISimulator
initialize
in class Simulator
currentTime
- the time of initialization.public Set<IAtomicSimulator> getAllSimulators()
getAllSimulators
in interface ICoordinator
Copyright © 2017–2019 UniversitĂ© CĂ´te d'Azur, CNRS, I3S. All rights reserved.