16 package emlab.gen.role.investment;
18 import java.util.HashMap;
20 import java.util.Map.Entry;
22 import java.util.TreeMap;
24 import org.springframework.beans.factory.annotation.Autowired;
40 Map<Segment, Double> expectedElectricityPricesPerSegment;
41 double maxExpectedLoad = 0d;
42 Map<PowerPlant, Double> meritOrder;
47 expectedElectricityPricesPerSegment =
new HashMap<Segment, Double>();
48 Map<PowerPlant, Double> marginalCostMap =
new HashMap<PowerPlant, Double>();
52 for (
PowerPlant plant : reps.powerPlantRepository.findExpectedOperationalPowerPlantsInMarket(market, time)) {
54 double plantMarginalCost = determineExpectedMarginalCost(plant, fuelPrices, co2price);
55 marginalCostMap.put(plant, plantMarginalCost);
56 capacitySum += plant.getActualNominalCapacity();
60 meritOrder =
new TreeMap<PowerPlant, Double>(comp);
61 meritOrder.putAll(marginalCostMap);
63 long numberOfSegments = reps.segmentRepository.count();
65 double demandFactor = market.getDemandGrowthTrend().getValue(time);
68 for (
SegmentLoad segmentLoad : market.getLoadDurationCurve()) {
70 double expectedSegmentLoad = segmentLoad.getBaseLoad() * demandFactor;
72 if (expectedSegmentLoad > maxExpectedLoad) {
73 maxExpectedLoad = expectedSegmentLoad;
76 double segmentSupply = 0d;
77 double segmentPrice = 0d;
79 for (Entry<PowerPlant, Double> plantCost : meritOrder.entrySet()) {
81 double plantCapacity = 0d;
84 plantCapacity = plant.getExpectedAvailableCapacity(time, segmentLoad.getSegment(), numberOfSegments);
89 if (segmentSupply < expectedSegmentLoad) {
90 segmentSupply += plantCapacity;
91 segmentPrice = plantCost.getValue();
101 if (segmentSupply >= expectedSegmentLoad) {
102 expectedElectricityPricesPerSegment.put(segmentLoad.getSegment(), segmentPrice);
104 expectedElectricityPricesPerSegment.put(segmentLoad.getSegment(), market.getValueOfLostLoad());
110 public double determineExpectedMarginalCost(
PowerPlant plant, Map<Substance, Double> expectedFuelPrices,
double expectedCO2Price) {
111 double mc = determineExpectedMarginalFuelCost(plant, expectedFuelPrices);
112 double co2Intensity = calculateCO2Intensity(plant);
113 mc += co2Intensity * expectedCO2Price;
117 public double determineExpectedMarginalFuelCost(
PowerPlant powerPlant, Map<Substance, Double> expectedFuelPrices) {
120 double amount = mix.getShare();
121 double fuelPrice = expectedFuelPrices.get(mix.getSubstance());
122 fc += amount * fuelPrice;
127 public double calculateCO2Intensity(
PowerPlant plant) {
128 return calculateCO2Intensity(plant.getFuelMix()) * (1 - plant.getTechnology().getCo2CaptureEffciency());
131 public double calculateCO2Intensity(Set<SubstanceShareInFuelMix> fuelMix) {
132 double co2Intensity = 0d;
134 co2Intensity += mix.getShare() * mix.getSubstance().getCo2Density();