calculations for building control