Determining the water level

Schematic diagram for generating the measurement value "water level"

1 Generation of the raw value, which is the distance to the water surface (see Determining the raw value (distance) ) 3 adds the configurable value for "trimming" to the preliminary water level (see Taking trimming into account)
2 calculates the preliminary water level by deducting the distance from the configurable "mounting height" (see Taking the mounting height into account)    

Water level = (mounting height - distance) + trimming

Calculation of the measurement level "water level"

Mounting height 50 cm
Distance 40 cm
Trimming -1 cm
Water level 9 cm