|
| DusimeModule (Entity *e, const char *m_class, const char *part, const IncoTable *inco_table, int state_size) |
| Constructor. More...
|
|
virtual | ~DusimeModule () |
| Destructor. More...
|
|
bool | snapshotNow () |
| Returns true if a snapshot has to be taken in this cycle. More...
|
|
virtual void | fillSnapshot (const TimeSpec &ts, Snapshot &snap, bool from_trim) |
| If snapshots are generated, this has to be implemented by a descendant. More...
|
|
virtual void | loadSnapshot (const TimeSpec &ts, const Snapshot &snap) |
| For restoring the state from an old snapshot. More...
|
|
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. More...
|
|
virtual void | trimCalculation (const TimeSpec &ts, const TrimMode &mode) |
| This must be overridden if the module takes part in trim condition calculations. More...
|
|
| Module (const Entity *e, const char *m_class, const char *part) |
| Constructor.
|
|
virtual void | setSafetyStop () |
| Put a brake on this module's activities.
|
|
| NamedObject (const GlobalId &id) |
| Reserve for AssociateObject. More...
|
|
| NamedObject (const NameSet &ns) |
| Normal constructor, protected, because it has no use to create a NamedObject by itself.
|
|
virtual | ~NamedObject () |
| Destructor.
|
|
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.
virtual void dueca::DusimeModule::fillSnapshot |
( |
const TimeSpec & |
ts, |
|
|
Snapshot & |
snap, |
|
|
bool |
from_trim |
|
) |
| |
|
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.
- Parameters
-
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. |
virtual void dueca::DusimeModule::loadSnapshot |
( |
const TimeSpec & |
ts, |
|
|
const Snapshot & |
snap |
|
) |
| |
|
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.