]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.history/history.txt
Enabled tycho plugin and feature source builds.
[simantics/platform.git] / bundles / org.simantics.history / history.txt
1 This plugin(org.simantics.history) contains a library for history service.\r
2 \r
3 == Details ==\r
4 \r
5 HistoryManager manages persistent and stateful objects called "Subscription".\r
6 Subscription has globally unique id (GUID).\r
7 \r
8 When a subscription is recorded, it is opened and a handle is received. \r
9 To record the user supplies time code and values for each variable. \r
10   \r
11 A subscription consists of items that describe how a variable is to be recorded\r
12 and stored in a file. For each item: interval, deadband, variableId, enabled, \r
13 and the sample format are provided.  \r
14 \r
15 Sample format describes the format how the data is stored in the stream file, the\r
16 primitive types and fields to record. There is a well-known set of \r
17 fields that the recording supports. Unknown fields are left unchanged. \r
18 Fields "time", "endTime", and "value" are mandatory.\r
19 \r
20 Sample = {\r
21    // Time\r
22    time         : Double,      // Time of the first sample (mandatory field) \r
23    endTime      : Double,      // Time of the last sample (mandatory field)\r
24 \r
25    // Values\r
26    value        : Double,      // First value (mandatory field)  \r
27    lastValue    : Double,      // Last value \r
28    avg          : Double,      // Avg value of source valus within the band's time range\r
29    median       : Double,      // Median value\r
30    min          : Double, \r
31    max          : Double,\r
32    \r
33    quality      : Byte,        // 0-Good, -1=Novalue\r
34    count        : Integer      // The number of source values acquired \r
35 }\r
36 \r
37 One variable is typically subscribed with multiple items. For instance, simantics\r
38 chart subscribes the chart_raw, chart_1s, chart_10s, chart_60s, and chart_min-max \r
39 items. 1s, 10s, and 60s have corresponding interval value (eg. max. 1 entry per 10s of data). \r
40 "min-max" is an subscription item that tracks down the minimum and maximum\r
41 value of the variable. It has infinitely long interval value and thus records\r
42 only one sample (unless there is discontinuation). \r
43  \r
44 The sample entry is basically a band of values. The entry is packed even if \r
45 deadband and interval are disabled. The system packs the unchanged set of values \r
46 into a single entry. \r
47 \r
48 Simple = {\r
49    time         : Double, \r
50    endTime      : Double,\r
51    value        : Double\r
52 }\r
53 \r
54 The system can write down any primitive fields. Even arrays, enums, records\r
55 and strings. Time and endTime fields must be numeric, values not.\r
56 \r
57 Example1 = {\r
58    time         : Long, \r
59    endTime      : Long,\r
60    value        : Double,\r
61    avg          : Float\r
62 }\r
63 \r
64 VectorSample = {\r
65    time         : Long, \r
66    endTime      : Long,\r
67    value        : Double[ 3 ]\r
68 }\r
69 \r
70 \r
71 Discontinuation\r
72 --------------- \r
73 \r
74 The assumption is that two consecutive stream entries describe a data that is sampled \r
75 continuously from the source. If there is non-continuation in the source data or\r
76 if the recording was disabled temporarily, a discontinuation marker is added. \r
77 \r
78 To support discontinuation in the data stream, there must be quality-field.\r
79 \r
80 Example = {\r
81    time         : Long, \r
82    endTime      : Long,\r
83    value        : Double,\r
84    quality      : Byte    // 0 Good, -1 No value\r
85 }\r
86 \r
87 \r
88 File History\r
89 =================\r
90 \r
91 File based implementation is the only existing implementation. Files are \r
92 managed in workarea (folder). Subscription state and recording metadata is in one \r
93 file, and all subscription items each in a separate file. \r
94 \r
95  Subscription        -    [SubscriptionId].dbb\r
96  SubscriptionItem    -    [SubscriptionId]-VariableId-[sampling hash hex]-[sampling name].stm\r
97 \r
98 When a subscription is created, it prepares all related files. If a subscription\r
99 is modified, it reflects to files by deleting and creating new. \r
100 \r
101 An open subscription recording can be closed and opened, the state data is persisted \r
102 when the handle is closed. \r