Competing Interests: The authors have declared that no competing interests exist.
Vertical tanks are commonly used appliances for liquids, and its capacity is very important for quantitative liquid ratio and liquid trade. In order to measure the capacity of vertical tanks more conveniently, this paper proposes a vertical tank capacity measurement method based on Monte Carlo Method. The method arranges a plurality of sensor points on the inner surface of the tank, and then performs Monte Carlo tests by generating a large number of random sample points, and finally calculates the capacity by counting the sample points that meet the criterion. The criterion for whether a sample point is located in the tank, which is the core issue, is established with the coordinates of sensor points and the distance between different sensor points along the surface of the tank. The results show that the absolute error of the measurement results of the proposed method does not exceed ±0.0003[m3], and the absolute error of capacity per unit volume has a linear relationship with the height of the vertical tank, and has little effect with the radial size of the vertical tank.
Vertical tank is widely used in the storage, transportation and measurement of liquid substances such as petroleum and chemical materials. Accurate measurement of the vertical tank capacity is directly related to the fairness of liquid substance transactions.
One of the commonly methods used to measure the capacity of a vertical tank is Geometric Measurement Method (GMM). GMM uses steel tape, theodolite or other measuring device to measure tank’s geometry, and use dedicated computer software to process the measured data to obtain the tank capacity [1–3]. This method is with a low level of automation, requires measuring a range of geometric parameters, such as the height, circumference, and diameter of different rings (vertical tanks are actually composed of many rings), which is of a heavy work load and time-consuming. Due to the need for a lot of manual operations, the measurement efficiency of this method is low, and the measurement results are easily affected by operator errors.
Another commonly used method to measure the capacity of a vertical tank is Volumetric Method (VM). VM compares the capacity difference between a tank with higher precision and the vertical tank being measured [1, 4]. During measurement, a fixed volume of water is poured into the storage tank through a standard metal tank (apparatus with a higher level of accuracy), and then the capacity table is calculated by interpolation. This method can be adapted to irregularly shaped tanks, and the capacity can be obtained directly through volume comparison without conversion calculation. VM is with high precision and simple to operate, but requires liquid (usually is water) supply while measurement and the contaminated liquid needs further processing while measurement finish. At present, 5m3 is already a very large standard metal tank, but the volume range of vertical tanks includes 20m3~700m3, even more than 700m3, and the height can exceeds 30 meters. To place the standard metal tank higher than the metal tank, this is difficult to achieve. In addition, the standard metal tank is too small compared to the vertical tank, and it takes a lot of time to pour a fixed amount of water many times. If the vertical tank is large, VM is rarely used because it takes a long time and consumes large amounts of water.
With the development of technology, new techniques for measuring vertical tank capacity has emerged. Laser Scanner Method (LSM) reconstructs the internal volume of a vertical tank by emitting laser light to the surroundings [5–7]. The principle of LSM is similar to that of GMM. They both obtain the vertical tank capacity by measuring the geometry parameters, but LSM is more automated. In LSM, a laser scanner is used instead of the manual measurement, and the geometric dimensions of the vertical tank are get by fitting the points cloud obtained through multiple scans. LSM includes external scanning and internal scanning. External scanning is to place the laser scanner outside the vertical tank, which requires an open field of view and as few obstructions as possible. Internal scanning is to place the laser scanner in a vertical tank, which requires fewer parts present inside the vertical tank, and the bottom of the vertical tank keeps stable during the measurement. However, when the vertical tank is large, the inspector stepping on the bottom plate may cause the bottom of the vertical tank to undulate and deform, causing the laser scanner to be unstable.
The volumetric method, geometric measurement method, and laser scanner method are used to measure vertical tanks, with a relatively fixed cycle, about once every four years. If you want to monitor the capacity of the vertical tank in real time, it is a more feasible way to arrange sensors in the vertical tank.
Monte Carlo Method (MCM) constructs a probabilistic model that approximates the performance of the system and performs random experiments on a digital computer [8]. It is very common to calculate the solid volume represented by the boundary with MCM [9, 10]. Currently when using MCM to measure a volume, the boundary is usually obtained by laser scanning, which can provide the boundary points cloud. And with octrees construction on the points cloud, whether a point is located in the model is classified [11]. How to construct the boundary conditions of Monte Carlo experiment is the core problem of this method. MCM is computationally intensive, and still need environmental stability while laser scanning. If the boundary discrimination condition of MCM can be simplified, the amount of calculation would be greatly reduced. As General Conference of Weights & Measures has redefined SI base units and associated the definition of these basic units with physical constants, measurement standards may be integrated into the chip. That is to say, it is possible to describe the boundary discrimination condition of MCM through inserting the chip into the vertical tank. In the future, vertical tank capacity measurement would develop towards intelligent, real-time online monitoring. Under this background, we propose a vertical tank capacity measurement method based on the Monte Carlo method, hoping to conveniently measure the vertical tank capacity and obtain acceptable results, and do preliminary theoretical research for the future real-time monitoring of the change in vertical tank capacity. This paper is an exploratory study on the mathematical model and experiment of measuring vertical tank capacity by Monte Carlo method. This method focuses on constructing vertical tank boundary and capacity measurements on the premise of knowing the coordinates of certain points on the inner surface of the vertical tank.
Vertical tank capacity measurement based on Monte Carlo method is to arrange sensor points on the inner surface of the vertical tank. And then, according to the coordinates of the sensor points and the distance between each point along the tank surface, criterion to decide whether a sample point is located in the vertical tank is established. Base on this criterion, the number of sample points falling in different heights is counted, and the capacity value represented by different liquid level is calculated with the number of sample points. Fig 1 shows the main steps of the proposed method.


