-
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.
- Loading branch information
Showing
13 changed files
with
199 additions
and
2 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
94 changes: 94 additions & 0 deletions
94
src/solver/optimisation/constraints/ShortTermStorageCumulation.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,94 @@ | ||
/* | ||
* 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 "antares/solver/optimisation/constraints/ShortTermStorageCumulation.h" | ||
|
||
void ShortTermStorageCumulation::Injection(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input | ||
){ | ||
builder.ShortTermStorageInjection(index, 1.0); | ||
} | ||
void ShortTermStorageCumulation::Withdrawal(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input | ||
){ | ||
builder.ShortTermStorageWithdrawal(index, 1.0);} | ||
void ShortTermStorageCumulation::Netting(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input){ | ||
|
||
|
||
builder.ShortTermStorageInjection(index, input.injectionEfficiency ). | ||
ShortTermStorageWithdrawal(index, -input.withdrawalEfficiency); | ||
} | ||
auto getMemberFunction = [](const std::string& name) | ||
-> void (ShortTermStorageCumulation::*)(unsigned int, | ||
const ::ShortTermStorage::PROPERTIES& ) { | ||
if (name == "withdrawal") { | ||
return &ShortTermStorageCumulation::Withdrawal; | ||
} else if (name == "injection") { | ||
return &ShortTermStorageCumulation::Injection; | ||
} | ||
else if (name == "netting"){ | ||
return &ShortTermStorageCumulation::Netting; | ||
} | ||
return nullptr; // Return null if no match | ||
}; | ||
|
||
|
||
char ConvertSign(const std::string& sign){ | ||
if (sign == "greater") { | ||
return '>'; | ||
} | ||
else if (sign == "less") { | ||
return '<'; | ||
} | ||
else { | ||
return '='; | ||
} | ||
} | ||
|
||
void ShortTermStorageCumulation::add(int pays){ | ||
|
||
ConstraintNamer namer(builder.data.NomDesContraintes); | ||
namer.UpdateArea(builder.data.NomsDesPays[pays]); | ||
|
||
for (const auto& storage: data.ShortTermStorage[pays]) | ||
{ | ||
for(const auto& constraint: storage.additional_constraints){ | ||
|
||
//sum (var[h]) sign rhs, h in list provied by user | ||
|
||
namer.ShortTermStorageLevel(builder.data.nombreDeContraintes, storage.name); | ||
const auto index = storage.clusterGlobalIndex; | ||
//TODO | ||
data.CorrespondanceCntNativesCntOptimHebdomadaires.ShortTermStorageCumulation[index] | ||
= builder.data.nombreDeContraintes; | ||
auto memberFunction = getMemberFunction(constraint.variable); | ||
for (const auto& hour: constraint.hours){ | ||
const int hourInTheYear = builder.data.weekInTheYear * 168 + hour-1; | ||
builder.updateHourWithinWeek(hour-1); | ||
(this->*memberFunction)(index, storage); | ||
builder.SetOperator(ConvertSign(constraint.operatorType)) | ||
.build(); | ||
} | ||
} | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
...optimisation/include/antares/solver/optimisation/constraints/ShortTermStorageCumulation.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,44 @@ | ||
/* | ||
* 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 "ConstraintBuilder.h" | ||
|
||
class ShortTermStorageCumulation: private ConstraintFactory | ||
{ | ||
public: | ||
ShortTermStorageCumulation(ConstraintBuilder& builder, ShortTermStorageCumulativeConstraintData& data): | ||
ConstraintFactory(builder), | ||
data(data) | ||
{ | ||
} | ||
|
||
void add(int pays); | ||
void Injection(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input); | ||
void Withdrawal(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input); | ||
void Netting(unsigned int index, | ||
const ::ShortTermStorage::PROPERTIES& input); | ||
|
||
private: | ||
ShortTermStorageCumulativeConstraintData& data; | ||
}; |
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