VolumePreenchido := A * (B - C * D - E * F + G * H2). It has to be in radians as required by the built-in function Tan(). Pi := 3.14159265358979 The value of Pi.Īngle := 0.01818 * (Pi / 180) The angle between the horizontal ground and the floor of the tank. Thank you again Rbrtrynĭ := 20 The horizontal distance between the upper base and the place (in the length of the cylinder) where the height of fuel is being measured. Msgbox % "Current Fuel: `n`n" Round(ResultadoEmLitros, 2) " Liters left"ĭoes anyone have a clue on how to add the "distance from the base" to the formula without integrals or if this is possible at all? VolumePreenchido := A * (B - C * D - E * F + G * H2) And the final "skeleton". H := Altura The height of the fuel in the uppermost base.Ī := (r ** 3) / tan(Angle) The first "bone" of the formula. ![]() DistanceToTheUpperBase := 480 The horizontal distance between the upper base and the place (in the length of the cylinder) where the height of fuel is being measured. Pi := 3.14159265358979 Value of Pi.Īngle := 0.01818 * (Pi / 180) The angle has to be in radians (as required by the built-in function Tan() ) R := 63.5 The radius of the base (lateral circle). Gui, add, Text, x20 y178, Enter the height of the fuel (in cm): ![]() Calculum of the volume of fuel left inside an inclined tank. The author removed the references to "d" when he removed the integral references. I tried to figure out how to add "d" (distance from the base) into the formula, but have had no success as of this reply. After the update, the script is displaying the same results as the online calculator, but only if upper base is selected and distance from the base is 0. The new formula is a translation of the one in the bottom of the page. Ok, thank you again Rbrtryn for the link, i have updated the script. I'm also attaching a small sketch of the tank.ĭoes anyone have a clue on how to make the formula acknowledge the small angle difference between the sides and still calculate the correct volume of fuel inside the tank based on a measured height? Msgbox % "Volume of the fuel inside the tank: `n`n" Round(ResultadoEmLitros, 2) " Liters" This is how we avoid issues with complex number calculations. ResultadoEmLitros := VolumePreenchido / 1000Įlse Otherwise. VolumePreenchido := VolumeTotal - VolumeVazio And than we subtract it from the total volume of the cylinder. VolumeVazio := L * (Pi*r**2/2 - r**2 * Asin((r-hInversa)/r) + (hInversa-r) * (r**2-(hInversa-r)**2)**(1/2)) We calculate the volume of the empty space inside the tank first. If (h < r) If the fuel height is lower than the radius. VolumeTotal := Pi * (r ** 2) * L Total volume of the Cylinder. HInversa := (r*2-h) Height of the empty space (Note: i had some issues with complex numbers (AHK doesn't like them), so the conditional bellow avoids applying the formula directly when the fuel height is higher than the radius) R := 63.5 Radius of the tanks circle (in cm). Gui, add, Button, x140 y208 h20 w50 gCalcular, Calcular Gui, Add, Edit, x20 y208 w100 h20 Number vAltura Gui, add, Text, x20 y178, Input the fuel height (in centimeters, max 127): Gui add, picture, BackGroundTrans x10 y10 w310 h158, %A_ScriptDir%/Logo.png The script i currently have (to calculate the liters in a completely horizontal cylinder) is this one: This is for a reason: sometimes the fuel stored inside the tank forms some water, and the lower end is were this water gets drained (because it is heavier than pure diesel). ![]() One of the sides is positioned 8cm higher than the other side. Here's what: The company i work for has this fuel tank that is a 480cm Length x 127cm height nearly horizontal cylinder and i'm considering creating a script that will calculate the ammount of fuel left inside the tank based on a measurement of the height of the fuel.Īfter searching for a while on the internet, i was able to find a formula to calculate this if the tank were in a completely horizontal position and i even translated it to AHK, but the problem is that the tank in question is not at a completely horizontal position. I'm actually looking for some support, but since the subject is more of a mathematics problem than purely AHK, i decided to post in the offtopic section.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |