-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
197 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/libs/antares/study/parts/thermal/constant_cost_provider.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2007-2024, RTE (https://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of Antares-Simulator, | ||
* Adequacy and Performance assessment for interconnected energy networks. | ||
* | ||
* Antares_Simulator is free software: you can redistribute it and/or modify | ||
* it under the terms of the Mozilla Public Licence 2.0 as published by | ||
* the Mozilla Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Antares_Simulator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Mozilla Public Licence 2.0 for more details. | ||
* | ||
* You should have received a copy of the Mozilla Public Licence 2.0 | ||
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#include "antares/study/parts/thermal/cluster.h" | ||
|
||
namespace Antares::Data | ||
{ | ||
ConstantCostProvider::ConstantCostProvider(ThermalCluster* cluster): | ||
cluster(cluster) | ||
{ | ||
} | ||
|
||
double ConstantCostProvider::getOperatingCost(uint serieIndex, uint hourInTheYear) const | ||
{ | ||
const auto* modCost = cluster->modulation[thermalModulationCost]; | ||
return cluster->marginalCost * modCost[hourInTheYear]; | ||
} | ||
|
||
double ConstantCostProvider::getMarginalCost(uint serieIndex, uint hourInTheYear) const | ||
{ | ||
const double mod = cluster->modulation[Data::thermalModulationCost][hourInTheYear]; | ||
return cluster->marginalCost * mod; | ||
} | ||
|
||
double ConstantCostProvider::getMarketBidCost(uint hourInTheYear, uint year) const | ||
{ | ||
const double mod = cluster->modulation[thermalModulationMarketBid][hourInTheYear]; | ||
return cluster->marketBidCost * mod; | ||
} | ||
} // namespace Antares::Data |
131 changes: 131 additions & 0 deletions
131
src/libs/antares/study/parts/thermal/scenarized_cost_provider.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
* Copyright 2007-2024, RTE (https://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of Antares-Simulator, | ||
* Adequacy and Performance assessment for interconnected energy networks. | ||
* | ||
* Antares_Simulator is free software: you can redistribute it and/or modify | ||
* it under the terms of the Mozilla Public Licence 2.0 as published by | ||
* the Mozilla Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Antares_Simulator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Mozilla Public Licence 2.0 for more details. | ||
* | ||
* You should have received a copy of the Mozilla Public Licence 2.0 | ||
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
|
||
#include "antares/study/parts/thermal/cluster.h" | ||
|
||
namespace Antares::Data | ||
{ | ||
|
||
ScenarizedCostProvider::ScenarizedCostProvider(ThermalCluster* cluster): | ||
cluster(cluster) | ||
{ | ||
resizeCostTS(); | ||
ComputeMarketBidTS(); | ||
MarginalCostEqualsMarketBid(); | ||
ComputeProductionCostTS(); | ||
} | ||
|
||
void ScenarizedCostProvider::ComputeProductionCostTS() | ||
{ | ||
if (cluster->modulation.width == 0) | ||
{ | ||
return; | ||
} | ||
|
||
for (auto& timeSeries: costsTimeSeries) | ||
{ | ||
auto& productionCostTS = timeSeries.productionCostTs; | ||
auto& marginalCostTS = timeSeries.marginalCostTS; | ||
|
||
for (uint hour = 0; hour < HOURS_PER_YEAR; ++hour) | ||
{ | ||
double hourlyModulation = cluster->modulation[Data::thermalModulationCost][hour]; | ||
productionCostTS[hour] = marginalCostTS[hour] * hourlyModulation; | ||
} | ||
} | ||
} | ||
|
||
void ScenarizedCostProvider::resizeCostTS() | ||
{ | ||
const uint fuelCostWidth = cluster->ecoInput.fuelcost.width; | ||
const uint co2CostWidth = cluster->ecoInput.co2cost.width; | ||
const uint tsCount = std::max(fuelCostWidth, co2CostWidth); | ||
|
||
costsTimeSeries.resize(tsCount, CostsTimeSeries()); | ||
} | ||
|
||
void ScenarizedCostProvider::MarginalCostEqualsMarketBid() | ||
{ | ||
for (auto& timeSeries: costsTimeSeries) | ||
{ | ||
auto& source = timeSeries.marketBidCostTS; | ||
auto& destination = timeSeries.marginalCostTS; | ||
std::copy(source.begin(), source.end(), destination.begin()); | ||
} | ||
} | ||
|
||
double computeMarketBidCost(double fuelCost, | ||
double fuelEfficiency, | ||
double co2EmissionFactor, | ||
double co2cost, | ||
double variableomcost) | ||
{ | ||
return fuelCost * 360.0 / fuelEfficiency + co2EmissionFactor * co2cost + variableomcost; | ||
} | ||
|
||
void ScenarizedCostProvider::ComputeMarketBidTS() | ||
{ | ||
const uint fuelCostWidth = cluster->ecoInput.fuelcost.width; | ||
const uint co2CostWidth = cluster->ecoInput.co2cost.width; | ||
|
||
double co2EmissionFactor = cluster->emissions.factors[Pollutant::CO2]; | ||
|
||
for (uint tsIndex = 0; tsIndex < costsTimeSeries.size(); ++tsIndex) | ||
{ | ||
uint tsIndexFuel = std::min(fuelCostWidth - 1, tsIndex); | ||
uint tsIndexCo2 = std::min(co2CostWidth - 1, tsIndex); | ||
for (uint hour = 0; hour < HOURS_PER_YEAR; ++hour) | ||
{ | ||
double fuelcost = cluster->ecoInput.fuelcost[tsIndexFuel][hour]; | ||
double co2cost = cluster->ecoInput.co2cost[tsIndexCo2][hour]; | ||
|
||
costsTimeSeries[tsIndex].marketBidCostTS[hour] = computeMarketBidCost( | ||
fuelcost, | ||
cluster->fuelEfficiency, | ||
co2EmissionFactor, | ||
co2cost, | ||
cluster->variableomcost); | ||
} | ||
} | ||
} | ||
|
||
double ScenarizedCostProvider::getOperatingCost(uint serieIndex, uint hourInTheYear) const | ||
{ | ||
const uint tsIndex = std::min(serieIndex, (uint)costsTimeSeries.size() - 1); | ||
return costsTimeSeries[tsIndex].productionCostTs[hourInTheYear]; | ||
} | ||
|
||
double ScenarizedCostProvider::getMarginalCost(uint serieIndex, uint hourInTheYear) const | ||
{ | ||
const double mod = cluster->modulation[thermalModulationMarketBid][hourInTheYear]; | ||
const uint tsIndex = std::min(serieIndex, (uint)costsTimeSeries.size() - 1); | ||
return costsTimeSeries[tsIndex].marginalCostTS[hourInTheYear] * mod; | ||
} | ||
|
||
double ScenarizedCostProvider::getMarketBidCost(uint hourInTheYear, uint year) const | ||
{ | ||
const double mod = cluster->modulation[thermalModulationMarketBid][hourInTheYear]; | ||
const uint serieIndex = cluster->series.getSeriesIndex(year); | ||
const uint tsIndex = std::min(serieIndex, (uint)costsTimeSeries.size() - 1); | ||
return costsTimeSeries[tsIndex].marketBidCostTS[hourInTheYear] * mod; | ||
} | ||
|
||
} // namespace Antares::Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters