VolumeHorizontalTank (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


This function will calculate the amount of fluid in a horizontal tank. The calculation is based on the tank possessing uncurved ends and being perfectly circular in shape.

 

Input:

R : DINT (0..2147483648)

Radius of the tank in millimeters.                

 

L : DINT (0..2147483648)

Length of the tank in millimeters.

 

H : DINT (0..2147483648)

Height of the fluid in the tank (if "H" equals "R", the tank is completely full) in milliliters.

 

Returns: DINT

The amount of fluid contained in the tank in milliliters.

 

Declaration:

FUNCTION VolumeHorizontalTank : DINT;
VAR_INPUT
R : DINT;
  L : DINT;
  H : DINT;
END_VAR;

 

 

Example:

//-----------------------------------------------------------------------------
// test.vpl, created 2002-02-03 17:56
//
// Test of volume calculations, for horizontal and vertical tanks, with straight
// ends (non-curved)
//
//-----------------------------------------------------------------------------
INCLUDE rtcu.inc
 
PROGRAM test;
 
 // Horizontal: Length = 5000 mm, Radius=2000 mm, Height of fluid=2000 mm
  // (tank is 5 meters long and 4 meters diameter, half full)
  // Should be 31415926 (PI) ml (31.4 mill liters !)
  DebugFmt(message:="Horizontal volume (31415926 ml) = \4 ml", v4:=VolumeHorizontalTank(H:=2000, L:=5000, R:=2000));
 
// Horizontal: Length = 1000 mm, Radius=500 mm, Height of fluid=500 mm
  // Tank is half full, should be 392699.0817 ml
  DebugFmt(message:="Horizontal volume (392699 ml) = \4 ml", v4:=VolumeHorizontalTank(H:=500, L:=1000, R:=500));
 
  // Horizontal: Length = 1000 mm, Radius=500 mm, Height of fluid=1000 mm
  // Tank is full, should be 785398.1634 ml
  DebugFmt(message:="Horizontal volume (785398 ml) = \4 ml", v4:=VolumeHorizontalTank(H:=1000, L:=1000, R:=500));
 
  // Vertical: Radius=500 mm, Height of fluid=500 mm
  // Should be 392699.0817 ml
  DebugFmt(message:="Vertical volume (392699 ml) = \4 ml", v4:=VolumeVerticalTank(H:=500, R:=500));
 
BEGIN
 
END;
 
END_PROGRAM;