Convert level increments to volume
- Last UpdatedApr 24, 2025
- 2 minute read
To convert a level to a volume
-
Execute the Business Logic Tier (BLT) TankStrappingService. This BLT automatically starts as part of the RealTime service when AVEVA Pipeline Operations for Liquids has been installed.
The following table details the parameters:
|
Name |
Type |
Optional |
Output |
Description |
|---|---|---|---|---|
|
Function |
String |
False |
False |
The name of the function that the service is executing. To convert volumes to increment, this value should always be ConvertIncrementsToVolume. |
|
StrapName |
String |
False |
False |
The name of the strapping table that performs the conversion. Typically, this is the value configured in the strappingname field of a tank record. |
|
Value |
Double |
False |
False |
The level increments value that is to be converted to volume. |
|
State |
Int32 |
False |
True |
The return state of the options. Any value other than 0 indicates that a failure has occurred. This value matches the enumeration values of OASySDNA.LMS.Tank.Strapping. Common.ResponseState. |
|
ReturnValue |
String |
False |
True |
The calculated volume. |
|
FailureReason |
String |
False |
True |
The reason for failure. This field is only populated if state returns a non-zero value. |
Example programming of a TankStrappingService BLT level increment conversion
The following is an example of how you can program using the TankStrappingService BLT:
double inputIncrements = 10;
double returnVolume = 0;
int resultState = 0;
string failureReason = "";
var bltClientFactory = new BLTClientFactory();
using (var client = bltClientFactory.Create("TankStrappingService"))
{
client.AddParameter("ConvertIncrementsToVolume", false);
client.AddParameter("exampleStrappingTable", false);
client.AddParameter(inputIncrements, false);
client.AddParameter(0, true); //State is an output parameter
client.AddParameter(0, true); //ReturnValue is an output parameter
client.AddParameter("", true); //FailureReason is an output parameter
client.Execute();
resultState = (int)client.Parameter(3); // parameters are 0 indexed
returnVolume = (double)client.Parameter(4);
failureReason = (string)client.Parameter(5);
}
if (resultState != 0)
{
Console.WriteLine($"TankStrappingService failure: ({resultState}): {failureReason}");
}
else
{
Console.WriteLine($"Converted volume is {returnVolume}");
}