Skip to content

Commit

Permalink
Use 50% as a default value for ST-storage property initiallevel (#1632)
Browse files Browse the repository at this point in the history
* Use 0 as a default value for ST-storage property initiallevel

* Use 50% for default values, add logs

* Document default value
  • Loading branch information
flomnes authored Sep 27, 2023
1 parent 5874f2d commit 62f6abe
Showing 6 changed files with 21 additions and 23 deletions.
5 changes: 5 additions & 0 deletions docs/reference-guide/13-file-format.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Study format changes
This is a list of all recent changes that came with new Antares Simulator features. The main goal of this document is to lower the costs of changing existing interfaces, both GUI and scripts.
## v8.7.1
### Input
### Short-term storage
If no value is specified for `initiallevel`, then a default value of 50% is used. Note that this value is used only if `initialleveloptim=false`, and that `false` is the default value for `initialleveloptim`.

## v8.7.0
### Input
#### Scenarized RHS for binding constraints
27 changes: 8 additions & 19 deletions src/libs/antares/study/parts/short-term-storage/properties.cpp
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ bool Properties::loadKey(const IniFile::Property* p)
return p->value.to<std::string>(this->name);

if (p->key == "initiallevel")
return valueForOptional(this->initialLevel);
return p->value.to<double>(this->initialLevel);

if (p->key == "initialleveloptim")
return p->value.to<bool>(this->initialLevelOptim);
@@ -206,29 +206,18 @@ bool Properties::validate()
efficiencyFactor = 1;
}

// reset initialLevel value to show we're optimising it
if (initialLevelOptim)
if (initialLevel < 0)
{
logs.info() << "Optimizing initial level";
initialLevel.reset();
}
initialLevel = initiallevelDefault;
logs.warning() << "initiallevel for cluster: " << name << " should be positive, value has been set to " << initialLevel;

if (!initialLevelOptim && !initialLevel.has_value())
logs.error() << "Initial level not optimized and no value provided, aborting";
}

if (initialLevel.has_value())
if (initialLevel > 1)
{
if (initialLevel < 0)
{
logs.warning() << "initiallevel for cluster: " << name << " should be positive";
initialLevel = 0;
}
initialLevel = initiallevelDefault;
logs.warning() << "initiallevel for cluster: " << name << " should be inferior to 1, value has been set to " << initialLevel;

if (initialLevel > 1)
{
logs.warning() << "initiallevel for cluster: " << name << " should be inferior to 1";
initialLevel = 1;
}
}

return true;
4 changes: 3 additions & 1 deletion src/libs/antares/study/parts/short-term-storage/properties.h
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ class Properties
// Not optional Reservoir capacity in MWh, >= 0
std::optional<double> reservoirCapacity;
// Initial level, <= 1
std::optional<double> initialLevel;
double initialLevel = initiallevelDefault;
// Bool to optimise or not initial level
bool initialLevelOptim = false;
// Efficiency factor between 0 and 1
@@ -74,5 +74,7 @@ class Properties
std::string name;

static const std::map<std::string, enum Group> ST_STORAGE_PROPERTY_GROUP_ENUM;
private:
static constexpr double initiallevelDefault = .5;
};
} // namespace Antares::Data::ShortTermStorage
Original file line number Diff line number Diff line change
@@ -190,10 +190,10 @@ static void setBoundsForShortTermStorage(PROBLEME_HEBDO* problemeHebdo,
// 3. Levels
int varLevel = CorrespondanceVarNativesVarOptim.SIM_ShortTermStorage
.LevelVariable[clusterGlobalIndex];
if (pdtHebdo == DernierPdtDeLIntervalle - 1 && storage.initialLevel.has_value())
if (pdtHebdo == DernierPdtDeLIntervalle - 1 && !storage.initialLevelOptim)
{
Xmin[varLevel] = Xmax[varLevel]
= storage.reservoirCapacity * storage.initialLevel.value();
= storage.reservoirCapacity * storage.initialLevel;
}
else
{
1 change: 1 addition & 0 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ static void importShortTermStorages(
toInsert.injectionNominalCapacity = st->properties.injectionNominalCapacity.value();
toInsert.withdrawalNominalCapacity = st->properties.withdrawalNominalCapacity.value();
toInsert.initialLevel = st->properties.initialLevel;
toInsert.initialLevelOptim = st->properties.initialLevelOptim;
toInsert.name = st->properties.name;

toInsert.series = st->series;
3 changes: 2 additions & 1 deletion src/solver/simulation/sim_structure_probleme_economique.h
Original file line number Diff line number Diff line change
@@ -173,7 +173,8 @@ struct PROPERTIES
double injectionNominalCapacity;
double withdrawalNominalCapacity;
double efficiency;
std::optional<double> initialLevel;
double initialLevel;
bool initialLevelOptim;

std::shared_ptr<Antares::Data::ShortTermStorage::Series> series;

0 comments on commit 62f6abe

Please sign in to comment.