X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.history%2Fsrc-isv%2Fsampleformat.mediawiki;h=359f465ce2e5e2f495e1bf23980457b25469e629;hb=refs%2Fchanges%2F11%2F4411%2F2;hp=6ad2e5ec74a195ee3396a713b64e852ced3f3fff;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.history/src-isv/sampleformat.mediawiki b/bundles/org.simantics.history/src-isv/sampleformat.mediawiki index 6ad2e5ec7..359f465ce 100644 --- a/bundles/org.simantics.history/src-isv/sampleformat.mediawiki +++ b/bundles/org.simantics.history/src-isv/sampleformat.mediawiki @@ -1,76 +1,76 @@ -=Sample Format= -The sample format is a record that contains fields that describe what and how data is stored from source. Its fields are defined by the user, their datatype, and possibly unit type too. -At minimum requirement there must be two fields: "time" and "value". -The data type can be anything numerical; but typically is a double or an integer type. - -If there is the optional field "quality", then it is used for expressing discontinuation regions (value -1). Discontinuation can be passed to the collector with a NaN or null value. - -An example of a simple '''Sample Format''' -{| border="1" cellpadding="3" cellspacing="0" align="center" -|- style="background-color: #f9f9f9;" -|'''Field Name''' ||'''Required'''|| '''Description''' -|- -|time || yes || Time, the time of the 1st sample included into the band. -|- -|value || yes || First value in the band. -|- -|quality || no || 0 = Good, -1 = No value (Byte) -|} - -If collector is given interval or deadband settings, some input samples may need to be dropped. -If the sample format is in ''banded'' mode, then some information about dropped steps are -preserved as count, avg, min, max and median values. -In a banded sample there are (start)time and endTime fields - henge the name value band. - -An example of a '''Banded Sample Format''': -{| border="1" cellpadding="3" cellspacing="0" align="center" -|- style="background-color: #f9f9f9;" -|'''Field Name''' ||'''Required'''|| '''Description''' -|- -|time || yes || Region start time, the time of the 1st sample included into the band. -|- -|endTime || no || Region end time, the time of the last sample included into the band. -|- -| || -|- -|value || yes || First value in the band. -|- -|lastValue || no || Last value in the band. -|- -|avg || no || Average value from all the steps that were included. -|- -|median || no || Median value from all the steps that were included into the band. -|- -|min || no || Lowest value in the band. -|- -|max || no || Highest value in the band. -|- -| || -|- -|quality || no || 0 = Good, -1 = No value (Byte) -|- -|count || no || The number of included samples in the band (Integer) -|} - -To create a sample format, instantiate RecordType and add fields. -
- // Create a sample format ( simple though ) - RecordType sampleFormat = new RecordType(); - sampleFormat.addComponent("time", Datatypes.DOUBLE ); - sampleFormat.addComponent("value", Datatypes.DOUBLE ); - sampleFormat.addComponent("quality", Datatypes.BYTE ); -- -Optionally, get sample format from a user defined class. -
- class Sample { - public double time; - public double value; - } - - // Get sample binding from a class - Binding sampleBinding = Bindings.getBinding( Sample.class ); - // Get sample type from the binding - Datatype sampleFormat = sampleBinding.type(); -- +=Sample Format= +The sample format is a record that contains fields that describe what and how data is stored from source. Its fields are defined by the user, their datatype, and possibly unit type too. +At minimum requirement there must be two fields: "time" and "value". +The data type can be anything numerical; but typically is a double or an integer type. + +If there is the optional field "quality", then it is used for expressing discontinuation regions (value -1). Discontinuation can be passed to the collector with a NaN or null value. + +An example of a simple '''Sample Format''' +{| border="1" cellpadding="3" cellspacing="0" align="center" +|- style="background-color: #f9f9f9;" +|'''Field Name''' ||'''Required'''|| '''Description''' +|- +|time || yes || Time, the time of the 1st sample included into the band. +|- +|value || yes || First value in the band. +|- +|quality || no || 0 = Good, -1 = No value (Byte) +|} + +If collector is given interval or deadband settings, some input samples may need to be dropped. +If the sample format is in ''banded'' mode, then some information about dropped steps are +preserved as count, avg, min, max and median values. +In a banded sample there are (start)time and endTime fields - henge the name value band. + +An example of a '''Banded Sample Format''': +{| border="1" cellpadding="3" cellspacing="0" align="center" +|- style="background-color: #f9f9f9;" +|'''Field Name''' ||'''Required'''|| '''Description''' +|- +|time || yes || Region start time, the time of the 1st sample included into the band. +|- +|endTime || no || Region end time, the time of the last sample included into the band. +|- +| || +|- +|value || yes || First value in the band. +|- +|lastValue || no || Last value in the band. +|- +|avg || no || Average value from all the steps that were included. +|- +|median || no || Median value from all the steps that were included into the band. +|- +|min || no || Lowest value in the band. +|- +|max || no || Highest value in the band. +|- +| || +|- +|quality || no || 0 = Good, -1 = No value (Byte) +|- +|count || no || The number of included samples in the band (Integer) +|} + +To create a sample format, instantiate RecordType and add fields. +
+ // Create a sample format ( simple though ) + RecordType sampleFormat = new RecordType(); + sampleFormat.addComponent("time", Datatypes.DOUBLE ); + sampleFormat.addComponent("value", Datatypes.DOUBLE ); + sampleFormat.addComponent("quality", Datatypes.BYTE ); ++ +Optionally, get sample format from a user defined class. +
+ class Sample { + public double time; + public double value; + } + + // Get sample binding from a class + Binding sampleBinding = Bindings.getBinding( Sample.class ); + // Get sample type from the binding + Datatype sampleFormat = sampleBinding.type(); ++