Flow chart of the proposed method.
Fig 2 is the coordinate system. Vertical tanks are generally cylindrical, and their cross-sections are generally circular. Therefore, our methods and tests are all carried out with circular cross-sections. Vertical tank is divided into upper part and bottom part. The bottom part of vertical tank is usually irregular because of ground subsidence or other reasons, and the capacity of bottom part is obtained by volumetric method or other methods. The bottom of the vertical tank generally only occupies little share of the entire storage tank, and the bottom volume is only used when the liquid is first fed or when the tank is cleared. In the daily custody transfer, the capacity table on the upper part of the vertical tank is generally used for calculation, and the amount of liquid in each custody transfer is generally not less than two meters in the height of the vertical tank. Due to the deformation of the bottom plate and other reasons, it is difficult to measure the bottom volume of the vertical tank very accurately by the geometric measurement method and the laser scanner method, and more attention is paid to the measurement of the upper part of the storage tank. Thus, this paper focuses on acquiring the capacity of upper part. The height of bottom part is Hbottom, and the height of upper part is Hupper. The inner radius of the vertical tank is R. The capacity of the vertical tank is synthesized from the upper part and the bottom part, shown in Eq 1.



The coordinate system.
Fig 3 shows the distribution of sensor points. Sensor points are equiangularly arranged on different layers. The number of layers is Nlayer and the number of sensor points on each layer is Nmono. The projection of the sensor points of each layer on O-XY surface are coincidence. The interval between layers is hlayer and the total number of sensor points is Nsensor. Thus,




Sensor points distribution.
Criterion of the Monte Carlo test is used to decide whether a sample point falls in the vertical tank. As the vertical tank is convex and the sensor points are located on the inner surface of the tank, sample points in the enclosed area formed by all sensor points must be in the tank, shown in Fig 4. If sample point Psample locates in the enclosed area formed by all sensor points, we have a, b and c, make



The enclosed area formed by all sensor points.
(a) 3D illustration of the enclosed space; (b) The projection of the enclosed space on O-XY surface.
If we cannot find a, b and c let Psample satisfies Eq 4, it is still uncertain whether Psample falls in the vertical tank or not. The subsequent calculation will be performed.
Fig 5 is the positional relationship of Psample,Pi1,j1, and Pi2,j2. If Psample is between Pi1,j1, and Pi2,j2(i.e. Psample falls within the shaded area in Fig 4), we have





Positional relationship of Psample, Pi1,j1, and Pi2,j2.
After finding out two sensor points making distance is the smallest, for example, Pi1,j1 and Pi2,j2 satisfy Eqs 5, 6, and 7, we construct an ellipsoid with Pi1,j1 and Pi2,j2 as the endpoints, shown in Fig 6. Point A and B are the foci of the ellipse. Thus,
As



The ellipsoid with Pi1,j1, and Pi2,j2 as the endpoints.
In Fig 6, the distance from O to Pi1,j1 and Pi2,j2 along the surface of the tank are


