Creating a Tag Datasource

Before you can get data into P2 Server, you must define a datasource. A datasource is a connection that allows P2 Server to retrieve data from an external system, such as an historian, database, accounting system, etc.

Each datasource retrieves data from one source system. You need to define a connection for each system you want to connect to. When defining a datasource, there are some technical terms to be aware of. This article explains how to create a datasource, and the terms that relate to tag datasources (e.g. data stored in an historian database, such as PI).

You can add a datasource using P2 Server Management or the Import/Export spreadsheet.

Server Management

Step 1. Create the Datasource

In P2 Server Management, adding a datasource is performed through the Configuration  menu option.

1. Open P2 Server Management, and click the Configuration icon.

2. Select the Datasources  option from the middle panel.

3. Click the Create New Datasource button.

If you are updating a datasource, click the name of the datasource instead.

create-datasource

Step 2. Configure a Connection

The configuration parameters are different depending on the type of datasource you are configuring. For a tag datasource, the parameters are as follows.

Parameter Description and example
Name

The name that this datasource will be known by, to be used in other applications such as P2 Explorer. In the example below, the list of datasources appears in P2 Explorer when adding a dataset to a page.

adddatasource

Description

Detailed information on the external system that this datasource connects to. A good description helps to address any ambiguities when there are several datasources with similar names.

 

Discovery Prefix

A prefix that is attached to the start of the tag name, usually used as a shorthand way of identifying the datasource. E.g. rel-
Note: This setting was added in P2 Server v 4.5.0.

Default Tag Scan Rate

Used to estimate the number of data points a tag fetch will return, when performing raw fetches. This property is used to reflect the collection interval of the underlying tag in the datasource.

It is important to choose the lowest Scan Rate that is being used by tags in the source system. E.g. If this is set to 1 day on a datasource which also contains 30-second tags, then a user may cause the system to become unresponsive by performing large raw fetches for the 30-second tags.

If there is a mixture of tags, or specific tags that use a higher Scan Rate (e.g. daily scan rate), then we recommend configuring the Scan Rate on those specific tags and leaving the datasource at the lowest Scan Rate that is being used by tags in the source system. The Scan Rate calculation for raw fetches (see above) will by preference use the tag’s Scan Rate, and then fall back to this Default Tag Scan Rate, if the Scan Rate is not configured.

Note: This setting was added in P2 Server v 4.5.3.

Data Type

The format of data retrieved by the datasource. For time series data stored in historians, you should choose "Tag".

tagdatatype

Adaptor

The type of connection that is used by the datasource to retrieve the data.

adaptorpi

Time Zone

The time zone applicable for the location of the source system. Choose "Geographical Timezone" if you want the system to automatically obey daylight savings, otherwise choose "Fixed Offset" to specify the difference in hours and minutes from UTC.

Example: If your source data timestamps are in UTC, you should use a Fixed Offset with 0 hours. The adaptor will use the Time Zone setting in the datasource to offset the timestamps (to UTC) for consumption elsewhere (e.g. charts or calculations).

Geographical Timezone: Begin typing the name of the time zone you are looking for. This field uses predictive text, so choose one of the items that appears in the list.

Fixed Offset: Specify the offset from UTC/GMT (e.g. + 08 00). 

Adaptor Pool Size

The adaptor pool hosts a number of adaptors (datasource connections), which can be called upon to retrieve data. You need to specify the minimum and maximum adaptor pool size by moving the sliders left and right.
If your external system only allows one active connection at a time, set both minimum and maximum to 1. Default: Min=2, Max=8.

For more information on adaptor pool sizes, see “Datasources and Adaptors“.

Initialisation Timeout

Applies to the initialisation of an adaptor, when it first connects to a datasource. This is the same as the Init_Timeout setting used in P2 Explorer 2.6.x.  Note: This setting was added in P2 Server v 4.5.2.

Request Timeout

Applies to all other operations against the datasource, such as tag fetch. It is similar to the Submit_Timeout setting used in P2 Explorer 2.6.x.

Note: This setting was added in P2 Server v 4.5.2.

Data Object Discovery Timeout

The Request Timeout parameter has been split into two parameters to allows a longer timeframe to be set for discovering tags on large systems, and a short timeframe for fetching actual tag data. If you had previously set the Request Timeout to a longer period due to the time it was taking to complete a Tag Discovery, then set Data Object Discovery Timeout to this larger value and reduce the Request Timeout value. We recommend setting the data fetch parameter (Request Timeout) to 60 seconds to reduce the load on system resources.  This means that any request for data will be terminated after 60 seconds.

Step 3. Configure the Adaptor

The Adaptor Parameters depend on the adaptor that has been selected.

The tag adaptors currently available are:

Step 4. Save the Datasource

save Save your datasource by clicking the Save button in the top right corner.

Step 5. Fetch the Tags

Once you have set up your datasource, you can:

Once the tags have been imported, you can edit them to change their properties, if required.

Related: Editing Tags


Import/Export Spreadsheet

The Import/Export spreadsheet is generally only used to make bulk changes. 

For details on the spreadsheet and how to obtain it, see Exporting Your Configuration

If you want to create or update tag datasources as part of a bulk configuration, you need to use the following tabs in the Import/Export spreadsheet:

  • Datasource
  • Datasource Parameter

Look for the red comment commentred icon in the row headers, to get help with each column.

DO NOT change anything in the Global Id field - this is the unique identifier for the datasource that allows it to be tracked across systems, and when it is renamed. It is automatically generated by the system. 

Datasource Tab

The screenshot below shows an example of configured tag datasources.  The fields are the same as the ones required when configuring the datasource connection using Server Management, following the above instructions on this page (step 2). 

Key Points:

  • The Name column must match the name of the datasource, as specified in Step 2 above.
  • The Adaptor Name must match one of the adaptors available in the drop-down list in Step 2 above.
  • Data Type must be Tag.
  • Timezone must be either a geographical timezone (available in the drop-down list in Step 2 above) or specified in UTC (e.g. UTC+08).
  • The System column does not apply to tag datasources.
  • Init Timeout and Request Timeout must be in the format: days:hours:minutes:seconds

Dependencies

The Datasource tab has a direct dependency on information from the System tab. 

This column On this tab Why you need to pay attention
Name System Required by the 'System' column on the 'Datasource' tab.

Read more: Understanding Object Dependencies

Datasource Parameter Tab

The screenshot below shows an example of configured parameters for a datasource using the PI Adaptor. The fields are the same as the ones required when completing the datasource parameters using Server Management, following the above instructions on this page. See Step 3 above for the available adaptor parameters.

Key Points:

  • Each parameter for each datasource must be added on a separate row.
  • The Datasource column must match the name of the datasource, as specified in Step 2 above.
  • The Name column is the name of the adaptor parameter, as specified in Step 3 above.
  • Valid values for Type are: Boolean, DateTime, Decimal, Duration, Integer, String, EncryptedString. These are specified in the adaptor parameter tables in Step 3 above. 
  • Is Value Encrypted should be FALSE, unless 'Type' is 'EncryptedString'.

Dependencies

The Datasource Parameter tab has a direct dependency on information from the Datasource tab. 

This column On this tab Why you need to pay attention
Name Datasource Required by the 'Datasource' column on the 'Datasource Parameter' tab.

Related: Updating the Configuration


Release History

  • PI Adaptor Features 4.10.4
    • Added Data Object Discovery Timeout
  • Creating a Tag Datasource 4.5.3
    • Initial version

Comments are closed