can anyone help me calculate the figures of a underground water tank , i know the height of that tank and the water storage capacity in that tank, the problem i am facing is that the shape of the tank is different ,
height is 72inch
capacity is 4200 litres
what i want to do is i want to know how much litre of water is left in the tank in my home assistant ,
What are you measuring? I assume either the height of the water or the free space.
But either way, without a fairly accurate specification of the tank it will be difficult to calculate the volume of water left in the tank.
I don’t know if this is feasible to do, either fill the tank or start with an empty one.
Then measure the hight and then water in/out and do that as detailed as you want.
Then you can use that to work out a fairly good approximation. (some kind of integral, but I won’t be able to help you with that.) or just keep it linear between the measurements you took.
Assuming your corners are 90 °
Naming the sides from the top clockwise a to h
The area would be
(ah) + (de) - ((h-b) *(d-f))
Multiply by the hight gives you the volume.
If you do this all metric, 1m3 = 1000 liter
I’m sorry for jumping in to other’s thread, but my problem is the same except I don’t have idea how to write template script to calculate volume within my cylindrical tank, as we’ll already know the formula for cylindrical in liter is (pi * r^2 * h) / 1000, where r is radius of tank in cm, and h is height of waterlevel in cm. I measure height via sc04 ultrasonic sensor.
Can anyone help me?
Start with your area calculations. Everything there is fixed and you can just pre calculate that.
Area= (pi * r^2) / 1000
Then the sensor is easy (but I haven’t tested this)
platform: template
sensors:
water_in_tank:
value_template: '{{ states("sensor.water_level") * area }}'
unit_of_measurement: 'liters'
friendly_name: water left in tank