Solving Chalf = li1,j1↔i2,j2, we can get λ and the ellipsoid equation, i.e. Eq 8.
According to the definition of an ellipsoid, if the sum of the distance from Psample to A and B is shorter than Lminor, Psample is in the ellipsoid. That is, if

In summary, if a sample point Psample falls in the vertical tank, we have
When conducting the Monte Carlo tests, sample points are randomly generated in the smallest cuboid that contains the vertical tank. If xmin = min{xi,j}, ymin = min{yi,j}, zmin = min{zi,j}, xmax = max{xi,j}, ymax = max{yi,j}, zmax = max{zi,j}, where 1≤ i ≤ Nlayer, 1≤ j ≤ Nmono, xi,j, yi,j and zi,j are the coordinates of sensor points, the coordinates of sample points would be xmin≤x≤xmax, ymin≤y≤ymax, zmin≤z≤zmax.
After the Monte Carlo tests, if the number of sample points satisfying the criterions of the Monte Carlo Test is NIN, and totally Nsample sample points are generated, the capacity of the upper part would be



Fig 7 is the vertical tank model of the Monte Carlo test. The radius of vertical tank is R = 1.300[m], and the upper part height of the vertical tank is Hupper = 8.476[m]. The maximum capacity of upper part is π · R2 · Hupper ≈ 45.000[m3]. Sensor points are distributed in ten layers (Nlayer = 10). Each layer has ten sensor points uniformly distributed equiangularly (Nmono = 10). Thus, Nsensor = Nmono · Nlayer = 100, i.e., there are 100 sensor points in total. Considering the size of the vertical tank, we initially set up 100 sensor points. The influence of the number of sensor points on the measurement results will be further studied in the follow-up work. Currently, 100 sensor points are used to explore the feasibility of the proposed method. The difference of heights between each layer is hlayer = 0.8476[m]. Sample points are generated in Cuboid L–W–Hupper, whose L = 2.600[m], W = 2.600[m] and Hupper = 8.476[m]. Thus, xmin = -1.300[m], ymin = -1.300[m], zmin = 0, xmax = 1.300[m], ymax = 1.300[m], zmax = 8.4776[m], and the coordinates of sample points satisfy -1.300[m]≤x≤1.300[m], -1.300[m]≤y≤1.300[m], 0≤z≤8.476[m].


The vertical tank model.
The Monte Carlo tests are performed on Matlab, and the sample points are generated with Matlab’s built-in random function ─ unifrnd (). Totally Nsample = 106 sample points are generated in each test. A total of 10 tests were conducted.
In order to discuss the measurement results of vertical tanks of different volumes, the absolute error of capacity per unit volume is calculated as

Fig 8 is the absolute error of capacity per unit volume of Test 1~10. It shows that there is a significant linear relationship between εk and hk in each test. The slopes of the fitting results of Test 1~10 are all around 0.0252.


The absolute error of capacity per unit volume of Test 1~10.
To further investigate the relationship between the absolute error of capacity per unit volume and the size of the vertical tank, another sixty tests are carried out for different heights and radii of tank.
Fig 9 is the absolute error of capacity per unit volume with different heights of vertical tank. The heights of vertical tank are 8.476 [m], 6.781 [m], 4.238 [m], and 2.543 [m]. Each height is tested 10 times and the inner radius of vertical tank is 1.300 [m] in each test. Fig 8 shows the average value of εk. From the fitting results, even though Hupper has changed, there is still a significant linear relationship between εk and hk. The slopes of the fitting results are different. Interestingly, we find that 0.02524 × 8.476 ≈ 0.214, 0.03154 × 6.781 ≈ 0.214, 0.05047 × 4.238 ≈ 0.214, and 0.08415 × 2.543 ≈ 0.214. This shows that the product of the slope and Hupper is a constant value, which 0.214.


The absolute error of capacity per unit volume with different heights of vertical tank.
Fig 10 is the absolute error of capacity per unit volume with different radii of vertical tank. The radii of vertical tank are 1.300 [m], 1.040 [m], 0.910 [m], and 0.780 [m]. Each radius is tested 10 times and the height of vertical tank is 8.476 [m] in each test. Fig 10 shows the average value of εk. It can be seen from Fig 10 that there is a significant linear relationship between εk and hk, and the slope hardly changes due to changes in radius.


