16 package emlab.gen.role.market;
18 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.transaction.annotation.Transactional;
21 import agentspring.role.RoleComponent;
47 createFinancialReportsForPowerPlantsAndTick(
48 reps.powerPlantRepository.findAllPowerPlantsWhichAreNotDismantledBeforeTick(getCurrentTick() - 2),
54 createFinancialReportsForPowerPlantsAndTick(
55 reps.powerPlantRepository.findAllPowerPlantsWithConstructionStartTimeInTick(getCurrentTick()),
59 void createFinancialReportsForPowerPlantsAndTick(Iterable<PowerPlant> plants,
long tick) {
64 financialPowerPlantReport.setTime(tick);
65 financialPowerPlantReport.setFullLoadHours(0);
66 financialPowerPlantReport.setPowerPlant(plant);
67 financialPowerPlantReport.setCommodityCosts(0);
68 financialPowerPlantReport.persist();
72 double totalSupply = plant.calculateElectricityOutputAtTime(tick,
false);
73 financialPowerPlantReport.setProduction(totalSupply);
77 double amount = share.getShare() * totalSupply;
78 Substance substance = share.getSubstance();
79 double substanceCost = findLastKnownPriceForSubstance(substance) * amount;
80 financialPowerPlantReport.setCommodityCosts(financialPowerPlantReport.getCommodityCosts()
85 financialPowerPlantReport.setCo2Costs(reps.powerPlantRepository.calculateCO2CostsOfPowerPlant(plant,
87 financialPowerPlantReport.setVariableCosts(financialPowerPlantReport.getCommodityCosts()+financialPowerPlantReport.getCo2Costs());
90 financialPowerPlantReport.setFixedCosts(reps.powerPlantRepository
91 .calculateFixedCostsOfPowerPlant(plant,
95 financialPowerPlantReport.setSpotMarketRevenue(reps.powerPlantRepository
96 .calculateSpotMarketRevenueOfPowerPlant(plant, tick));
98 financialPowerPlantReport.setStrategicReserveRevenue(reps.powerPlantRepository
99 .calculateStrategicReserveRevenueOfPowerPlant(plant, tick));
101 financialPowerPlantReport.setCapacityMarketRevenue(reps.powerPlantRepository
102 .calculateCapacityMarketRevenueOfPowerPlant(plant, tick));
104 financialPowerPlantReport.setCo2HedgingRevenue(reps.powerPlantRepository
105 .calculateCO2HedgingRevenueOfPowerPlant(plant, tick));
108 financialPowerPlantReport.setOverallRevenue(financialPowerPlantReport.getCapacityMarketRevenue() + financialPowerPlantReport.getCo2HedgingRevenue() + financialPowerPlantReport.getSpotMarketRevenue() + financialPowerPlantReport
109 .getStrategicReserveRevenue());
112 financialPowerPlantReport.setFullLoadHours(reps.powerPlantRepository.calculateFullLoadHoursOfPowerPlant(
115 int operationalStatus;
116 if (plant.isOperational(tick))
117 operationalStatus = 1;
118 else if (plant.isInPipeline(tick))
119 operationalStatus = 0;
121 operationalStatus = 2;
123 financialPowerPlantReport.setPowerPlantStatus(operationalStatus);