Cost-optimal control of bidirectional heat and power exchange between a green active building and district utilities | Synapse