Current building management systems are rule-based, meaning that the controls of energy systems are programmed when the building is built. Modifications to the control of energy systems are not feasible since they require manual expert action. By introducing a control system that is based on building and system models it is possible to optimize operation dynamically and change it e.g. every day or every hour.