public class AtomicSimulator extends Simulator implements IAtomicSimulator
An instance of this class (and not of a child of this class) is destined to
manage only atomic models (AtomicDevs
), as for its
mother class Simulator
. This class however acknowledges the existence
of other models (contrary to the mother class).
This kind of simulator should only be used in coordination with a
Coordinator
for managing the coupling and event parts.
Modifier and Type | Class and Description |
---|---|
static class |
AtomicSimulator.AtomicSimulatorFactory
The factory class of the
AtomicSimulator . |
Simulator.SimulatorFactory
Modifier and Type | Field and Description |
---|---|
protected HashSet<ICoordinator> |
_coordinators
The set of sub coordinators of this simulator.
|
protected MultiMap<Map.Entry<INamed,Port>,Map.Entry<INamed,Port>> |
_couplingInfo
Data structure that represents the coupling between internal models.
|
protected static Set<IAtomicSimulator> |
_IMM_COMPUTE_O
The set of models emitting an output at the time of next event.
|
protected static Set<IAtomicSimulator> |
_IMM_DELTFUNC
The set of models making a transition at the time of next event.
|
protected Message |
_inputMessage
Model input message.
|
protected HashMap<INamed,IAtomicSimulator> |
_modelsToSimulate
A collection of simulators associated with their model's name.
|
protected Message |
_outputMessage
Model output message.
|
protected IAtomicSimulator |
_parent
Parent simulator if it exists, that is to say if the current simulator
isn't the top level simulator.
|
protected IAtomicSimulator |
_rootParent
Top level parent simulator if it exists, that is to say if the current
simulator isn't the top level simulator.
|
static IScheduler |
_scheduler
Simulation scheduler, managing the future events.
|
protected HashSet<IAtomicSimulator> |
_simulators
The set of subcomponents of this simulator.
|
Modifier | Constructor and Description |
---|---|
protected |
AtomicSimulator(IDevs model,
IAtomicSimulator parent)
Specific constructor that sets the model to simulate and the parent
simulator.
|
protected |
AtomicSimulator(IDevs model,
IAtomicSimulator parent,
IScheduler scheduler)
Specific constructor that sets the model to simulate, the parent
simulator and the simulation scheduler.
|
Modifier and Type | Method and Description |
---|---|
void |
addImmDelt(IAtomicSimulator atomicSimulator)
Add a simulator to those who may execute a transition function.
|
void |
addInInputMessage(IContent content)
Add a content into input message.
|
void |
addInOutputMessage(IContent content)
Add a content into output message.
|
void |
addPair(Map.Entry<INamed,Port> cSender,
Map.Entry<INamed,Port> cReceiver)
Add a coupling information.
|
void |
computeOutput(Double t)
Compute model's output message depending on it's state at a given date.
|
MultiMap<INamed,IContent> |
convertMsg(Message x)
Convert a message into a MultiMap.
|
void |
deltFunc(Double t)
Wrapper for model transition functions.
|
void |
deltFunc(Double t,
Message x)
Wrapper for model transition functions.
|
Message |
inputMessage()
Getter on model's input Message.
|
Double |
nextTN()
Return the simulator real next event occurrence date. considering all
internal model in case of coupled model.
|
Message |
outputMessage()
Getter on model's output Message.
|
IAtomicSimulator |
parent()
Getter on the parent simulator in case of coupled model.
|
IAtomicSimulator |
rootParent()
Getter on the top level parent simulator.
|
void |
routeOutMessages()
Route messages into the coupled model from internal models output to
their receivers.
|
IScheduler |
scheduler()
Getter on the simulator's Scheduler.
|
void |
setModelsToSimulate(HashMap<INamed,IAtomicSimulator> modelsToSimulate)
Setter on list of models to simulate into this.
|
void |
setParent(IAtomicSimulator p)
Setter on the parent simulator.
|
void |
setRootParent(IAtomicSimulator rp)
Setter on the top level parent simulator.
|
void |
timeAdvance(Double t)
Advance the time of the atomic simulator.
|
compareTo, initialize, initialize, model, name, simInject, simulate, tL, tN
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize, initialize, model, simInject, simulate, tL, tN
compareTo
protected Message _inputMessage
protected Message _outputMessage
protected IAtomicSimulator _parent
protected IAtomicSimulator _rootParent
protected HashMap<INamed,IAtomicSimulator> _modelsToSimulate
protected MultiMap<Map.Entry<INamed,Port>,Map.Entry<INamed,Port>> _couplingInfo
protected HashSet<IAtomicSimulator> _simulators
protected HashSet<ICoordinator> _coordinators
protected static Set<IAtomicSimulator> _IMM_DELTFUNC
protected static Set<IAtomicSimulator> _IMM_COMPUTE_O
public static IScheduler _scheduler
protected AtomicSimulator(IDevs model, IAtomicSimulator parent, IScheduler scheduler)
model
- The model to simulate.parent
- The parent simulator.scheduler
- The new simulation scheduler.protected AtomicSimulator(IDevs model, IAtomicSimulator parent)
model
- The model to simulate.parent
- The parent simulator.public Message outputMessage()
outputMessage
in interface IAtomicSimulator
public Message inputMessage()
inputMessage
in interface IAtomicSimulator
public IAtomicSimulator parent()
parent
in interface IAtomicSimulator
public void setParent(IAtomicSimulator p)
setParent
in interface IAtomicSimulator
p
- The new parent simulator.public IAtomicSimulator rootParent()
rootParent
in interface IAtomicSimulator
public void setRootParent(IAtomicSimulator rp)
setRootParent
in interface IAtomicSimulator
rp
- The new top level root parent.public void setModelsToSimulate(HashMap<INamed,IAtomicSimulator> modelsToSimulate)
setModelsToSimulate
in interface IAtomicSimulator
modelsToSimulate
- Models to simulate.public IScheduler scheduler()
scheduler
in interface IAtomicSimulator
public void addPair(Map.Entry<INamed,Port> cSender, Map.Entry<INamed,Port> cReceiver)
addPair
in interface IAtomicSimulator
cSender
- Pair of strings that represents association between a
model and a port and that sends message to the
receiver.cReceiver
- Pair of strings that represents association between a
model and a port and that receives a message
from the sender.public void computeOutput(Double t)
computeOutput
in interface IAtomicSimulator
t
- The date to which compute output message.public void addInInputMessage(IContent content)
addInInputMessage
in interface IAtomicSimulator
content
- The content to add into input message.public void addInOutputMessage(IContent content)
addInOutputMessage
in interface IAtomicSimulator
content
- The content to add into output message.public void routeOutMessages()
routeOutMessages
in interface IAtomicSimulator
public MultiMap<INamed,IContent> convertMsg(Message x)
convertMsg
in interface IAtomicSimulator
x
- The message to convert.public void addImmDelt(IAtomicSimulator atomicSimulator)
addImmDelt
in interface IAtomicSimulator
atomicSimulator
- The simulator to add.public void deltFunc(Double t, Message x)
deltFunc
in interface ISimulator
deltFunc
in class Simulator
t
- Event happen date.x
- Message to be sent.public void deltFunc(Double t)
deltFunc
in interface ISimulator
deltFunc
in class Simulator
t
- Event happen date.public void timeAdvance(Double t)
timeAdvance
in interface ISimulator
timeAdvance
in class Simulator
t
- the new total simulation time.public Double nextTN()
nextTN
in interface IAtomicSimulator
Copyright © 2017–2019 UniversitĂ© CĂ´te d'Azur, CNRS, I3S. All rights reserved.