Asset Models and Datasources

These objects describe how your operation is modelled in IFS OI Server: assets and hierarchies, templates and attributes, and the tags, datasets and datasources behind them. Use them for asset registers, template coverage reports, and impact checks before you change a tag.

This article applies to version 26R2 and later of IFS OI Explorer.

Objects

Object What it holds Kind
Entities Assets, keyed by Name Database-backed
EntityMetadataFields The Metadata Fields an asset can carry, such as an EAM object ID Database-backed
EntityMetadata Each asset's Metadata Field values Database-backed
Hierarchies Named asset trees Database-backed
EntityRelationships Parent-to-child links in a hierarchy Database-backed
Templates Asset classes, keyed by Name Live
TemplateDefinitions Asset classes, keyed by Name Database-backed
Attributes Measurements defined on a template Live
AttributeValues Variants of an attribute, bound to a tag or calculation Live
TemplateInstances Which assets use which templates Database-backed
AttributeValueInstances Per-asset values and target tags Database-backed
Tags Historian and SCADA points, keyed by Name Live
TagDefinitions Tags, keyed by Name Database-backed
Calculations Every dataset of every type, keyed by Name Live
Datasets Datasets, keyed by Name Database-backed
Datasources Connected source systems Database-backed

For searching, counting and grouping, use the database-backed objects. See Choosing the right object.


Assets: Entities

Field Type Notes
Name Text Unique asset ID, such as WELL-A12
DisplayName Text Friendly name
Description Text  
Latitude, Longitude, Altitude Decimal Location, if configured
LastModified Date and time  
Templates Collection Templates this asset uses
PrimaryTemplate Object The template that is primary now
TemplateInstances Collection Asset-to-template links, each with its Id and TemplateDefinition
ChildRelationships Collection Where the asset sits in each hierarchy, with Hierarchy and Parent
Metadata Collection External IDs and other Metadata Field values, see Metadata

Entities is read from the database, so filtering, sorting and grouping run in SQL over every asset. Read one asset by name with Entities('WELL-A12'). To find an asset's place in a hierarchy, use Entities?$expand=ChildRelationships or EntityRelationships?$filter=Child/Name eq '...'.

All wells on the Alpha platform, by naming convention:

Entities?$filter=startswith(Name,'WELL-A')&$select=Name,DisplayName&$orderby=Name

Wells with GPS coordinates, for a map control:

Entities?$filter=Latitude ne null and Longitude ne null&$select=Name,DisplayName,Latitude,Longitude

Each well's primary template, as a flat column:

Entities?$filter=startswith(Name,'WELL-')&$compute=PrimaryTemplate/Name as Template&$select=Name,Template

Assets changed this month:

Entities?$filter=LastModified ge OI.startofmonth(now())&$select=Name,LastModified&$orderby=LastModified desc


Metadata: external IDs on assets

Metadata Fields are custom fields defined once and set on each asset, as in Core Management's Entity Metadata Fields. Other systems use them to store their own IDs for an asset. An EAM sync, for example, stores each asset's EAM object ID. Use them to find the OI asset that matches a record in another system, and from there its templates, attributes and tags.

EntityMetadataFields

Field Type Notes
Name Text Unique key, such as EAM.MchCode
Description Text  
Type Enumeration String, UniqueString, Integer, UniqueInteger, Decimal, DateTimeUtc, Boolean, NamedList, UniqueNamedList
SourceKey Text The field's key in the system it's synced from, if any
LastModified Date and time  
NamedList Object The picklist a NamedList or UniqueNamedList field takes its values from

A Unique type means no two assets can have the same value. Those are the fields to match external IDs on.

EntityMetadata has one row per asset per field.

Field Type Notes
EntityName Text The asset's name. With FieldName, the key
FieldName Text The Metadata Field's name
Value Text The value as text, whatever the field's type. Empty for picklist fields: use ValueNamedListItem/Value
ValueString, ValueUniqueString Text Set for String and UniqueString fields
ValueInteger, ValueUniqueInteger Whole number Set for Integer and UniqueInteger fields
ValueDecimal Decimal  
ValueDateTimeUtc Date and time  
ValueBoolean True/false  
LastModified Date and time  
Entity Object The asset
Field Object The Metadata Field
ValueNamedListItem, ValueUniqueNamedListItem Object The picklist item, for picklist fields

Only the column that matches the field's type is set. Value lets you match without knowing the type: numbers are plain digits, dates are ISO 8601 and booleans are true or false. On large asset models, filtering on the typed column, such as ValueUniqueString, is faster than filtering on Value.

You see an asset's metadata only if you can see the asset.

List the Metadata Fields:

EntityMetadataFields?$select=Name,Type,Description&$orderby=Name

Find the asset with a given EAM object ID:

