Logging and Configuration in PowerDEVS

Summary of updates:

  • The code generation (the one that created model.h) was updated so that the Simulator::father member variables get sets BEFORE calling init.
    This is needed in other to traverse the model hierarchy in its initialization (for example to read configuration parameters using the full hierarcy name).
  • A new ConfiguraitonLogger class was created. It read configuration for the logLevel and logger each variable uses. Verbose defaults are used in case nothing is explicitly set in configuration.
  • A new SamplerLogger class was created. It samples a variable logging max,min, count, timeAvg, sum every samplingPeriod (read from config)
  • Variables are now logger with "." separator instead of the previous "_". This allows for longer names, as Scilab treats the "." as structure separator.

Important breaking changes

When using the defaults, the ConfigurationLogger is used. Before it used the ScilabLogger. Some differences between these loggers:

  1. If using the defaults (not setting configuration values), the ConfigurationLogger creates a ScilabLogger for each variable. This means that instead of having one t variable for each model, now there will be a t variable for each variable. EJ: before you had server.t, server.count, server.bits. Now you have server.count, server.count.t, server.bits, server.bits.t.

  2. Because of the change in separator (from "_" to "."), in R when reading files with H5, the "." separator is treated as a structure, which in H5 parlance is a "/" separator. You can use H5ls() to list variables stored in a file.

ConfigurationLogger

A new ConfiguraitonLogger class was created, implementing the IPowerDEVSLogger interface. It creates the configured logger for each variable.

logLevel configuration

At the InitSignals method, it removes variables which are configured not to be logged. For this it reads the logLevel for each variable using the readLogLevel method global method. This method looks in the configuration in different scopes:

  1. First, it trys with full name: EJ: coupled.atomic.variable.logLevel=1
  2. If it fails, it uses the scope search for without variable name. EJ: coupled.atomic.logLevel --> atomic.logLevel --> logLevel
  3. If there is no configuration of the variable, it is by default logged

Logger type configuration

For all the variables which are configured to be logged, it searches which logger is to be used. By default all the values and times of the variable are logged. Other Logger types are the SamplerLogger and the HistogramLogger (not yet implemented).
All logger types use the main backend Logger set in configuration (either Scilab or OpenTSDB). This is set with the variable_logging_backend option.

Some samplers require extra parameters to be configured. For example, the if the SamplerLogger is configured it will attempt to read the sample_period from configuration.

Example configuration

logLevel= LOG_LEVEL_NONE; // set global logging level to NONE, so that no models are logging
FelixServer1.logLevel = LOG_LEVEL_ALL; // set the FelixServer1 model to log all its variables
FelixServer1.count.logLevel = LOG_LEVEL_NONE; // Except for the FelixServer1.count variable
FelixServer1.intergen.logger = LOGGER_SAMPLER; // for the FelixServer1.intergen variable, use a sampler logger
FelixServer1.intergen.sample_period = 10; // sampling period for the FelixServer1.intergen sampler
Coupled0.FelixServer2.sent_bits.logLevel = LOG_LEVEL_PRIORITY; // FelixServer2 atomic model, which is inside the Coupled0 coupled model will log only the priority and important variables
Coupled0.FelixServer2.sent_bits.logger = LOGGER_SAMPLER; // for its sent_bits variable it will use a samplerLogger
Coupled0.FelixServer2.sent_bits.sample_period = 1; // sampling every 1s

SamplerLogger

-- MatiasAlejandroBonaventura - 2016-06-17

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2016-06-17 - MatiasAlejandroBonaventura
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback