Skip to content

Commit

Permalink
Add cluster name for 6 constraints associated to unit-commitment = ac…
Browse files Browse the repository at this point in the history
…curate (#1426)

* Move SetThermalClusterVariableName to generic class Namer

* Add thermal cluster name to 5 constraints
  • Loading branch information
flomnes authored Jul 13, 2023
1 parent 4d551bf commit 7c7fea2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
if (nombreDeTermes > 0)
{
constraintNamer.PMaxDispatchableGeneration(
ProblemeAResoudre->NombreDeContraintes);
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '<');
}
Expand Down Expand Up @@ -162,7 +163,8 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
if (nombreDeTermes > 0)
{
constraintNamer.PMinDispatchableGeneration(
ProblemeAResoudre->NombreDeContraintes);
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '>');
}
Expand Down Expand Up @@ -261,7 +263,9 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
{
if (nombreDeTermes > 0)
{
constraintNamer.ConsistenceNODU(ProblemeAResoudre->NombreDeContraintes);
constraintNamer.ConsistenceNODU(
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '=');
}
Expand Down Expand Up @@ -330,7 +334,8 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
if (nombreDeTermes > 0)
{
constraintNamer.NbUnitsOutageLessThanNbUnitsStop(
ProblemeAResoudre->NombreDeContraintes);
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '<');
}
Expand Down Expand Up @@ -430,7 +435,8 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
= ProblemeAResoudre->NombreDeContraintes;

constraintNamer.NbDispUnitsMinBoundSinceMinUpTime(
ProblemeAResoudre->NombreDeContraintes);
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '>');
}
Expand Down Expand Up @@ -514,7 +520,9 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
.NumeroDeContrainteDesContraintesDeDureeMinDArret[palier]
= ProblemeAResoudre->NombreDeContraintes;

constraintNamer.MinDownTime(ProblemeAResoudre->NombreDeContraintes);
constraintNamer.MinDownTime(
ProblemeAResoudre->NombreDeContraintes,
PaliersThermiquesDuPays.NomsDesPaliersThermiques[palier]);
OPT_ChargerLaContrainteDansLaMatriceDesContraintes(
ProblemeAResoudre, Pi, Colonne, nombreDeTermes, '<');
}
Expand Down
69 changes: 37 additions & 32 deletions src/solver/optimisation/opt_rename_problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,32 @@ std::string BuildName(const std::string& name,
return result;
}

void Namer::SetLinkElementName(unsigned int variable, const std::string& variableType)
void Namer::SetLinkElementName(unsigned int element, const std::string& elementType)
{
const auto location = origin_ + AREA_SEP + destination_;
targetUpdater_.UpdateTargetAtIndex(
BuildName(variableType, LocationIdentifier(location, LINK), TimeIdentifier(timeStep_, HOUR)),
variable);
BuildName(elementType, LocationIdentifier(location, LINK), TimeIdentifier(timeStep_, HOUR)),
element);
}

void Namer::SetAreaElementNameHour(unsigned int variable, const std::string& variableType)
void Namer::SetAreaElementNameHour(unsigned int element, const std::string& elementType)
{
SetAreaElementName(variable, variableType, HOUR);
SetAreaElementName(element, elementType, HOUR);
}
void Namer::SetAreaElementNameWeek(unsigned int variable, const std::string& variableType)

void Namer::SetAreaElementNameWeek(unsigned int element, const std::string& elementType)
{
SetAreaElementName(variable, variableType, WEEK);
SetAreaElementName(element, elementType, WEEK);
}

void Namer::SetAreaElementName(unsigned int variable,
const std::string& variableType,
void Namer::SetAreaElementName(unsigned int element,
const std::string& elementType,
const std::string& timeStepType)
{
targetUpdater_.UpdateTargetAtIndex(
BuildName(
variableType, LocationIdentifier(area_, AREA), TimeIdentifier(timeStep_, timeStepType)),
variable);
elementType, LocationIdentifier(area_, AREA), TimeIdentifier(timeStep_, timeStepType)),
element);
}

void VariableNamer::SetAreaVariableName(unsigned int variable,
Expand All @@ -56,43 +57,43 @@ void VariableNamer::SetAreaVariableName(unsigned int variable,
variable);
}

void VariableNamer::SetThermalClusterVariableName(unsigned int variable,
const std::string& variableType,
const std::string& clusterName)
void Namer::SetThermalClusterElementName(unsigned int variable,
const std::string& elementType,
const std::string& clusterName)
{
const auto location
= LocationIdentifier(area_, AREA) + SEPARATOR + "ThermalCluster" + "<" + clusterName + ">";

targetUpdater_.UpdateTargetAtIndex(
BuildName(variableType, location, TimeIdentifier(timeStep_, HOUR)), variable);
BuildName(elementType, location, TimeIdentifier(timeStep_, HOUR)), variable);
}

void VariableNamer::DispatchableProduction(unsigned int variable, const std::string& clusterName)
{
SetThermalClusterVariableName(variable, "DispatchableProduction", clusterName);
SetThermalClusterElementName(variable, "DispatchableProduction", clusterName);
}

void VariableNamer::NODU(unsigned int variable, const std::string& clusterName)
{
SetThermalClusterVariableName(variable, "NODU", clusterName);
SetThermalClusterElementName(variable, "NODU", clusterName);
}

void VariableNamer::NumberStoppingDispatchableUnits(unsigned int variable,
const std::string& clusterName)
{
SetThermalClusterVariableName(variable, "NumberStoppingDispatchableUnits", clusterName);
SetThermalClusterElementName(variable, "NumberStoppingDispatchableUnits", clusterName);
}

