The Monte Carlo test

This protocol is extracted from research article:

Vertical tank capacity measurement based on Monte Carlo method

**
PLoS One**,
Apr 16, 2021;
DOI:
10.1371/journal.pone.0250207

Vertical tank capacity measurement based on Monte Carlo method

Procedure

**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 *H*_{upper} = 8.476[m]. The maximum capacity of upper part is π · *R*^{2} · *H*_{upper} ≈ 45.000[m^{3}]. Sensor points are distributed in ten layers (*N*_{layer} = 10). Each layer has ten sensor points uniformly distributed equiangularly (*N*_{mono} = 10). Thus, *N*_{sensor} = *N*_{mono} · *N*_{layer} = 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 *h*_{layer} = 0.8476[m]. Sample points are generated in Cuboid *L*–*W*–*H*_{upper}, whose *L* = 2.600[m], *W* = 2.600[m] and *H*_{upper} = 8.476[m]. Thus, *x*_{min} = -1.300[m], *y*_{min} = -1.300[m], *z*_{min} = 0, *x*_{max} = 1.300[m], *y*_{max} = 1.300[m], *z*_{max} = 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 Monte Carlo tests are performed on Matlab, and the sample points are generated with Matlab’s built-in random function ─ *unifrnd ()*. Totally *N*_{sample} = 10^{6} 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

where *Q*_{k} is the vertical tank capacity at *h*_{k}. ${{Q}^{\prime}}_{k}$is the actual capacity of vertical tank at *h*_{k}, ${{Q}^{\prime}}_{k}=\pi \cdot {R}^{2}\cdot {h}_{k}+{Q}_{\text{bottom}}$. *V*_{cuboid} is the volume of cuboid, *V*_{cuboid} = *L* · *W* · *H*_{upper}.

**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 *h*_{k} in each test. The slopes of the fitting results of Test 1~10 are all around 0.0252.

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 *H*_{upper} has changed, there is still a significant linear relationship between *ε*_{k} and *h*_{k}. 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 *H*_{upper} is a constant value, which 0.214.

**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 *h*_{k}, and the slope hardly changes due to changes in radius.

Based on the above analysis of the influence of *H*_{upper} and *R* on *ε*_{k}, in the linear relationship between *ε*_{k} and *h*_{k}, *R* has little effect on the slope, and the product of *H*_{upper} and the slope is a constant, which is 0.214. Therefore, the relationship between *ε*_{k} and *h*_{k} can be written as

The vertical tank capacity in upper part at *h*_{k}, which is measured with the Monte Carlo method, can be compensated according to Eq 16. The compensated vertical tank capacity in upper part at *h*_{k} is

Substituting Eq 16 into Eq 17, we have

Thus,

This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Note: The content above has been extracted from a research article, so it may not display correctly.

Q&A

Your question will be posted on the Bio-101 website. We will send your questions to the authors of this protocol and Bio-protocol community members who are experienced with this method. you will be informed using the email address associated with your Bio-protocol account.