DUECA/DUSIME
|
A class "in-between" the dueca Module class, and Simulation/HardwareModule. More...
#include <DusimeModule.hxx>
Snapshot | |
Snapshot capabilities implementation | |
SnapshotState | snap_state |
State of the snapshot taking. | |
Trim | |
Trim condition calculation capabilities | |
class | SimulationModule |
Write access token for sending the trim capabilities specification. | |
class | HardwareModule |
Write access token for sending the trim capabilities specification. | |
DusimeModule (Entity *e, const char *m_class, const char *part, const IncoTable *inco_table, int state_size) | |
Constructor. | |
virtual | ~DusimeModule () |
Destructor. | |
bool | snapshotNow () |
Returns true if a snapshot has to be taken in this cycle. | |
virtual void | fillSnapshot (const TimeSpec &ts, Snapshot &snap, bool from_trim) |
If snapshots are generated, this has to be implemented by a descendant. | |
virtual void | loadSnapshot (const TimeSpec &ts, const Snapshot &snap) |
For restoring the state from an old snapshot. | |
void | trimCalculationCondition (TriggerPuller &cond) |
This can be used to specify the condition under which the trim calculation may take place, for example, data has to be received on trim calculation input channels. | |
virtual void | trimCalculation (const TimeSpec &ts, const TrimMode &mode) |
This must be overridden if the module takes part in trim condition calculations. | |
Additional Inherited Members | |
Public Member Functions inherited from dueca::Module | |
virtual | ~Module () |
Destructor. | |
virtual bool | complete () |
Inform the module that all parameters have now been passed. | |
virtual bool | isPrepared ()=0 |
To check whether the module is ready for work. | |
virtual bool | isInitialPrepared () |
To check whether the module is prepared to be prepared. | |
ObjectType | getObjectType () const |
The object type within DUECA. | |
virtual void | startModule (const TimeSpec &time)=0 |
Start the module's activity (activities) | |
virtual void | stopModule (const TimeSpec &time)=0 |
Stop the module's activity (activities) | |
virtual void | initialStartModule (const TimeSpec &time) |
Initial start opportunity. | |
virtual void | finalStopModule (const TimeSpec &time) |
Final stop command. | |
const Entity * | getMyEntity () |
Return a pointer to the entity to which this module belongs. | |
const ModuleState & | getState () |
Return the module state. | |
Public Member Functions inherited from dueca::NamedObject | |
const std::string | getEntity () const |
Returns the "entity" part of the name. | |
const std::string | getClass () const |
Returns the "class" part of the name. | |
const std::string | getPart () const |
Returns the sub-entity or "part" part of the name. | |
const NameSet & | getNameSet () const |
This returns the complete name set. | |
const GlobalId & | getId () const |
This returns the id. | |
Protected Member Functions inherited from dueca::Module | |
Module (const Entity *e, const char *m_class, const char *part) | |
Constructor. | |
virtual void | setSafetyStop () |
Put a brake on this module's activities. | |
Protected Member Functions inherited from dueca::NamedObject | |
NamedObject (const GlobalId &id) | |
Reserve for AssociateObject. | |
NamedObject (const NameSet &ns) | |
Normal constructor, protected, because it has no use to create a NamedObject by itself. | |
virtual | ~NamedObject () |
Destructor. | |
Protected Attributes inherited from dueca::Module | |
ModuleState | state |
Flag to remember whether we are stopped due to some error with hardware device manipulation. | |
A class "in-between" the dueca Module class, and Simulation/HardwareModule.
There are many common tasks in the SimulationModule and HardwareModule classes. These common tasks, basic to the DUSimE capabilities are implemented in the DusimeModule class.
Application developers should derive their modules from either a SimulationModule, for modules that implement a piece of simulation model, without doing IO, and from HardwareModule, for modules that may (but preferrably do not) implement a piece of simulation, and do IO and control of hardware.
So: do not derive from DusimeModule directly.
|
protected |
Constructor.
e | Pointer to my entity |
m_class | String with name of the module class |
part | String with part name |
inco_table | Pointer to the table with initial condition calculation definitions. If this class does not take part in calculation of initial conditions (other than possibly sendin on data), this pointer may be NULL. |
state_size | Size of the state, as sent in a snapshot. |
|
protected |
Returns true if a snapshot has to be taken in this cycle.
If this returns true, you should keep a copy of the state, at a location of your discretion. This copy will later be sent with the sendSnapshot call.
|
protectedvirtual |
If snapshots are generated, this has to be implemented by a descendant.
It should return a Snapshot event. It is advised to use an AmorphStore object to pack the state data into the event. If the inco flag is used, the initial condition state, instead of the normal model state, should be sent. If you need to make preparations for a following snapshot you should also do that here.
ts | For your reference, the time specification of the snapshot command |
snap | The Snapshot that has to be filled. |
from_trim | If true, indicates that the snapshot has to be filled from the trim calculation, instead of from the normal calculation. |
|
protectedvirtual |
For restoring the state from an old snapshot.
This should take the snapshot data, unpack it (so keep aligned with the sendSnapshot routine), and use this to replace the current state. Note that the model will not be running at this time, so – if you don't touch your state in HoldCurrent, as you should not – this can run in parallel to the simulation without locking.
|
friend |
Write access token for sending the trim capabilities specification.
Writes IncoSpec
|
friend |
Write access token for sending the trim capabilities specification.
Writes IncoSpec