Difference between revisions of "Org.simantics.charts"

From Developer Documents
Jump to navigation Jump to search
m
 
(5 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
Trend is configured with TrendSpec class. It describes how and with what items the trend is drawn. The info can be changed on the run.  
 
Trend is configured with TrendSpec class. It describes how and with what items the trend is drawn. The info can be changed on the run.  
  
The data source for a trend is a HistoryManager, an interface from [[org.simantics.history]]. A trend is configured to visualize items from one history manager. History manager consists of groups and items. There is metadata with each item, such as, id, variableId (the item in datasource), format, deadband, interval, gain, bias, groupId, etc.  
+
The data source for a trend is one HistoryManager, an interface from [[org.simantics.history]]. History manager consists of groups and items. There is metadata associated with each item, such as, id, variableId (the item in datasource), format, deadband, interval, gain, bias, groupId, etc.  
  
''Format''-field determines the sampling format on the disc. All numeric types are supported: integer, float, double, etc. ''time'' and ''value'' fields are mandatory. If endTime exists the sample is interpreted as "value band" instead of a single sample. If ''quality'' field exists, the trend can have empty regions. ''min'' and ''max'' fields provide value deviation when the trend is zoomed out.  
+
In typical simantics case, a variable is recorded with different sampling intervals, see TrendSamplingFormats (all samples, 100ms, 1s, 10s, 60s). The trend detects all available history items for a recorded variable, and selects the most suitable item to draw from.
  
In typical simantics case, a variable is recorded with different sampling intervals (see TrendSamplingFormats), example: all samples, 100ms, 1s, 10s, 60s. The trend detects all available history items for a recorded variable, and selects the most appropriate file to draw from.
+
''Format''-field determines the sampling format on the disc. All numeric types are supported: integer, float, double, etc. ''time'' and ''value'' fields are mandatory. If endTime exists the sample is interpreted as "value band" instead of a single sample. If ''quality'' field exists, the trend can have empty regions. ''min'' and ''max'' fields provide value deviation when the trend is zoomed out.
 +
 
 +
<pre>
 +
The trends can utilize these fields from a sample format:
 +
 
 +
  Describes the format of the packed sample. The sample must be a record.
 +
  The record must have any combination of the following named fields.
 +
  The field types must one of: byte, integer, long, float, double.
 +
 +
  time, endTime, value - are mandatory fields.
 +
 +
  time      -  Region start time, the time of the 1st source sample included into the band
 +
  endTime  -  Region end time, the time of the last source sample included into the band
 +
 
 +
  value    -  First value in the band
 +
  lastValue -  Last value in the band
 +
  avg      -  Average value of all included samples
 +
  median    -  Median value of all samples in the band
 +
  min      -  Lowest value in the band
 +
  max      -  Highest value in the band
 +
 
 +
  quality  -  0 = Good, -1 = No value
 +
  count    -  The number of included samples in the band
 +
</pre>

Latest revision as of 10:34, 27 June 2012

There are two plug-ins to Simantics charts:

  • org.simantics.charts
  • org.simantics.trend

org.simantics.charts

Charts is the UI plugin that ties trends to the Simantics Workbench environment. It contributes an editor part, preferences, DnD operations, context menu actions, tool bar buttons, ontology, etc to Simantics Workbench. The main class there is its EditorPart contribution TimeSeriesEditor.

org.simantics.trend

org.simantics.trend is a visualization library that draws items as time-series lines. It supports lines and binary items on the same chart. It is the only current chart implementation. The code in this plugin is environment independent, it can be ran as POJO, EditorPart, ViewPart, or say, Java Applet. The trend visualizations are based on AWT/Swing.

Trend is configured with TrendSpec class. It describes how and with what items the trend is drawn. The info can be changed on the run.

The data source for a trend is one HistoryManager, an interface from org.simantics.history. History manager consists of groups and items. There is metadata associated with each item, such as, id, variableId (the item in datasource), format, deadband, interval, gain, bias, groupId, etc.

In typical simantics case, a variable is recorded with different sampling intervals, see TrendSamplingFormats (all samples, 100ms, 1s, 10s, 60s). The trend detects all available history items for a recorded variable, and selects the most suitable item to draw from.

Format-field determines the sampling format on the disc. All numeric types are supported: integer, float, double, etc. time and value fields are mandatory. If endTime exists the sample is interpreted as "value band" instead of a single sample. If quality field exists, the trend can have empty regions. min and max fields provide value deviation when the trend is zoomed out.

The trends can utilize these fields from a sample format:

  Describes the format of the packed sample. The sample must be a record.
  The record must have any combination of the following named fields.
  The field types must one of: byte, integer, long, float, double.
 
  time, endTime, value - are mandatory fields.
 
  time      -  Region start time, the time of the 1st source sample included into the band 
  endTime   -  Region end time, the time of the last source sample included into the band
  
  value     -  First value in the band
  lastValue -  Last value in the band
  avg       -  Average value of all included samples
  median    -  Median value of all samples in the band
  min       -  Lowest value in the band
  max       -  Highest value in the band
  
  quality   -  0 = Good, -1 = No value
  count     -  The number of included samples in the band