Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA Pipeline Operations for Liquids

Retrieve Strapping table metadata

  • Last UpdatedApr 24, 2025
  • 2 minute read

The Tank Strapping metadata information can be retrieved using the GetStrapMetaData method from the IReadOnlyBroker interface. HistoricalBroker and RealTimeBroker classes implement the IReadOnlyBroker interface which will retrieve data from Historical and RealTime, respectively. It is the responsibility of the developer to decide whether to connect their application to Historical or RealTime.

The StrappingTableService class connects to RealTime. It is highly unlikely that the Strapping metadata will alternate throughout the execution of an application. Typically, this data is only modified during a major upgrade of the OASyS application.

The following list details the properties of the RealTimeBroker\HistoricalBroker object:

  • Namespace: OASySDNA.LMS.Tank.Strapping.Client

  • Assembly: OASySDNA.LMS.Tank.Strapping(in OASySDNA.LMS.Tank.Strapping.dll)

  • Interface: IReadOnlyBroker

To retrieve the Strapping table metadata that includes fractions and types

To retrieve the Strapping table metadata, invoke the OASySDNA.LMS.Tank.Strapping.Client.IReadOnlyBroker. GetStrapMetaData() method. (There are no parameters necessary for this step.)

The following table details the return value:

Name

Type

Description

StrappingResponse<StrappingMetaData>

N/A

A response package containing the strapping table metadata that includes fractions and types.

Example

using System;

using System.Linq;

using OASySDNA.LMS.Tank.Strapping;

using OASySDNA.LMS.Tank.Strapping.Client;

using OASySDNA.LMS.Tank.Strapping.Common;

namespace ExampleClass

{

public class TankStrappingAPIExample

{

public void GetStrappingTableFractionInformation(String tableName)

{

//Tank Strapping meta data can be fetched using the GetStrapMetaData method on the //IReadOnlyBroker interface. This interface is implemented by 2 different classes, either of which //can be used; the HistoricalBroker, or RealTimeBroker which will fetch data from Historical or //RealTime respectively.

IReadOnlyBroker realTimeBroker = new RealTimeBroker();

IReadOnlyBroker historicalBroker = new HistoricalBroker();

//The designer of an application will need to decide if they want their application to connect //Historical or RealTime.

//The StrappingTableService class connects to RealTime.

//The meta data from RealTime or Historical will be identical, so only one of the following calls //needs to be performed.

var metaDataFromRealTime = realTimeBroker.GetStrapMetaData();

var metaDataFromHistorical = historicalBroker.GetStrapMetaData();

//Similar to how the methods on the StrappingTableService function, broker methods return a structure //that contains a state, potential failure reason and payload value.

if (metaDataFromRealTime.State != ResponseState.OK)

{

throw new Exception($"Failed to fetch meta data ({metaDataFromRealTime.State}): {metaDataFromRealTime.FailureReason}");

}

//It is highly unlikely that the strapping meta data will change during the execution of an //application. Typically, this data is only modified during a major upgrade of the OASyS //application. As such, applications can make a single fetch of the meta data

//and cache it for the applications lifespan.

var fractionsCacheLookupDictionary = metaDataFromRealTime.Value.StrappingFractionList.ToDictionary(x => x.Id);

var typesCacheLookupDictionary = metaDataFromRealTime.Value.StrappingTypeList.ToDictionary(x => x.Id);

//Strapping tables can be fetched using the StrappingTableService object, as seen in other //examples.

var myStrappingTableService = new StrappingTableService(tableName);

var getTableResponse = myStrappingTableService.GetTable();

if (getTableResponse.State != ResponseState.OK)

{

throw new Exception($"Failed to fetch strapping table '{tableName}' ({getTableResponse.State}): {getTableResponse.FailureReason}");

}

var strappingTable = getTableResponse.Value;

//Information for fraction type that a strapping table uses can now be looked up based on its ID //which is found in the TankStrappingFractionId property of a strapping table.

//This example created a dictionary 'fractionsCacheLookupDictionary' above to make this look //up faster.

var myTableFractionType = fractionsCacheLookupDictionary[strappingTable.TankStrappingFractionId];

Console.WriteLine("{0} has strapping fraction '{1}' which is entered in the format {2}, has the unit {3}, and can be validated with the regular expression {4}",

tableName,

myTableFractionType.Name,

myTableFractionType.Format,

myTableFractionType.MeasurementUnit,

myTableFractionType.ValueRegex);

}

}

}