Entities?$filter=Metadata/any(m: m/Field/Name eq 'EAM.MchCode' and m/Value eq ODataParam(id,string))&$select=Name,DisplayName

The same lookup on a numeric field, using its typed column:

Entities?$filter=Metadata/any(m: m/Field/Name eq 'EAM.EquipmentObjectSeq' and m/ValueUniqueInteger eq 100412)&$select=Name

The full EAM-ID-to-asset mapping, for loading into another system:

EntityMetadata?$filter=FieldName eq 'EAM.MchCode'&$select=Value,EntityName&$orderby=Value

Every Metadata Field value on one asset:

Entities?$filter=Name eq 'WELL-A12'&$select=Name&$expand=Metadata($select=Value;$expand=Field($select=Name,Type))

The attributes and target tags of the asset with a given EAM object ID:

TemplateInstances?$filter=Entity/Metadata/any(m: m/Field/Name eq 'EAM.MchCode' and m/Value eq ODataParam(id,string))&$compute=Entity/Name as Asset,TemplateDefinition/Name as Template&$select=Asset,Template&$expand=AttributeValueInstances($select=Value;$expand=AttributeValueDefinition($select=Name;$expand=AttributeDefinition($select=Name)),TargetTag($select=Name,NativeName))


Hierarchies and EntityRelationships

Hierarchies lists each named tree: Name and its EntityRelationships.

EntityRelationships has one row per parent-to-child link, with the Hierarchy, Parent and Child navigations. A root asset has no parent.

List the hierarchies:

Hierarchies?$select=Name

Direct children of the Alpha platform in the production hierarchy:

EntityRelationships?$filter=Hierarchy/Name eq 'Production Hierarchy' and Parent/Name eq ODataParam(parent,string)&$compute=Child/Name as Asset,Child/DisplayName as DisplayName&$select=Asset,DisplayName

Number of assets in each hierarchy:

EntityRelationships?$apply=compute(Hierarchy/Name as HierarchyName)/groupby((HierarchyName),aggregate($count as Assets))&$orderby=Assets desc

Assets in a hierarchy that use a gas lift template:

EntityRelationships?$filter=Hierarchy/Name eq 'Production Hierarchy' and Child/TemplateInstances/any(ti: contains(ti/TemplateDefinition/Name,'Gas Lift'))&$compute=Child/Name as Asset&$select=Asset


Templates, Attributes and AttributeValues

Object Key Fields
Templates Name Name, Description, TemplateGroupName, ImageName, IsSystem, Prefix, Attributes
Attributes TemplateName + Name TemplateName, Name, Description, DataType, AttributeGroupName, IsSystem, AttributeValues
AttributeValues TemplateName + AttributeName + Name Name, Description, IsDefault, RollupCalc, BoundTimeSeriesDatasetValueColumn, TagName, CalculationName, Tag, Calculation

Each attribute value is bound to a tag or a calculation, never both.

What does an ESP well measure?

Attributes?$filter=TemplateName eq 'ESP Well'&$select=Name,AttributeGroupName,DataType&$orderby=AttributeGroupName,Name

Which tag or calculation sits behind each "Actual" value on the Gas Lift Well template?

AttributeValues?$filter=TemplateName eq 'Gas Lift Well' and Name eq 'Actual'&$select=AttributeName,TagName,CalculationName

TemplateDefinitions is the database-backed equivalent of Templates. Use it to count or compute over attributes:

TemplateDefinitions?$filter=IsSystem eq false and Attributes/any()&$compute=OI.nameprefix(Name) as Family,Attributes/$count as AttributeCount&$select=Name,Family,AttributeCount&$orderby=AttributeCount desc


TemplateInstances and AttributeValueInstances

TemplateInstances links one asset to one template. Fields: Id. Navigations: Entity, TemplateDefinition, AttributeValueInstances, and PrimaryTemplateInstances (Id, StartTime, EndTime), the periods when this template was the asset's primary template.

Every asset that uses the 3-Phase Separator template:

TemplateInstances?$filter=TemplateDefinition/Name eq '3-Phase Separator'&$compute=Entity/Name as Asset,Entity/DisplayName as DisplayName&$select=Asset,DisplayName

Number of assets per template:

TemplateInstances?$apply=compute(TemplateDefinition/Name as Template)/groupby((Template),aggregate($count as Assets))&$orderby=Assets desc

AttributeValueInstances holds the per-asset value of an attribute value. This is where a static value is stored, such as a well's completion depth or a separator's design pressure, and where the asset's own target tag is recorded.

Field Notes
Id  
Value The stored value, as text
DataType See enumeration values
TemplateInstance Leads to Entity and TemplateDefinition
AttributeValueDefinition Includes AttributeName, Name, CalculationName and Tag
TargetTag The tag this asset actually reads from

