Skip to main content

Data Store Configuration

Now that we've established what our calculation is going to look like, we need our data store to reflect that. To do this we need to set up some assets to run the calculation against. Here is a sample configuration of assets that can be used with our calculation:

A screenshot of the PI Asset Framework Tank Farm elements and attributes

It is presumed that you have a good understanding of the AVEVA PI System and its Asset Framework and are able to establish these without guidance.

note

In a typical development workflow for a real system of calculations, the data store would be configured before developing a gSharp assembly.

Correlation Between .NET Modules and the Asset Data Store

Once you have created your calculation class and configured your assets in the asset data store (PI AF or Canary), gSharp provides the bridge between the two. This relationship is managed through a structured set of gSharp entities: the module, its points, and the contexts that connect those points to real asset data.

A screenshot of the correlation between a gSharp .NET module and the PI Asset Framework Tank Farm

From .NET to gSharp​

When your calculation assembly is registered, gSharp identifies your TankVolume class as a module. Each property in your class that derives from any of the standard gSharp point base types (for example, AFAttrDoublePoint or CLDoublePoint) becomes a point within the module.

A screenshot of the correlation between a gSharp .NET module and its gSharp module

Module points are descriptive only—they define the data that the calculation expects (such as Diameter, Level, and Volume) but are not tied to any specific asset or attribute.

Within the module's metadata, each point includes mapping details that describe how it should be resolved once the module is connected to an asset. For example, the TankVolume module might specify that its Diameter point corresponds to Diameter_cnst when bound to an asset.

A screenshot of the mapping of gSharp .NET properties to AF attributes

Contexts: Connecting Modules to Assets​

A context represents a specific instance of a module connected to a particular asset in the data store. Each context resolves the module’s points to the correct asset attributes based on both the module’s point descriptors and the asset’s configuration.

A screenshot of the mapping of gSharp .NET properties to AF attributes

Although the module’s code and points are the same, each context links them to a different asset, allowing the same calculation logic to run independently for each tank.

gSharp Overview​

The screenshot below shows how the TankVolume module, with its points and contexts, is represented in the gSharp administration application. The selected module and its associated contexts are highlighted to provide a visualization of how the mappings and relationships you explored in the examples appear in the system.

A screenshot of the TankVolume module and contexts in the gSharp administration application for PI AF