The absolute error of capacity per unit volume with different radii of vertical tank.
Based on the above analysis of the influence of Hupper and R on εk, in the linear relationship between εk and hk, R has little effect on the slope, and the product of Hupper and the slope is a constant, which is 0.214. Therefore, the relationship between εk and hk can be written as




Fig 11 are devices used for vertical tank testing, including a vertical tank [13] and a metal tank [14]. The inner diameter of the vertical tank is R = 0.299[m]. One hundred sensor point labels are evenly affixed on the inner wall of the vertical tank, a total of 10 layers, each with 10 points. The distance between the lowest sensor point and the highest sensor point is Hupper = 0.513[m]. The distance between the sensor points of each layer is hlayer = 0.057[m]. The capacity of bottom part is Qbottom = 0.0175[m3]. A ruler is attached to the inner wall of the vertical tank for reading the liquid level with a resolution of 0.001[m]. The nominal capacity of the metal tank is 0.02[m3], indicating that it can accurately hold 0.02[m3] of liquid. The liquid in the metal tank can be transferred to the vertical tank through the plastic hose. The liquid used in the test is water. Since the nature of water is relatively stable, compared to other media, such as oil, the volume of water is less affected by temperature and volatility, so we used water to verify the accuracy of the proposed method to measure the capacity of vertical tanks.


Vertical tank test devices.
Fig 12 is the sequence of vertical tank test, including two parts: vertical tank test and Monte Carlo test. In the vertical tank test, the first step is to pour Qbottom = 0.0175[m3] of water into the tank, and record the liquid level as


Vertical tank test sequence.
In the Monte Carlo test, a total of 10 tests are performed, and the parameters of each test are shown in Fig 12. Based on the average value of 10 tests,
Table 1 is the results of vertical tank tests. Based on the average values, the relationship between the capacity and liquid level of the vertical tank is obtained through linear fitting, shown in Fig 13.


The relationship between the capacity and liquid level of the vertical tank.

![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | |
|---|---|---|---|---|---|---|---|
| Test1 | 0.072 | 0.142 | 0.213 | 0.285 | 0.356 | 0.427 | 0.498 |
| Test2 | 0.071 | 0.142 | 0.213 | 0.284 | 0.355 | 0.426 | 0.497 |
| Test3 | 0.071 | 0.142 | 0.213 | 0.284 | 0.356 | 0.426 | 0.497 |
| Test4 | 0.071 | 0.142 | 0.213 | 0.284 | 0.355 | 0.426 | 0.497 |
| Test5 | 0.071 | 0.143 | 0.214 | 0.285 | 0.356 | 0.427 | 0.497 |
| Average | 0.071 | 0.142 | 0.213 | 0.284 | 0.356 | 0.427 | 0.497 |
Fig 14 is the absolute error distribution of the measurement results obtained through the Monte Carlo method, e.g.


Absolute error distribution.
Fig 15 is the relative error shrinkage curve, e.g.


Relative error shrinkage curve.
A new vertical tank capacity measurement method based on Monte Carlo Method is proposed. Focusing on constructing vertical tank boundary, the method arranges a plurality of sensor points on the inner surface of the vertical tank, and performs Monte Carlo tests by generating a large number of random sample points. The criterions for whether a sample point is located in the vertical tank are established with the coordinates of sensor points and the distance between different sensor points along the surface of the tank. The results show that the absolute error of capacity per unit volume has a linear relationship with the height of the vertical tank, and has little effect with the radial size of the vertical tank. The absolute error of the measurement results of the proposed method does not exceed ±0.0003[m3], and the relative error finally converges to less than 0.18%.
Although the method we proposed can effectively measure the capacity of vertical tank, there are still some limitations that need to be improved. The number of sensor points is large, and the arrangement of the sensor points is relatively neat. We will further explore the influence of the number and location of sensor points on the measurement results in the future, try to reduce the number of sensor points, and more convenient ways to arrange the sensor points, such as scattered random arrangement. In addition, this method is suitable for tanks of various shapes, such as cuboid, cylinder, etc., but the connection between any two sensor points must be inside the tank, and there can be no such connection outside the tank. At this stage, this article mainly discusses the feasibility of the proposed method. In the future application stage, there are still many problems to be solved, such as the selection of sensors and the reaction of sensors with liquids. Regarding the selection of sensors, we have made some guesses. Surface acoustic wave sensors, ultrasonic guided wave sensors, and stress-strain sensors may be suitable.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15