void VariableNamer::NumberStartingDispatchableUnits(unsigned int variable,
const std::string& clusterName)
{
SetThermalClusterVariableName(variable, "NumberStartingDispatchableUnits", clusterName);
SetThermalClusterElementName(variable, "NumberStartingDispatchableUnits", clusterName);
}

void VariableNamer::NumberBreakingDownDispatchableUnits(unsigned int variable,
const std::string& clusterName)
{
SetThermalClusterVariableName(variable, "NumberBreakingDownDispatchableUnits", clusterName);
SetThermalClusterElementName(variable, "NumberBreakingDownDispatchableUnits", clusterName);
}

void VariableNamer::NTCDirect(unsigned int variable,
Expand Down Expand Up @@ -283,34 +284,38 @@ void ConstraintNamer::nameWithTimeGranularity(unsigned int constraint,
constraint);
}

void ConstraintNamer::NbUnitsOutageLessThanNbUnitsStop(unsigned int constraint)
void ConstraintNamer::NbUnitsOutageLessThanNbUnitsStop(unsigned int constraint,
const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "NbUnitsOutageLessThanNbUnitsStop");
SetThermalClusterElementName(constraint, "NbUnitsOutageLessThanNbUnitsStop", clusterName);
}

void ConstraintNamer::NbDispUnitsMinBoundSinceMinUpTime(unsigned int constraint)
void ConstraintNamer::NbDispUnitsMinBoundSinceMinUpTime(unsigned int constraint,
const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "NbDispUnitsMinBoundSinceMinUpTime");
SetThermalClusterElementName(constraint, "NbDispUnitsMinBoundSinceMinUpTime", clusterName);
}

void ConstraintNamer::MinDownTime(unsigned int constraint)
void ConstraintNamer::MinDownTime(unsigned int constraint, const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "MinDownTime");
SetThermalClusterElementName(constraint, "MinDownTime", clusterName);
}

void ConstraintNamer::PMaxDispatchableGeneration(unsigned int constraint)
void ConstraintNamer::PMaxDispatchableGeneration(unsigned int constraint,
const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "PMaxDispatchableGeneration");
SetThermalClusterElementName(constraint, "PMaxDispatchableGeneration", clusterName);
}

void ConstraintNamer::PMinDispatchableGeneration(unsigned int constraint)
void ConstraintNamer::PMinDispatchableGeneration(unsigned int constraint,
const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "PMinDispatchableGeneration");
SetThermalClusterElementName(constraint, "PMinDispatchableGeneration", clusterName);
}

void ConstraintNamer::ConsistenceNODU(unsigned int constraint)
void ConstraintNamer::ConsistenceNODU(unsigned int constraint, const std::string& clusterName)
{
SetAreaElementNameHour(constraint, "ConsistenceNODU");
SetThermalClusterElementName(constraint, "ConsistenceNODU", clusterName);
}

void ConstraintNamer::ShortTermStorageLevel(unsigned int constraint, const std::string& name)
Expand Down
29 changes: 14 additions & 15 deletions src/solver/optimisation/opt_rename_problem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class TargetVectorUpdater
{
public:
TargetVectorUpdater(bool isRenamingProcessed, std::vector<std::string>& target) :
target_(target), isRenamingProcessed_(isRenamingProcessed)
target_(target), isRenamingProcessed_(isRenamingProcessed)
{
}

void UpdateTargetAtIndex(const std::string& full_name, unsigned int index)
{
if (isRenamingProcessed_)
{
target_[index] = full_name;
}
if (isRenamingProcessed_)
{
target_[index] = full_name;
}
}

private:
Expand Down Expand Up @@ -49,6 +49,9 @@ class Namer
void SetAreaElementName(unsigned int variable,
const std::string& variableType,
const std::string& timeStepType);
void SetThermalClusterElementName(unsigned int variable,
const std::string& variableType,
const std::string& clusterName);

unsigned int timeStep_ = 0;
std::string origin_;
Expand Down Expand Up @@ -91,10 +94,6 @@ class VariableNamer : public Namer
void AreaBalance(unsigned int variable);

private:
void SetThermalClusterVariableName(unsigned int variable,
const std::string& variableType,
const std::string& clusterName);

void SetAreaVariableName(unsigned int variable,
const std::string& variableType,
int layerIndex);
Expand Down Expand Up @@ -123,12 +122,12 @@ class ConstraintNamer : public Namer
void AreaHydroLevel(unsigned int constraint);
void FinalStockEquivalent(unsigned int constraint);
void FinalStockExpression(unsigned int constraint);
void NbUnitsOutageLessThanNbUnitsStop(unsigned int constraint);
void NbDispUnitsMinBoundSinceMinUpTime(unsigned int constraint);
void MinDownTime(unsigned int constraint);
void PMaxDispatchableGeneration(unsigned int constraint);
void PMinDispatchableGeneration(unsigned int constraint);
void ConsistenceNODU(unsigned int constraint);
void NbUnitsOutageLessThanNbUnitsStop(unsigned int constraint, const std::string& clusterName);
void NbDispUnitsMinBoundSinceMinUpTime(unsigned int constraint, const std::string& clusterName);
void MinDownTime(unsigned int constraint, const std::string& clusterName);
void PMaxDispatchableGeneration(unsigned int constraint, const std::string& clusterName);
void PMinDispatchableGeneration(unsigned int constraint, const std::string& clusterName);
void ConsistenceNODU(unsigned int constraint, const std::string& clusterName);
void ShortTermStorageLevel(unsigned int constraint, const std::string& name);
void BindingConstraintHour(unsigned int constraint, const std::string& name);
void BindingConstraintDay(unsigned int constraint, const std::string& name);
Expand Down

0 comments on commit 7c7fea2

Please sign in to comment.