-
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.
Adding the first constraint (16bis) and counting the number of reserv…
…ation constraints in the problem
- Loading branch information
Showing
27 changed files
with
578 additions
and
5 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
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
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
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,40 @@ | ||
#include "antares/solver/optimisation/constraints/PMaxReserve.h" | ||
|
||
void PMaxReserve::add(int pays, int reserve, int cluster, int pdt, bool isUpReserve) | ||
{ | ||
if (!data.Simulation) | ||
{ | ||
// 16 bis | ||
// constraint : P - M * B <= 0 | ||
|
||
CAPACITY_RESERVATION capacityReservation | ||
= isUpReserve | ||
? data.areaReserves.thermalAreaReserves[pays].areaCapacityReservationsUp[reserve] | ||
: data.areaReserves.thermalAreaReserves[pays].areaCapacityReservationsDown[reserve]; | ||
|
||
RESERVE_PARTICIPATION reserveParticipation | ||
= capacityReservation.AllReservesParticipation[cluster]; | ||
|
||
builder.updateHourWithinWeek(pdt) | ||
.DispatchableProduction(cluster, 1.0) | ||
.NumberOfDispatchableUnits(cluster, -reserveParticipation.maxPower) | ||
.lessThan(); | ||
|
||
if (builder.NumberOfVariables() > 0) | ||
{ | ||
ConstraintNamer namer(builder.data.NomDesContraintes); | ||
const int hourInTheYear = builder.data.weekInTheYear * 168 + pdt; | ||
namer.UpdateTimeStep(hourInTheYear); | ||
namer.UpdateArea(builder.data.NomsDesPays[pays]); | ||
namer.PMaxReserve(builder.data.nombreDeContraintes, | ||
reserveParticipation.clusterName, | ||
capacityReservation.reserveName); | ||
} | ||
builder.build(); | ||
} | ||
else | ||
{ | ||
builder.data.NbTermesContraintesPourLesReserves += 1; | ||
builder.data.nombreDeContraintes++; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/solver/optimisation/constraints/ReserveParticipationGroup.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,80 @@ | ||
/* | ||
** 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/solver/optimisation/constraints/ReserveParticipationGroup.h" | ||
|
||
PMaxReserveData ReserveParticipationGroup::GetPMaxReserveDataFromProblemHebdo() | ||
{ | ||
return {.Simulation = simulation_, .areaReserves = problemeHebdo_->allReserves}; | ||
} | ||
|
||
/** | ||
* @brief build MinDownTime constraints with | ||
* respect to default order | ||
*/ | ||
void ReserveParticipationGroup::BuildConstraints() | ||
{ | ||
auto data = GetPMaxReserveDataFromProblemHebdo(); | ||
PMaxReserve pMaxReserve(builder_, data); | ||
|
||
for (int pdt = 0; pdt < problemeHebdo_->NombreDePasDeTempsPourUneOptimisation; pdt++) | ||
{ | ||
// Adding constraints for ReservesUp and ReservesDown | ||
for (uint32_t pays = 0; pays < problemeHebdo_->NombreDePays; pays++) | ||
{ | ||
auto areaReservesUp | ||
= data.areaReserves.thermalAreaReserves[pays].areaCapacityReservationsUp; | ||
uint32_t reserve = 0; | ||
for (const auto& areaReserveUp : areaReservesUp) | ||
{ | ||
uint32_t cluster = 0; | ||
for (const auto& clusterReserveParticipation : | ||
areaReserveUp.AllReservesParticipation) | ||
{ | ||
if (clusterReserveParticipation.maxPower >= 0) | ||
{ | ||
pMaxReserve.add(pays, reserve, cluster, pdt, true); | ||
} | ||
cluster++; | ||
} | ||
reserve++; | ||
} | ||
|
||
auto areaReservesDown | ||
= data.areaReserves.thermalAreaReserves[pays].areaCapacityReservationsDown; | ||
reserve = 0; | ||
for (const auto& areaReserveDown : areaReservesDown) | ||
{ | ||
uint32_t cluster = 0; | ||
for (const auto& clusterReserveParticipation : | ||
areaReserveDown.AllReservesParticipation) | ||
{ | ||
if (clusterReserveParticipation.maxPower >= 0) | ||
{ | ||
pMaxReserve.add(pays, reserve, cluster, pdt, false); | ||
} | ||
cluster++; | ||
} | ||
reserve++; | ||
} | ||
} | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/solver/optimisation/include/antares/solver/optimisation/constraints/PMaxReserve.h
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,33 @@ | ||
#pragma once | ||
#include "ConstraintBuilder.h" | ||
|
||
struct PMaxReserveData | ||
{ | ||
bool Simulation; | ||
ALL_AREA_RESERVES& areaReserves; | ||
}; | ||
|
||
/*! | ||
* represent 'ReserveParticipation' Constraint type | ||
*/ | ||
class PMaxReserve : private ConstraintFactory | ||
{ | ||
public: | ||
PMaxReserve(ConstraintBuilder& builder, PMaxReserveData& data) : | ||
ConstraintFactory(builder), data(data) | ||
{ | ||
} | ||
|
||
/*! | ||
* @brief Add variables to the constraint and update constraints Matrix | ||
* @param pays : area | ||
* @param reserve : capacity reservation | ||
* @param isUpReserve : true if ReserveUp, false if ReserveDown | ||
* @param cluster : global index of the cluster | ||
* @param pdt : timestep | ||
*/ | ||
void add(int pays, int reserve, int cluster, int pdt, bool isUpReserve); | ||
|
||
private: | ||
PMaxReserveData& data; | ||
}; |
41 changes: 41 additions & 0 deletions
41
.../optimisation/include/antares/solver/optimisation/constraints/ReserveParticipationGroup.h
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,41 @@ | ||
/* | ||
* 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/>. | ||
*/ | ||
|
||
#pragma once | ||
#include "ConstraintGroup.h" | ||
#include "PMaxReserve.h" | ||
|
||
/** | ||
* @brief Group of MinDownTime constraints | ||
* | ||
*/ | ||
|
||
class ReserveParticipationGroup : public ConstraintGroup | ||
{ | ||
public: | ||
using ConstraintGroup::ConstraintGroup; | ||
|
||
void BuildConstraints() override; | ||
|
||
private: | ||
bool simulation_ = false; | ||
PMaxReserveData GetPMaxReserveDataFromProblemHebdo(); | ||
}; |
Oops, something went wrong.