-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first version of the implementation de reserve lot 3
- Loading branch information
Showing
21 changed files
with
858 additions
and
68 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
26 changes: 26 additions & 0 deletions
26
src/solver/optimisation/constraints/LTSockLevelReserveParticipation.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,26 @@ | ||
#pragma once | ||
#include "ConstraintBuilder.h" | ||
|
||
/* | ||
* represent 'LTPumpingCapacityThreasholds' Constraint type | ||
*/ | ||
class LTPumpingCapacityThreasholds : private ConstraintFactory | ||
{ | ||
public: | ||
LTPumpingCapacityThreasholds(ConstraintBuilder& builder, ReserveData& data) : | ||
ConstraintFactory(builder), data(data) | ||
{ | ||
} | ||
|
||
/*! | ||
* @brief Add variables to the constraint and update constraints Matrix | ||
* @param pays : area | ||
* @param cluster : global index of the cluster | ||
* @param pdt : timestep | ||
*/ | ||
void add(int pays, int cluster, int pdt); | ||
|
||
private: | ||
ReserveData& data; | ||
}; | ||
|
115 changes: 115 additions & 0 deletions
115
src/solver/optimisation/constraints/LTStockLevelReserveParticipation.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,115 @@ | ||
#include "antares/solver/optimisation/constraints/LTStockLevelReserveParticipation.h" | ||
|
||
void LTStockLevelReserveParticipation::add(int pays, int cluster, int pdt) | ||
{ | ||
int globalClusterIdx = data.longTermStorageOfArea[pays].GlobalHydroIndex; | ||
|
||
if (!data.Simulation) | ||
{ | ||
// 15 (r) (1) | ||
// Participation of down reserves requires a sufficient level of stock | ||
// R_t + Sum(P_{res,t_st} * R_{min,res}) <= R_up | ||
// R_t : stock level at time t | ||
// P_{res,t_st} : power participation for reserve down res at time t_st | ||
// R_{min,res} : max power participation ratio | ||
// R_up : max stock level | ||
{ | ||
builder.updateHourWithinWeek(pdt).HydroLevel(pays, 1.); | ||
|
||
for (const auto& capacityReservation : data.areaReserves[pays].areaCapacityReservationsDown) | ||
{ | ||
int t_max = pdt + capacityReservation.maxActivationDuration; | ||
if (t_max > builder.data.NombreDePasDeTempsPourUneOptimisation) | ||
t_max = builder.data.NombreDePasDeTempsPourUneOptimisation; | ||
|
||
for (int t=pdt; t < t_max; t++) | ||
{ | ||
builder.updateHourWithinWeek(t); | ||
for (const auto& reserveParticipations : capacityReservation.AllLTStorageReservesParticipation) | ||
{ | ||
builder.LTStorageClusterReserveDownParticipation( | ||
reserveParticipations.globalIndexClusterParticipation, | ||
capacityReservation.maxActivationRatio); | ||
} | ||
} | ||
} | ||
builder.lessThan(); | ||
data.CorrespondanceCntNativesCntOptim[pdt] | ||
.NumeroDeContrainteDesContraintesLTStockLevelReserveParticipationDown | ||
[globalClusterIdx] | ||
= builder.data.nombreDeContraintes; | ||
ConstraintNamer namer(builder.data.NomDesContraintes); | ||
const int hourInTheYear = builder.data.weekInTheYear * 168 + pdt; | ||
namer.UpdateTimeStep(hourInTheYear); | ||
namer.UpdateArea(builder.data.NomsDesPays[pays]); | ||
namer.LTStockLevelReserveParticipationDown(builder.data.nombreDeContraintes, | ||
"LongTermStorage"); | ||
builder.build(); | ||
} | ||
|
||
// 15 (r) (2) | ||
// Participation of up reserves requires a sufficient level of stock | ||
// R_t - Sum(P_{res,t_st} * R_{min,res}) >= R_down | ||
// R_t : stock level at time t | ||
// P_{res,t_st} : power participation for reserve up res at time t_st | ||
// R_{min,res} : max power participation ratio | ||
// R_down : min stock level | ||
{ | ||
builder.updateHourWithinWeek(pdt).HydroLevel(pays, 1.); | ||
|
||
for (const auto& capacityReservation : data.areaReserves[pays].areaCapacityReservationsUp) | ||
{ | ||
int t_max = pdt + capacityReservation.maxActivationDuration; | ||
if (t_max > builder.data.NombreDePasDeTempsPourUneOptimisation) | ||
t_max = builder.data.NombreDePasDeTempsPourUneOptimisation; | ||
|
||
for (int t=pdt; t < t_max; t++) | ||
{ | ||
builder.updateHourWithinWeek(t); | ||
for (const auto& reserveParticipations : capacityReservation.AllLTStorageReservesParticipation) | ||
{ | ||
builder.LTStorageClusterReserveUpParticipation( | ||
reserveParticipations.globalIndexClusterParticipation, | ||
-capacityReservation.maxActivationRatio); | ||
} | ||
} | ||
} | ||
builder.greaterThan(); | ||
data.CorrespondanceCntNativesCntOptim[pdt] | ||
.NumeroDeContrainteDesContraintesLTStockLevelReserveParticipationUp | ||
[globalClusterIdx] | ||
= builder.data.nombreDeContraintes; | ||
ConstraintNamer namer(builder.data.NomDesContraintes); | ||
const int hourInTheYear = builder.data.weekInTheYear * 168 + pdt; | ||
namer.UpdateTimeStep(hourInTheYear); | ||
namer.UpdateArea(builder.data.NomsDesPays[pays]); | ||
namer.LTStockLevelReserveParticipationUp(builder.data.nombreDeContraintes, | ||
"LongTermStorage"); | ||
builder.build(); | ||
} | ||
} | ||
else | ||
{ | ||
// Lambda that count the number of reserveParticipations | ||
auto countReservesParticipations = [](const std::vector<CAPACITY_RESERVATION>& reservations, int time, int time_max) | ||
{ | ||
int counter = 0; | ||
for (const auto& capacityReservation: reservations) | ||
{ | ||
int n_t = capacityReservation.maxActivationDuration; | ||
if (time + n_t > time_max) | ||
n_t = time_max - time; | ||
counter += capacityReservation.AllLTStorageReservesParticipation.size() * n_t; | ||
} | ||
return counter; | ||
}; | ||
|
||
int nbTermsUp = countReservesParticipations( | ||
data.areaReserves[pays].areaCapacityReservationsUp, pdt, builder.data.NombreDePasDeTempsPourUneOptimisation); | ||
int nbTermsDown = countReservesParticipations( | ||
data.areaReserves[pays].areaCapacityReservationsDown, pdt, builder.data.NombreDePasDeTempsPourUneOptimisation); | ||
|
||
builder.data.NbTermesContraintesPourLesReserves += (nbTermsUp + 1) + (nbTermsDown + 1); | ||
builder.data.nombreDeContraintes += 2; | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
src/solver/optimisation/constraints/STSockLevelReserveParticipation.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 @@ | ||
#pragma once |
Oops, something went wrong.