Example 1.5 – RxC Distribution
SQL Statement
(defined in file PI_REAL_DISTR1.SQL)
|
SELECT sampletime AS PI_TIMESTAMP1, 'Tag1' AS PI_TAGNAME1, [level] AS PI_VALUE1, sampletime AS PI_TIMESTAMP2, 'Tag2' AS PI_TAGNAME2, temperature AS PI_VALUE2, temperature_status AS PI_STATUS2, sampletime AS PI_TIMESTAMP3,'Tag3' AS PI_TAGNAME3, density AS PI_VALUE3, density_status AS PI_STATUS3 FROM T1_5 WHERE sampletime > ? AND tank = 'Tank1'
|
Relevant PI Point Attributes
|
Extended Descriptor
(RxC Distributor)
|
Location1
(All points)
|
Location2
(All points)
|
Location3
|
Location4
(All points)
|
Location5
(All points)
|
P1=TS
|
1
|
0
|
'RxC Distributor'
-2
'Target points'
0
|
1
|
0
|
Instrumenttag
(Distributor)
|
Point Type
(All points)
|
Point Source
(All Points)
|
|
|
|
PI_REAL_DISTR_RxC.SQL
|
Float32
|
S
|
|
|
|
RDBMS Table Design
|
Table T1_5
|
SAMPLETIME
|
LEVEL,
TEMPERATURE,
DENSITY
|
LEVEL_STATUS,
TEMPERAURE_
STATUS,
DENSITY_STATUS
|
TANK
|
Datetime
(MS SQL Server)
Date/Time
(MS Access)
|
Real
MS SQL Server)
Number (Single) Prec.(MS Access)
|
Varchar(12)
(MS SQL Server)
Text(12)
(MS Access)
|
Varchar(80)
(MS SQL Server)
Text(80)
(MS Access)
|
Example of an appropriate result-set:
PI_TIMESTAMP1 PI_TAGNAME1 PI_VALUE1
20-Jul-2002 08:10:00 Target_Point1 1
PI_TIMESTAMP2 PI_TAGNAME2 PI_VALUE2 PI_STATUS2
20-Jul-2002 08:10:00 Target_Point2 10 NULL
PI_TIMESTAMP3 PI_TAGNAME3 PI_VALUE3 PI_STATUS3
20-Jul-2002 08:10:00 Target_Point3 100 NULL
1 goes to Target_Point1; 10 to Target_Point2;
100 to Target_Point3
Note: See also section: Detailed Description of Information the Distributor Tags Store.
Example 1.6 – Single Input with PI Annotations
SQL Statement
(file PI_ANNO1.SQL)
|
SELECT time AS PI_TIMESTAMP, value AS PI_VALUE, annotation AS PI_ANNOTATION FROM T1_6 WHERE time > ? ORDER BY time;
|
Relevant PI Point Attributes
|
Extended Descriptor
|
Location1
|
Location2
|
Location3
|
Location4
|
Location5
|
P1=TS
|
1
|
1
|
0
|
1
|
1
|
Instrumenttag
|
Point Type
|
Point Source
|
|
|
|
PI_ANNO1.SQL
|
Float32
|
S
|
|
|
|
RDBMS Table Design
|
T1_6
|
TIME
|
VALUE
|
ANNOTATION
|
Datetime
MS SQL Server)
Date/Time
(MS Access)
|
Real
(MS SQL Server)
Number-Single Precision
(MS Access)
|
Varchar(255)
(MS SQL Server)
Text(50)
(MS Access)
|
Dostları ilə paylaş: |