group recorder (mysql) - MySQL group_recorder class New in 4.1!
Synopsis
module mysql; object group_recorder { file "legacy-file-name"; table "database-table-name"; group "target-object-name"; property "target-property-name"; mode {"w","w+","a","a+"}; interval sampling-interval; limit max-rows-recorded; column_limit max-columns-per-table; strict boolean; print_units boolean; complex_part complex-parts-reported; data_type MySQL-complex-component-data-type; query_buffer_limit insert-buffer-size; recordid_fieldname record-id-field-name; datetime_fieldname date-field-name; }
Remarks
A group recorder provides the ability to collect a recording of one property from a group of similar objects, e.g., recording voltage from every meter in the system as a time series.
For example, the following lines in a model input file will record the values of the measured_energy variables in the every meter object in a GLM to a table called "meter" at 3600-second intervals for a total of 1000 time-intervals.
object group_recorder { name MeterCorder; group "class=meter"; property measured_real_energy; table "meter"; interval 3600; limit 1000; mode "w"; }
The group_recorder places a timestamp in the second column of every row it emits. This value is formatted as a DATETIME variable in MySQL, and its output formatting depends on the region settings applied to the database.
Properties
parent
- object
- Built-in property that specifies the object that the group_recorder childs to. Does not need to be specified.
property
- string
- Single property from the class to be recorded. Properties with units may be converted to other relevant units. Complex properties may be modified via the complex_parts setting.
table
- string
- The root table name MySQL should use to store output.
file
- string
- Backwards compatibility alias for the table property.
interval
- integer
- The frequency at which the recorder samples the specified properties, in seconds. A frequency of 0 indicates that they should be read & written every iteration (note, that each timestep often requires multiple iterations, so a frequency of zero may lead to multiple measurements in a timestep). A frequency of -1 indicates that they should be read every timestep, but only written if one or more values change. By default this is TS_NEVER.
limit
- integer
- The number of rows to write to the output stream. A non-positive value puts no limit on the file size (use at your own risk). By default, this is 0. The limit is only checked when output non-subsecond value.
group
- string
- Group definition string. Defines which class of device (required) and other information to create a group. See Finding_objects for more details.
strict
- boolean
- Causes the group_recorder to stop the simulation should there be a problem.
print_units
- boolean
- Flag to output units to the index table for each object.
complex_part
- string
- Which part of the complex to record if a complex property is specified. Default "REAL|IMAG". Available settings: "REAL", "IMAG", "MAG", "ANG_DEG", "ANG_RAD". Multiple complex components may be written to individual columns by pipe-concatenating the string. e.g. "MAG|REAL|IMAG"
mode
- string
- Specifies the read mode to use, which may be either "w", "w+", "a", or "a+". If "w" or "w+" is used, the table is purged before data from the current run is added. If "a" or "a+" is used, the data from the current run is appended.
column_limit
- integer
- The number of columns per MySQL table. Default 200.
Warning - Increasing this number may cause MySQL errors.
data_type
- string
- Designates the data format MySQL should use to store variable-precision values. Acceptable types are DECIMAL(M,D), FLOAT(M,D), and DOUBLE(M,D). Default: DOUBLE.
query_buffer_limit
- integer
- Max number of insertions to store in buffer before purging output. Default 200.
recordid_fieldname
- string
- Optional alternative name for the Record ID column.
datetime_fieldname
- string
- Optional alternative name for the Datetime column.
flush_interval
Unused variable for legacy compatibility with Tape group recorder.
format
Unused variable for legacy compatibility with Tape group recorder.
Examples
A group_recorder that will watch the 'A' voltage of all meters and record the magnitude every 60 seconds for 1000 time-intervals.
object group_recorder { group "class=meter"; property voltage_A; interval 60; limit 1000; file "ThatNode_kV.csv"; complex_part MAG; mode "w"; }
A group_recorder that measures real and imaginary power through every transformer in a specific section of the circuit (through groupid) every 5 mins for 1000 time-intervals using custom data storage, and buffer limit.
object group_recorder { group "class=transformer"; property power_out; interval 300; limit 1000; mode "w"; query_buffer_limit 50; print_units TRUE; data_type "FLOAT(4,5)"; table AllTransformers; complex_part REAL|IMAG; }