Standard PLC programming language does not allow to use complex algorithms in building automation for the energetic optimization of industrial supply systems. This paper discusses how future building automation systems should be designed for this purpose. An adapted building automation control program is implemented on an industrial PC and evaluated in the real scale ETA Research Factory. The program ensures scalability and functional safety through object-oriented programming and implementation of a safety fallback system. The industrial PC is enabled to communicate via OPC UA. Finally we present a communication interface to connect the building automation to optimization programs using Python.