Optimal control and stabilization of building maintenance units based on minimum principle