fix the logic for mixing the energy sources