Convert volume to level increments
- Last UpdatedApr 24, 2025
- 2 minute read
To convert a volume to a level
-
Execute the Business Logic Tier (BLT) TankStrappingService. This BLT is automatically started 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 ConvertVolumeToIncrements. |
|
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 volume value that is to be converted to increments. |
|
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 number of level increments. |
|
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 volume conversion
The following is an example of how you can program using the TankStrappingService BLT.
double inputVolume = 10000;
double resultLevel = 0;
int resultState = 0;
string failureReason = "";
var bltClientFactory = new BLTClientFactory();
using (var client = bltClientFactory.Create("TankStrappingService"))
{
client.AddParameter("ConvertVolumeToIncrements", false);
client.AddParameter("exampleStrappingTable", false);
client.AddParameter(inputVolume, 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
resultLevel = (double)client.Parameter(4);
failureReason = (string)client.Parameter(5);
}
if (resultState != 0)
{
Console.WriteLine($"TankStrappingService failure: ({resultState}): {failureReason}");
}
else
{
Console.WriteLine($"Converted level is {resultLevel}");
}