I am wondering whether it is possible to optimize at the same time the full energy system; in my case electricity generation and refining.
This should be possible Smail using energy system optimization. I'm currently working on a further refinement of energy system optimization and should have a new improved version of LEAP that fixes a few bugs - hopefully next week.