-
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.
Perform hydro checks prior to the simulation [ANT-1720] (#2132)
Co-authored-by: Florian Omnès <[email protected]> Co-authored-by: Florian OMNES <[email protected]> Co-authored-by: payetvin <[email protected]> Co-authored-by: Guillaume PIERRE <[email protected]> Co-authored-by: guilpier-code <[email protected]> Co-authored-by: Milos A <[email protected]> Co-authored-by: Milos <[email protected]> Co-authored-by: NikolaIlic <[email protected]>
- Loading branch information
1 parent
8dc4f18
commit a00b90a
Showing
29 changed files
with
1,013 additions
and
599 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
** 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/antares/fatal-error.h> | ||
#include <antares/application/ScenarioBuilderOwner.h> | ||
#include "antares/solver/simulation/apply-scenario.h" | ||
#include "antares/solver/simulation/timeseries-numbers.h" | ||
#include "antares/solver/ts-generator/generator.h" | ||
#include "antares/study/study.h" | ||
|
||
Antares::Solver::ScenarioBuilderOwner::ScenarioBuilderOwner(Data::Study& study): | ||
study_(study) | ||
{ | ||
} | ||
|
||
void Antares::Solver::ScenarioBuilderOwner::callScenarioBuilder() { | ||
TSGenerator::ResizeGeneratedTimeSeries(study_.areas, study_.parameters); | ||
|
||
// Sampled time-series Numbers | ||
// We will resize all matrix related to the time-series numbers | ||
// This operation can be done once since the number of years is constant | ||
// for a single simulation | ||
study_.resizeAllTimeseriesNumbers(1 + study_.runtime->rangeLimits.year[Data::rangeEnd]); | ||
if (not TimeSeriesNumbers::CheckNumberOfColumns(study_.areas)) | ||
{ | ||
throw FatalError( | ||
"Inconsistent number of time-series detected. Please check your input data."); | ||
} | ||
|
||
if (not TimeSeriesNumbers::Generate(study_)) | ||
{ | ||
throw FatalError("An unrecoverable error has occurred. Can not continue."); | ||
} | ||
if (study_.parameters.useCustomScenario) | ||
{ | ||
ApplyCustomScenario(study_); | ||
} | ||
} | ||
|
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
src/solver/application/include/antares/application/ScenarioBuilderOwner.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 | ||
|
||
namespace Antares | ||
{ | ||
namespace Data | ||
{ | ||
class Study; | ||
} | ||
|
||
namespace Solver | ||
{ | ||
|
||
class ScenarioBuilderOwner | ||
{ | ||
public: | ||
explicit ScenarioBuilderOwner(Antares::Data::Study& study); | ||
|
||
void callScenarioBuilder(); | ||
|
||
private: | ||
Antares::Data::Study& study_; | ||
}; | ||
} // namespace Solver | ||
} // namespace Antares |
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
62 changes: 62 additions & 0 deletions
62
src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.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,62 @@ | ||
/* | ||
** 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/study/area/area.h> | ||
#include "antares/date/date.h" | ||
#include "antares/solver/hydro/management/MinGenerationScaling.h" | ||
#include "antares/solver/hydro/management/PrepareInflows.h" | ||
#include "antares/study/study.h" | ||
namespace Antares | ||
{ | ||
|
||
class HydroInputsChecker | ||
{ | ||
public: | ||
explicit HydroInputsChecker(Antares::Data::Study& study); | ||
void Execute(uint year); | ||
|
||
private: | ||
Data::AreaList& areas_; | ||
const Data::Parameters& parameters_; | ||
const Date::Calendar& calendar_; | ||
Data::SimulationMode simulationMode_; | ||
const uint firstYear_; | ||
const uint endYear_; | ||
PrepareInflows prepareInflows_; | ||
MinGenerationScaling minGenerationScaling_; | ||
const Data::TimeSeries::TS& scenarioInitialHydroLevels_; | ||
const Data::TimeSeries::TS& scenarioFinalHydroLevels_; | ||
|
||
//! return false if checkGenerationPowerConsistency or checkMinGeneration returns false | ||
bool checkMonthlyMinGeneration(uint year, const Data::Area& area) const; | ||
//! check Yearly minimum generation is lower than available inflows | ||
bool checkYearlyMinGeneration(uint year, const Data::Area& area) const; | ||
//! check Weekly minimum generation is lower than available inflows | ||
bool checkWeeklyMinGeneration(uint year, const Data::Area& area) const; | ||
//! check Hourly minimum generation is lower than available inflows | ||
bool checkGenerationPowerConsistency(uint year) const; | ||
//! return false if checkGenerationPowerConsistency or checkMinGeneration returns false | ||
bool checksOnGenerationPowerBounds(uint year) const; | ||
//! check minimum generation is lower than available inflows | ||
bool checkMinGeneration(uint year) const; | ||
}; | ||
|
||
} // namespace Antares |
41 changes: 41 additions & 0 deletions
41
src/solver/hydro/include/antares/solver/hydro/management/MinGenerationScaling.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 <antares/study/area/area.h> | ||
#include "antares/date/date.h" | ||
|
||
namespace Antares | ||
{ | ||
|
||
//! Prepare minimum generation scaling for each area | ||
class MinGenerationScaling | ||
{ | ||
public: | ||
MinGenerationScaling(Data::AreaList& areas, const Date::Calendar& calendar); | ||
void Run(uint year); | ||
|
||
private: | ||
Data::AreaList& areas_; | ||
const Date::Calendar& calendar_; | ||
}; | ||
|
||
} // namespace Antares |
Oops, something went wrong.