Skip to content

Commit

Permalink
Merge branch 'develop' into feature/pmax-setting
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin authored Dec 5, 2024
2 parents 26cd32e + a276477 commit 2cf25ab
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 15 deletions.
9 changes: 4 additions & 5 deletions src/libs/antares/study/parts/thermal/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ void ThermalCluster::ComputeProductionCostTS()

for (uint hour = 0; hour < HOURS_PER_YEAR; ++hour)
{
double& houtlyModulation = modulation[Data::thermalModulationCost][hour];
productionCostTS[hour] = marginalCostTS[hour] * houtlyModulation;
double hourlyModulation = modulation[Data::thermalModulationCost][hour];
productionCostTS[hour] = marginalCostTS[hour] * hourlyModulation;
}
}
}
Expand Down Expand Up @@ -748,16 +748,15 @@ double ThermalCluster::getMarginalCost(uint serieIndex, uint hourInTheYear) cons

double ThermalCluster::getMarketBidCost(uint hourInTheYear, uint year) const
{
uint serieIndex = series.getSeriesIndex(year);

double mod = modulation[thermalModulationMarketBid][serieIndex];
const double mod = modulation[thermalModulationMarketBid][hourInTheYear];

if (costgeneration == Data::setManually)
{
return marketBidCost * mod;
}
else
{
const uint serieIndex = series.getSeriesIndex(year);
const uint tsIndex = std::min(serieIndex, (uint)costsTimeSeries.size() - 1);
return costsTimeSeries[tsIndex].marketBidCostTS[hourInTheYear] * mod;
}
Expand Down
20 changes: 12 additions & 8 deletions src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
void OPT_InitialiserLesCoutsLineaireCoutsDeDemarrage(PROBLEME_HEBDO*, const int, const int);

static void shortTermStorageCost(
int weekInTheYear,
int PremierPdtDeLIntervalle,
int DernierPdtDeLIntervalle,
int NombreDePays,
const std::vector<::ShortTermStorage::AREA_INPUT>& shortTermStorageInput,
VariableManagement::VariableManager& variableManager,
std::vector<double>& linearCost)
{
const int weekFirstHour = weekInTheYear * 168;
for (int pays = 0; pays < NombreDePays; ++pays)
{
for (const auto& storage: shortTermStorageInput[pays])
Expand All @@ -41,45 +43,46 @@ static void shortTermStorageCost(
pdtHebdo < DernierPdtDeLIntervalle;
pdtHebdo++, pdtJour++)
{
int hourInTheYear = weekFirstHour + pdtHebdo;
const int clusterGlobalIndex = storage.clusterGlobalIndex;
if (const int varLevel = variableManager.ShortTermStorageLevel(clusterGlobalIndex,
pdtJour);
varLevel >= 0)
{
linearCost[varLevel] = storage.series->costLevel[pdtHebdo];
linearCost[varLevel] = storage.series->costLevel[hourInTheYear];
}

if (const int varInjection = variableManager.ShortTermStorageInjection(
clusterGlobalIndex,
pdtJour);
varInjection >= 0)
{
linearCost[varInjection] = storage.series->costInjection[pdtHebdo];
linearCost[varInjection] = storage.series->costInjection[hourInTheYear];
}

if (const int varWithdrawal = variableManager.ShortTermStorageWithdrawal(
clusterGlobalIndex,
pdtJour);
varWithdrawal >= 0)
{
linearCost[varWithdrawal] = storage.series->costWithdrawal[pdtHebdo];
linearCost[varWithdrawal] = storage.series->costWithdrawal[hourInTheYear];
}
if (const int varCostVariationInjection = variableManager
.ShortTermStorageCostVariationInjection(
clusterGlobalIndex,
pdtJour);
storage.penalizeVariationInjection && varCostVariationInjection >= 0)
{
linearCost[varCostVariationInjection] = storage.series
->costVariationInjection[pdtHebdo];
linearCost[varCostVariationInjection] = storage.series->costVariationInjection
[hourInTheYear];
}
if (const int varCostVariationWithdrawal
= variableManager.ShortTermStorageCostVariationWithdrawal(clusterGlobalIndex,
pdtJour);
storage.penalizeVariationWithdrawal && varCostVariationWithdrawal >= 0)
{
linearCost[varCostVariationWithdrawal] = storage.series
->costVariationWithdrawal[pdtHebdo];
linearCost[varCostVariationWithdrawal] = storage.series->costVariationWithdrawal
[hourInTheYear];
}
}
}
Expand All @@ -97,7 +100,8 @@ void OPT_InitialiserLesCoutsLineaire(PROBLEME_HEBDO* problemeHebdo,
ProblemeAResoudre->CoutQuadratique.assign(ProblemeAResoudre->NombreDeVariables, 0.);
auto variableManager = VariableManagerFromProblemHebdo(problemeHebdo);

shortTermStorageCost(PremierPdtDeLIntervalle,
shortTermStorageCost(problemeHebdo->weekInTheYear,
PremierPdtDeLIntervalle,
DernierPdtDeLIntervalle,
problemeHebdo->NombreDePays,
problemeHebdo->ShortTermStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,27 @@ BOOST_FIXTURE_TEST_CASE(computeMarketBidCost, FixtureFull)

BOOST_CHECK_CLOSE(cluster->computeMarketBidCost(1, 2, 1), 24.12, 0.001);
}

BOOST_AUTO_TEST_CASE(non_constant_marketbid_modulation)
{
Area area;
ThermalCluster cluster(&area);
cluster.costgeneration = setManually;
cluster.marketBidCost = 120;

auto& mod = cluster.modulation;
mod.resize(thermalModulationMax, HOURS_PER_YEAR);
mod.fill(1.);

{
mod[thermalModulationMarketBid][0] = .5;
BOOST_CHECK_EQUAL(cluster.getMarketBidCost(0, 0), .5 * 120);
}

{
mod[thermalModulationMarketBid][1] = .8;
BOOST_CHECK_EQUAL(cluster.getMarketBidCost(1, 0), .8 * 120);
}
}

BOOST_AUTO_TEST_SUITE_END()
5 changes: 4 additions & 1 deletion src/ui/simulator/application/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,10 @@ void RunSimulationOnTheStudy(Data::Study::Ptr study,
cmd << " --parallel";

// add solver name for ortools
cmd << " --solver=" << solverName;
if (!solverName.empty())
{
cmd << " --solver=" << solverName;
}

// Go go go !
logs.debug() << "running " << cmd;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/simulator/windows/simulation/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Run::Run(wxWindow* parent, bool preproOnly) :
pTitleOrtoolsSolverCombox
= Antares::Component::CreateLabel(pBigDaddy, wxT("Ortools solver : "));

pOrtoolsSolverCombox = new wxComboBox(pBigDaddy, wxID_ANY);
pOrtoolsSolverCombox = new wxComboBox(pBigDaddy, wxID_ANY, "sirius");
std::list<std::string> solverList = getAvailableOrtoolsSolverName();
for (const std::string& solverName : solverList)
{
Expand Down

0 comments on commit 2cf25ab

Please sign in to comment.