Optimization of electrical energy production in offshore installations