16 package emlab.gen.role.operating;
18 import java.util.HashMap;
22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.data.neo4j.support.Neo4jTemplate;
24 import org.springframework.transaction.annotation.Transactional;
26 import agentspring.role.Role;
27 import agentspring.role.RoleComponent;
36 import emlab.gen.role.AbstractEnergyProducerRole;
52 Neo4jTemplate
template;
54 public Reps getReps() {
76 HashMap<ElectricitySpotMarket, Double> expectedCO2Prices = determineExpectedCO2PriceInclTax(getCurrentTick()-1, 1, 1);
77 Government government = reps.genericRepository.findFirst(Government.class);
81 for (
PowerPlant plant : reps.powerPlantRepository.findOperationalPowerPlantsWithFuelsGreaterZeroByOwner(producer, getCurrentTick())) {
82 logger.info(
"Found operational power plant {} ", plant.getTechnology());
85 Set<Substance> possibleFuels = plant.getTechnology().getFuels();
86 Map<Substance, Double> substancePriceMap =
new HashMap<Substance, Double>();
88 for (
Substance substance : possibleFuels) {
89 substancePriceMap.put(substance, findLastKnownPriceForSubstance(substance, getCurrentTick()));
91 Set<SubstanceShareInFuelMix> fuelMix = calculateFuelMix(plant, substancePriceMap,
92 expectedCO2Prices.get(reps.marketRepository.findElectricitySpotMarketByPowerPlant(plant)));
93 plant.setFuelMix(fuelMix);
99 public void determineFuelMixForecastForYearAndFuelPriceMap(
long clearingTick,
100 Map<Substance, Double> substancePriceMap, Map<ElectricitySpotMarket, Double> nationalMinCo2Prices) {
102 CO2Auction co2Auction = template.findAll(CO2Auction.class).iterator().next();
105 lastCO2Price = reps.clearingPointRepositoryOld.findClearingPointForMarketAndTime(co2Auction,
106 getCurrentTick() - 1,
false).getPrice();
107 }
catch (NullPointerException e) {
111 Government government = reps.genericRepository.findFirst(Government.class);
115 for (
PowerPlant plant : reps.powerPlantRepository.findExpectedOperationalPowerPlantsInMarket(market,
117 logger.info(
"Found operational power plant {} ", plant.getTechnology());
119 double effectiveCO2Price;
121 if (nationalMinCo2Prices.get(market) > lastCO2Price)
122 effectiveCO2Price = nationalMinCo2Prices.get(market);
124 effectiveCO2Price = lastCO2Price;
126 effectiveCO2Price += government.getCO2Tax(clearingTick);
128 Set<Substance> possibleFuels = plant.getTechnology().getFuels();
129 Map<Substance, Double> substancePriceMap1 =
new HashMap<Substance, Double>();
131 for (
Substance substance : possibleFuels) {
132 substancePriceMap1.put(substance, findLastKnownPriceForSubstance(substance, getCurrentTick()));
134 Set<SubstanceShareInFuelMix> fuelMix = calculateFuelMix(plant, substancePriceMap1,
136 plant.setFuelMix(fuelMix);
Iterable< ElectricitySpotMarket > findAllElectricitySpotMarkets()