VantagePointDisplay.com Vantage Point Online Reference
Search:
Contents
Display Legacy Contents

IndexBookmarkPrint

Home > Vantage Point Server > Configuration Files > Legacy INI Configuration > Devices > SQL

SQL

A device section starts with <Device> and ends with </Device>. You will need a separate Device section for each device you want this Point Server to query. We recommend using a comment immediately after the opening tag to provide a long description of the device.

  • Device Type – SQL

  • Device Description – A short description of the device, contained within double-quotes (").

  • PortID – The PortID that you assigned to the device in the Comm Ports section.

  • Device Address – 0

  • Device Bus Number – 0

  • Interval Seconds – The frequency devices are queried for new values.

  • TimeOut Seconds – How many seconds the Vantage Point Server will wait for a response from a devices before it times out.

  • Unreliable TimeOutSec – How many seconds the Vantage Point Server is to go without any response from a device before it marks that the device as Unreliable. The Vantage Point Server will then report the unreliable status to the Vantage Point Presentation.

1     <Device> 'Device Long Description                                                                                                                                                      
2         '                                                  Device      Device      Interval     TimeOut     Unreliable
3         'Device Type     Device Description     PortID     Address     Bus Num     Seconds      Seconds     TimeOutSec
4         '-----------     ------------------     ------     -------     -------     --------     -------     ----------
5          SQL             "Short Description"    2          0           0           4.0          4.0         300 'Default is 300
6  
7         <SQL>
8  
9         </SQL> 
10  
11         <Points>
12  
13         </Points>
14  
15     </Device>
16  

SQL Subsection Parameters

The SQL subsection starts with <SQL> and ends with </SQL> and it is contained within a Device subsection.  This subsection is unique to a SQL Point Server configuration and it contains a SELECT statement that queries the SQL database for the point information. The resulting query should return 2 columns of data – the first with fields whose values are point names and the second with fields that contain the current value of each point – and 1 row for each point.

Each line of the SELECT statement must be contained within double-quotes (").

1     <Device>                                                                                                                                                                        
2  
3         <SQL>
4             "Select PointName, PointValue"
5             "From TableName"
6             "Inner Join"
7                 "(Select PointName, Max(DateTime) as MaxDateTime"
8                 "From TableName"
9                 "Where PointName in"
10                     "(P_sql1, P_sql2, P_sql3, P_sql4, P_sql5, P_sql6)"
11                 "Group by PointName) as AliasName"
12             "On TableName.PointName = AliasName.PointName"
13                 "And TableName.DateTime = AliasName.MaxDateTime"
14         </SQL>
15  
16         <Points>
17  
18         </Points>
19  
20     </Device>

Points Subsection Parameters

The Points subsection starts with <Points> and ends with </Points> and it is contained within a Device subsection. A Device subsection can have only one Points subsection. It contains every Point on a Device from which you want to retrieve data but not necessarily every point available on the Device.
  • Point TagA short name that identifies the point and must be unique within the entire configuration file.

  • Point Address – This is the field value on a table in the SQL database that identifies the point.

  • Type

    • RB: Any device that returns a binary value (ie, 0 or 1, True or False).

    • RS: Any device that returns a text value.

    • R: All other devices.

  • Point Description – Contained within double quotes, this is a brief description of the point.

  • Number of Entries – The maximum number of history records stored for this calculation.

    • Auto or Optimized: Sets the Interval to Hourly and records 336 hourly records, 60 daily records, and 120 monthly into history.

    • Numeric Value: Sets the maximum number to the value indicated.

    • Default (-): Designated by a hyphen, default stores only the last record.

  • Value Type

    • Accumulated, Accum, Total, Totalize, Meter, or Metered: An aggregate value for the specified Interval is recorded in history.

    • Minimum or Min: The lowest value received in the specified Interval is recorded in history.

    • Maximum or Max: The highest value received in the specified Interval is recorded in history.

    • Average or Avg: The average of all values received in the specified Interval is recorded in history.

    • Instantaneous, Instant, Inst, or (-): The last value received in the specified Interval is recorded in history. If no value type is specified, it will default to this.

  • Interval – The frequency in which the result of the calculation is stored in history.

    • Minute

    • Hour or Hourly

    • Day or Daily

    • Month or Monthly

  • Multiplier – Multiplies the Interval by the value indicated. The default value, indicated with a hyphen, is 1. (An hourly interval with a multiplier of 3 would record entries 3 times an hour, or every 20 minutes.)

  • Rollover – Some points return an accumulating value that resets to zero once it reaches a maximum value (eg, a meter). This setting adds the accumulated value reached at the reset to the values now received. The default, designated by a hyphen, is zero.

1     <Device>                                                                                                                                                                        
2  
3         <SQL>
4  
5         </SQL>
6  
7         <Points>
8             '                                                               Num Of      Value
9             'Point Tag     Point Address     Type     Point Description     Entries     Type      Interval     Multiplier     Rollover
10             '---------     -------------     ----     -----------------     -------     -----     --------     ----------     --------
11              P_sql1        value1            R        "P1 Example"          auto        accum     -            -              1000000
12              P_sql2        value2            R        "P2 Example"          auto        inst      -            -              -
13              P_sql3        value3            R        "P3 Example"          129600      min       minute       -              -
14              P_sql4        value4            R        "P4 Example"          518400      max       hour         0.5            -
15              P_sql5        value5            R        "P5 Example"          129600      avg       day          1              -
16              P_sql6        value5            R        "P6 Example"          518400      inst      month        0.5            -
17  
18         </Points>
19  
20     </Device>

Complete SQL Device Sample Configuration

1     <Device> 'Device Long Description                                                                                                                                                        
2         '                                                  Device      Device      Interval     TimeOut     Unreliable
3         'Device Type     Device Description     PortID     Address     Bus Num     Seconds      Seconds     TimeOutSec
4         '-----------     ------------------     ------     -------     -------     --------     -------     ----------
5          SQL             "Short Description"    5          0           0           4.0          4.0         300 'Default is 300
6  
7         <SQL>
8             "Select PointName, PointValue"
9             "From TableName"
10             "Inner Join"
11                 "(Select PointName, Max(DateTime) as MaxDateTime"
12                 "From TableName"
13                 "Where PointName in"
14                     "(P_sql1, P_sql2, P_sql3, P_sql4, P_sql5, P_sql6)"
15                 "Group by PointName) as AliasName"
16             "On TableName.PointName = AliasName.PointName"
17                 "And TableName.DateTime = AliasName.MaxDateTime"
18         </SQL>
19  
20         <Points>
21             '                                                               Num Of      Value
22             'Point Tag     Point Address     Type     Point Description     Entries     Type      Interval     Multiplier     Rollover
23             '---------     -------------     ----     -----------------     -------     -----     --------     ----------     --------
24              P_sql1        value1            R        "P1 Example"          auto        accum     -            -              1000000
31              P_sql2        value2            R        "P2 Example"          auto        inst      -            -              -
32              P_sql3        value3            R        "P3 Example"          129600      min       minute       -              -
33              P_sql4        value4            R        "P4 Example"          518400      max       hour         0.5            -
34              P_sql5        value5            R        "P5 Example"          129600      avg       day          1              -
35              P_sql6        value6            R        "P6 Example"          518400      inst      month        0.5            -
36  
37         </Points>
38  
29     </Device>


Return to Parent Article: Devices



See also