]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.history/src/org/simantics/history/HistoryAndCollectorItem.java
Rest API for Historian data
[simantics/platform.git] / bundles / org.simantics.history / src / org / simantics / history / HistoryAndCollectorItem.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.history;
13
14 import org.simantics.databoard.annotations.Identifier;
15 import org.simantics.databoard.type.Datatype;
16 import org.simantics.databoard.util.Bean;
17 import org.simantics.history.util.subscription.SamplingFormat;
18
19 /**
20  * (Utility class) Item format for both HistoryManager and Collector.
21  * 
22  * SubscriptionItem describes how to read one Datasource Item and how to write to one History Item.
23  * 
24  * @author toni.kalajainen
25  */
26 public class HistoryAndCollectorItem extends Bean.Id {
27         
28         /** A reference to an item in Datasource */
29         public String variableId;
30         
31         /** History item reference */
32         public @Identifier String id;
33         
34         /** 
35          * Describes the format of the packed sample. The sample must be a record.
36          * The record must have any combination of the following named fields.
37          * The field types must one of: byte, integer, long, float, double.
38          * 
39          * time, endTime, value - are mandatory fields.
40          * 
41          *  time      -  Region start time, the time of the 1st included sample
42          *  endTime   -  Region end time, the time of the last included sample
43          *  
44          *  value     -  First value in the region
45          *  lastValue -  Last value in the region
46          *  avg       -  Average value of all included samples
47          *  median    -  Median value of all samples in the region
48          *  min       -  Lowest value in the region
49          *  max       -  Highest value in the region
50          *  
51          *  quality   -  0 = Good, -1 = No value
52          *  count     -  The number of included samples in the region
53          *  
54          * See {@link SamplingFormat} for example formats. 
55          */
56         public Datatype format;
57                         
58         // Subscription parameters
59         public double deadband = Double.NaN;
60         public double interval = Double.NaN;
61         public double gain = 1.0;
62         public double bias = 0.0;
63         public boolean enabled = true;
64         
65 }