The nested objects are trimmed. TemplateInstance/Entity has Name, Description and DisplayName. TemplateInstance/TemplateDefinition has Name, Description, TemplateGroupName, ImageName and IsSystem. TargetTag and AttributeValueDefinition/Tag have Name, Description, NativeName and DatasourceName. Use CalculationName, not Calculation.

Which tag holds tubing head pressure for a chosen well?

AttributeValueInstances?$filter=TemplateInstance/Entity/Name eq ODataParam(well,string) and AttributeValueDefinition/AttributeName eq 'Tubing Head Pressure'&$compute=AttributeValueDefinition/Name as ValueName,TargetTag/Name as Tag,TargetTag/NativeName as NativeName&$select=ValueName,Tag,NativeName

Every well whose stored "Artificial Lift Type" is ESP:

AttributeValueInstances?$filter=AttributeValueDefinition/AttributeName eq 'Artificial Lift Type' and Value eq 'ESP'&$compute=TemplateInstance/Entity/Name as Well&$select=Well


Tags and TagDefinitions

Tags: Name, Description, Type, DatasourceName, NativeName (the name in the source system), DecimalPlaces, IsHidden, Prefix, and the Datasource object.

TagDefinitions: the database-backed equivalent, keyed by Name, with LastModified and the Datasource navigation. It has no DatasourceName or Prefix: use Datasource/Name and OI.nameprefix(Name).

OI OData returns tag configuration, not time-series values. To trend a tag, use its tag datasource as usual.

Find the Explorer tag for a raw PI point name:

Tags?$filter=NativeName eq 'A12_THP.PV'&$select=Name,DatasourceName

Search for flow-rate tags across every tag, with no 5,000-row cap:

TagDefinitions?$filter=contains(Name,'FlowRate') or contains(Description,'Flow Rate')&$compute=Datasource/Name as DatasourceName&$select=Name,Description,NativeName,DatasourceName&$orderby=Name&$top=1000

Tags per datasource:

TagDefinitions?$apply=filter(Datasource ne null)/compute(Datasource/Name as DatasourceName)/groupby((DatasourceName),aggregate($count as Tags))&$orderby=Tags desc

Calculated tags by name family:

Tags?$apply=filter(Type eq P2.Server.DataDictionary.DataObjectSourceType'Calculation')/groupby((Prefix),aggregate($count as Tags))&$orderby=Tags desc


Calculations and Datasets

Calculations lists every dataset of every type: calculations, merged datasets, time-series datasets and so on. Fields: Name, Description, Type, DatasourceName, NativeName (the query text), Prefix, and the Datasource object.

Datasets is the database-backed equivalent, keyed by Name, with LastModified. Use Datasource/Name and OI.nameprefix(Name) in place of DatasourceName and Prefix. It supports OI.normalizesql().

Which datasets reference a given table or view?

Datasets?$filter=contains(NativeName,'well_test_results')&$select=Name,NativeName

Every OI OData dataset on the server:

Datasets?$filter=Datasource/AdaptorName eq 'OI OData Adaptor'&$select=Name,NativeName,LastModified


Datasources

Fields: Id, Name, Description, DataType, AdaptorName, MinPoolSize, MaxPoolSize, MinIngestionPoolSize, MaxIngestionPoolSize, IsDisabled, LastModified.

Datasources?$filter=IsDisabled eq false&$select=Name,AdaptorName&$orderby=AdaptorName,Name

Tags with their datasource's adaptor, using $crossjoin:

$crossjoin(TagDefinitions,Datasources)?$select=TagDefinitions/Name,Datasources/Name,Datasources/AdaptorName&$filter=TagDefinitions/Datasource/Name eq Datasources/Name and startswith(TagDefinitions/Name,'A12_')


Recipes

Asset register. Wells with primary template and location:

Entities?$filter=startswith(Name,'WELL-')&$compute=PrimaryTemplate/Name as Template&$select=Name,DisplayName,Template,Latitude,Longitude&$orderby=Name

Tag audit before a historian migration. Every PI tag with its native point name:

TagDefinitions?$filter=Datasource/Name eq 'PI Historian'&$select=Name,NativeName,Description&$orderby=Name&$top=1000

Map another system's IDs to assets. Each EAM object ID with its OI asset:

EntityMetadata?$filter=FieldName eq 'EAM.MchCode'&$select=Value,EntityName&$orderby=Value

Impact check before renaming a tag. The assets bound to it:

AttributeValueInstances?$filter=TargetTag/Name eq ODataParam(tag,string)&$compute=TemplateInstance/Entity/Name as Asset,AttributeValueDefinition/AttributeName as Attribute&$select=Asset,Attribute

Then the pages and trends that show it. See Workspaces, Workbooks and Pages.


Next: Entries,Shift Log and Case Management

Related:  Configuring Your System · Object Reference

Comments are closed