DUECA/DUSIME
|
Generic HDF5 file format logging. More...
#include <HDF5Logger.hxx>
Public Member Functions | |
HDF5Logger (Entity *e, const char *part, const PrioritySpec &ts) | |
Constructor. | |
bool | complete () |
Continued construction. | |
~HDF5Logger () | |
Destructor. | |
![]() | |
virtual | ~Module () |
Destructor. | |
virtual bool | isInitialPrepared () |
To check whether the module is prepared to be prepared. | |
ObjectType | getObjectType () const |
The object type within DUECA. | |
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. | |
![]() | |
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. | |
Static Public Member Functions | |
static const ParameterTable * | getMyParameterTable () |
Return the parameter table. | |
Static Public Attributes | |
static const char *const | classname |
Name of the module. | |
Friends | |
class | EntryWatcher |
Additional Inherited Members | |
![]() | |
SimulationModule (Entity *e, const char *m_class, const char *part, const IncoTable *table=NULL, int state_size=0) | |
Constructor. | |
virtual | ~SimulationModule () |
Destructor. | |
SimulationState::Type | getAndCheckState (const TimeSpec &ts, bool confirm_transition=true) |
Returns the state of the simulation at this time. | |
void | transitionComplete () |
If a transition was not (implicitly) confirmed in the getAndCheckState call (second argument false), confirm with this call that it is now complete. | |
SimulationState::Type | getCurrentState () |
If you "forgot" what the state from a previous getAndCheckState() call was, you can remember it here. | |
![]() | |
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. | |
![]() | |
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. | |
NamedObject (const NameSet &ns) | |
Normal constructor, protected, because it has no use to create a NamedObject by itself. | |
virtual | ~NamedObject () |
Destructor. | |
![]() | |
SnapshotState | snap_state |
State of the snapshot taking. | |
![]() | |
ModuleState | state |
Flag to remember whether we are stopped due to some error with hardware device manipulation. | |
Generic HDF5 file format logging.
This provide a configurable interface to logging with HDF5 format.
HDF5 is hierarchical, you can specify where in the hierarchy the data from a channel (or all entries in a channel) need to be logged. The logger will for single values (floats, doubles, etc.) log hdf5 arrays in /your-path-in-hierarchy/data/variablename. Fixed size (dueca::fixvector) values will be logged in a 2d array.
DUECA timing (tick) will belogged under /your-path-in-hierarchy/tick
There is a warning, however. Not all data type logging is equally easy with hdf5, it works well for fixed-size stuff, but for variable-length arrays, strings, etc., and high data rates, hfd5 logging is computationally intensive.
If you find that the hdf5 logging is taking up too much time, which may manifest itself by complaints about activities not running on time (ActivityManager qsize) and data build-up in the channels (entry # has ..... data points), consider ddff logging, which is ridiculously efficient for real-time logging. Afterwards you can convert the ddff log to a hdf5 file, and use that in your data processing.
The instructions to create an module of this class from the Scheme script are:
dueca.Module('hdf5-logger', <part name; string>, <PrioritySpec>).param( set_timing = <TimeSpec>, # Supply a time specification to define the update rate of the main activity check_timing = <array of integers>, # Supply three integer parameters to specify a check on the timing of # the main activity: warning limit (in us), critical limit (in us), and # the number of loops to test before sending a report (optional, dflt=2000) log_entry = <array of strings>, # log a specific channel entry; enter channel name, dataclass type, if # applicable entry label and as last the path where the data should be # stored in the file. Without label, only the first entry is logged, # with, only the first entry matching the label watch_channel = <array of strings>, # log all entries in a specific channel; enter channel name and path # where entries should be stored filename_template = <string>, # Template for file name; check boost time_facet for format strings # Default name: datalog-%Y%m%d_%H%M%S.hdf5 log_always = <boolean>, # For watched channels or channel entries created with log_always, # logging also is done in HoldCurrent mode. Default off, toggles # this capability for logging defined hereafter. immediate_start = <boolean>, # Immediately start the logging module, do not wait for DUECA control # chunksize = <uint32_t>, # Size of logging chunks (no of data points) for the log file, # in effect for all following entries. compress = <boolean>, # Log compressed data sets; reduces file size and may increase # computation time. In effect for all following entries reduction = <TimeSpec>, # Reduce the logging data rate according to the given time # specification. Applies to all following logged values config_channel = <string>, # Specify a channel with configuration events, to control logging # check DUECALogConfig doc for options ) '''Description: Generic logging facilities for channel data to HDF5 data files. The logger may be controlled with DUECALogConfig events, but may also be run without control. Note that hdf5 may sometimes take unpredictable time (when it needs to flush data to disk). DUECA has no problem with that, but you are advised to configure a separate priority for the hdf5 modules.'''
dueca::hdf5log::HDF5Logger::HDF5Logger | ( | Entity * | e, |
const char * | part, | ||
const PrioritySpec & | ts ) |
Constructor.
Is normally called from scheme/the creation script.
|
virtual |
Continued construction.
This is called after all script parameters have been read and filled in, according to the parameter table. Your running environment, e.g. for OpenGL drawing, is also prepared. Any lengty initialisations (like reading the 4 GB of wind tables) should be done here. Return false if something in the parameters is wrong (by the way, it would help if you printed what!) May be deleted.
Reimplemented from dueca::Module.