AVEVA Real Time Optimization software has been applied to optimize the energy, utilities usage and CO2 emission at Repsol Coruña Refinery. The application scope includes the Steam, H2, Fuel Gas systems and electricity generation, consumers and import/export with the grid. The complexity of the Natural Gas, Hydrogen and Electricity supplier`s contracts and CO2 pricing is also implemented at real time. Hydrogen bleeding to FG headers, Natural Gas import to FG headers along with LPG vaporization in FG header is also included. Relevant process units are also represented with different levels of accuracy to predict the impact of the different types of feed (they process vegetable oils and occasion crudes) in the utilities generation/consumption. The RTO system delivers automatically different optimization and planning cases with different level of implementation complexity to the Utilities Shift Manager through a comprehensive visualization system for implementation with Operations.