Skip to content

Commit

Permalink
Merge branch 'develop' into feature/vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 authored Feb 10, 2025
2 parents 5dea169 + 3546ddc commit 5e345eb
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Init submodule
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR
- name: Configure
run: |
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ jobs:
run: |
echo "SIMTEST=${{ fromJson(env.SIMTEST_JSON).version }}" >> $GITHUB_ENV
- name: Init submodule Antares_Simulator_Tests
run: |
git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests
- name: Init submodule Antares_Simulator_Tests_NR
run: |
git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests_NR
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ jobs:
run: |
echo "SIMTEST=${{ fromJson(env.SIMTEST_JSON).version }}" >> $GITHUB_ENV
- name: Init submodule Antares_Simulator_Tests
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Init submodule Antares_Simulator_Tests_NR
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "src/tests/resources/Antares_Simulator_Tests"]
path = src/tests/resources/Antares_Simulator_Tests
url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests.git
branch = master
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
Expand Down
14 changes: 10 additions & 4 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,12 @@ static bool AreaListSaveThermalDataToFile(const AreaList& list, const AnyString&
return ini.save(filename);
}

static bool AreaListSaveToFolderSingleArea(const Area& area, Clob& buffer, const AnyString& folder)
static bool AreaListSaveToFolderSingleArea(const Area& area,
const AnyString& folder,
const Parameters::Compatibility::HydroPmax hydroPmax)
{
bool ret = true;
Clob buffer;

// A specific folder for general data
buffer.clear() << folder << SEP << "input" << SEP << "areas" << SEP << area.id;
Expand Down Expand Up @@ -273,7 +276,7 @@ static bool AreaListSaveToFolderSingleArea(const Area& area, Clob& buffer, const
if (area.hydro.series) // Series
{
buffer.clear() << folder << SEP << "input" << SEP << "hydro" << SEP << "series";
ret = area.hydro.series->saveToFolder(area.id, buffer) && ret;
ret = area.hydro.series->saveToFolder(area.id, buffer, hydroPmax) && ret;
}
}

Expand Down Expand Up @@ -762,13 +765,16 @@ bool AreaList::saveToFolder(const AnyString& folder) const
{
logs.info() << "Exporting the area " << (area.index + 1) << '/' << areas.size() << ": "
<< area.name;
ret = AreaListSaveToFolderSingleArea(area, buffer, folder) && ret;
ret = AreaListSaveToFolderSingleArea(area,
folder,
pStudy.parameters.compatibility.hydroPmax)
&& ret;
});

// Hydro
// The hydro files must be saved after the area has been invalidated
buffer.clear() << folder << SEP << "input" << SEP << "hydro";
ret = PartHydro::SaveToFolder(*this, buffer) && ret;
ret = PartHydro::SaveToFolder(*this, buffer, pStudy.parameters.compatibility.hydroPmax) && ret;

// update nameid set
updateNameIDSet();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ const char* SimulationModeToCString(SimulationMode mode);
*/
bool StringToSimulationMode(SimulationMode& mode, Yuni::CString<20, false> text);

const char* CompatibilityHydroPmaxToCString(Parameters::Compatibility::HydroPmax);
const char* CompatibilityHydroPmaxToCString(const Parameters::Compatibility::HydroPmax);
bool StringToCompatibilityHydroPmax(Parameters::Compatibility::HydroPmax&, const std::string& text);

} // namespace Antares::Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ class PartHydro
** \param folder The targer folder
** \return A non-zero value if the operation succeeded, 0 otherwise
*/
static bool SaveToFolder(const AreaList& areas, const AnyString& folder);
static bool SaveToFolder(const AreaList& areas,
const AnyString& folder,
const Parameters::Compatibility::HydroPmax hydroPmax);

/*!
** \brief Default Constructor
Expand Down Expand Up @@ -195,6 +197,9 @@ class PartHydro
double leewayUpperBound;
//! Puming efficiency
double pumpingEfficiency;
//! Daily max power ({generating max Power, generating max energy, pumping max power, pumping
//! max energy}x365)
Matrix<double, double> dailyMaxPumpAndGen;
//! Credit Modulation (default 0, 101 * 2)
Matrix<double, double> creditModulation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ class HydroMaxTimeSeriesReader
};

private:
Matrix<double, double> dailyMaxPumpAndGen;

PartHydro& hydro_;
std::string areaID_;
std::string areaName_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class DataSeriesHydro
** \param folder The target folder
** \return A non-zero value if the operation succeeded, 0 otherwise
*/
bool saveToFolder(const AreaName& areaID, const AnyString& folder) const;
bool saveToFolder(const AreaName& areaID,
const AnyString& folder,
Parameters::Compatibility::HydroPmax hydroPmax) const;
//@}

TimeSeriesNumbers timeseriesNumbers;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const char* SimulationModeToCString(SimulationMode mode)
}
}

const char* CompatibilityHydroPmaxToCString(Parameters::Compatibility::HydroPmax mode)
const char* CompatibilityHydroPmaxToCString(const Parameters::Compatibility::HydroPmax mode)
{
switch (mode)
{
Expand Down
30 changes: 21 additions & 9 deletions src/libs/antares/study/parts/hydro/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ bool PartHydro::validate(Study& study)
return checkProperties(study) && ret;
}

bool PartHydro::SaveToFolder(const AreaList& areas, const AnyString& folder)
bool PartHydro::SaveToFolder(const AreaList& areas,
const AnyString& folder,
const Parameters::Compatibility::HydroPmax hydroPmax)
{
if (!folder)
{
Expand Down Expand Up @@ -524,7 +526,7 @@ bool PartHydro::SaveToFolder(const AreaList& areas, const AnyString& folder)

// Add all alpha values for each area
areas.each(
[&allSections, &buffer, &folder, &ret](const Data::Area& area)
[&allSections, &buffer, &folder, &hydroPmax, &ret](const Data::Area& area)
{
allSections.s->add(area.id, area.hydro.interDailyBreakdown);
allSections.smod->add(area.id, area.hydro.intraDailyModulation);
Expand Down Expand Up @@ -568,13 +570,23 @@ bool PartHydro::SaveToFolder(const AreaList& areas, const AnyString& folder)
}

// max hours gen
buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP
<< "maxDailyGenEnergy_" << area.id << ".txt";
ret = area.hydro.dailyNbHoursAtGenPmax.saveToCSVFile(buffer, /*decimal*/ 2) && ret;
// max hours pump
buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP
<< "maxDailyPumpEnergy_" << area.id << ".txt";
ret = area.hydro.dailyNbHoursAtPumpPmax.saveToCSVFile(buffer, /*decimal*/ 2) && ret;
if (hydroPmax == Parameters::Compatibility::HydroPmax::Hourly)
{
buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP
<< "maxDailyGenEnergy_" << area.id << ".txt";
ret = area.hydro.dailyNbHoursAtGenPmax.saveToCSVFile(buffer, /*decimal*/ 2) && ret;

buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP
<< "maxDailyPumpEnergy_" << area.id << ".txt";
ret = area.hydro.dailyNbHoursAtPumpPmax.saveToCSVFile(buffer, /*decimal*/ 2) && ret;
}
else
{
buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP << "maxpower_"
<< area.id << ".txt";
ret = area.hydro.dailyMaxPumpAndGen.saveToCSVFile(buffer, /*decimal*/ 2) && ret;
}

// credit modulations
buffer.clear() << folder << SEP << "common" << SEP << "capacity" << SEP
<< "creditmodulations_" << area.id << ".txt";
Expand Down
35 changes: 19 additions & 16 deletions src/libs/antares/study/parts/hydro/hydromaxtimeseriesreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ HydroMaxTimeSeriesReader::HydroMaxTimeSeriesReader(PartHydro& hydro,
areaID_(areaID),
areaName_(areaName)
{
dailyMaxPumpAndGen.reset(4U, DAYS_PER_YEAR, true);
hydro_.dailyMaxPumpAndGen.reset(4U, DAYS_PER_YEAR, true);
}

static bool checkPower(const Matrix<>& dailyMaxPumpAndGen, const std::string& areaName)
Expand Down Expand Up @@ -88,12 +88,15 @@ bool HydroMaxTimeSeriesReader::loadDailyMaxPowersAndEnergies(const AnyString& fo
enabledModeIsChanged = true;
}

ret = dailyMaxPumpAndGen.loadFromCSVFile(filePath,
4U,
DAYS_PER_YEAR,
Matrix<>::optFixedSize,
&fileContent)
ret = hydro_.dailyMaxPumpAndGen.loadFromCSVFile(filePath,
4U,
DAYS_PER_YEAR,
Matrix<>::optFixedSize,
&fileContent)
&& ret;
// Allowing the daily power matrix to be printed in case of 'save as' (even if its content
// hasn't changed since it was loaded).
hydro_.dailyMaxPumpAndGen.markAsModified();

if (enabledModeIsChanged)
{
Expand All @@ -102,11 +105,11 @@ bool HydroMaxTimeSeriesReader::loadDailyMaxPowersAndEnergies(const AnyString& fo
}
else
{
ret = dailyMaxPumpAndGen.loadFromCSVFile(filePath,
4U,
DAYS_PER_YEAR,
Matrix<>::optFixedSize,
&fileContent)
ret = hydro_.dailyMaxPumpAndGen.loadFromCSVFile(filePath,
4U,
DAYS_PER_YEAR,
Matrix<>::optFixedSize,
&fileContent)
&& ret;
}
return ret;
Expand All @@ -121,7 +124,7 @@ void HydroMaxTimeSeriesReader::copyDailyMaxEnergy() const
void HydroMaxTimeSeriesReader::copyDailyMaxGenerationEnergy() const
{
auto& dailyNbHoursAtGenPmax = hydro_.dailyNbHoursAtGenPmax;
const auto& dailyMaxGenE = dailyMaxPumpAndGen[genMaxE];
const auto& dailyMaxGenE = hydro_.dailyMaxPumpAndGen[genMaxE];

dailyNbHoursAtGenPmax.reset(1U, DAYS_PER_YEAR, true);

Expand All @@ -131,7 +134,7 @@ void HydroMaxTimeSeriesReader::copyDailyMaxGenerationEnergy() const
void HydroMaxTimeSeriesReader::copyDailyMaxPumpingEnergy() const
{
auto& dailyNbHoursAtPumpPmax = hydro_.dailyNbHoursAtPumpPmax;
const auto& dailyMaxPumpE = dailyMaxPumpAndGen[pumpMaxE];
const auto& dailyMaxPumpE = hydro_.dailyMaxPumpAndGen[pumpMaxE];

dailyNbHoursAtPumpPmax.reset(1U, DAYS_PER_YEAR, true);

Expand All @@ -141,10 +144,10 @@ void HydroMaxTimeSeriesReader::copyDailyMaxPumpingEnergy() const
bool HydroMaxTimeSeriesReader::read(const AnyString& folder, bool usedBySolver)
{
bool ret = loadDailyMaxPowersAndEnergies(folder, usedBySolver);
ret = checkPower(dailyMaxPumpAndGen, areaName_) && ret;
ret = checkPower(hydro_.dailyMaxPumpAndGen, areaName_) && ret;
copyDailyMaxEnergy();
hydro_.series->buildHourlyMaxPowerFromDailyTS(dailyMaxPumpAndGen[genMaxP],
dailyMaxPumpAndGen[pumpMaxP]);
hydro_.series->buildHourlyMaxPowerFromDailyTS(hydro_.dailyMaxPumpAndGen[genMaxP],
hydro_.dailyMaxPumpAndGen[pumpMaxP]);

return ret;
}
Expand Down
16 changes: 11 additions & 5 deletions src/libs/antares/study/parts/hydro/series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ void DataSeriesHydro::buildHourlyMaxPowerFromDailyTS(
ConvertDailyTSintoHourlyTS(DailyMaxPumpPower, maxHourlyPumpPower.timeSeries[0]);
}

bool DataSeriesHydro::saveToFolder(const AreaName& areaID, const AnyString& folder) const
bool DataSeriesHydro::saveToFolder(const AreaName& areaID,
const AnyString& folder,
Parameters::Compatibility::HydroPmax hydroPmax) const
{
String buffer;
buffer.clear() << folder << SEP << areaID;
Expand All @@ -207,10 +209,14 @@ bool DataSeriesHydro::saveToFolder(const AreaName& areaID, const AnyString& fold
ret = storage.timeSeries.saveToCSVFile(buffer, 0) && ret;
buffer.clear() << folder << SEP << areaID << SEP << "mingen.txt";
ret = mingen.timeSeries.saveToCSVFile(buffer, 0) && ret;
buffer.clear() << folder << SEP << areaID << SEP << "maxHourlyGenPower.txt";
ret = maxHourlyGenPower.timeSeries.saveToCSVFile(buffer, 0) && ret;
buffer.clear() << folder << SEP << areaID << SEP << "maxHourlyPumpPower.txt";
ret = maxHourlyPumpPower.timeSeries.saveToCSVFile(buffer, 0) && ret;

if (hydroPmax == Parameters::Compatibility::HydroPmax::Hourly)
{
buffer.clear() << folder << SEP << areaID << SEP << "maxHourlyGenPower.txt";
ret = maxHourlyGenPower.timeSeries.saveToCSVFile(buffer, 0) && ret;
buffer.clear() << folder << SEP << areaID << SEP << "maxHourlyPumpPower.txt";
ret = maxHourlyPumpPower.timeSeries.saveToCSVFile(buffer, 0) && ret;
}

return ret;
}
Expand Down
5 changes: 4 additions & 1 deletion src/libs/antares/study/study.importprepro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ bool Study::importTimeseriesIntoInput()
{
logs.info() << "Importing hydro timeseries : " << areaName;
buffer.clear() << folderInput << SEP << "hydro" << SEP << "series";
ret = area->hydro.series->saveToFolder(area->id, buffer) && ret;
ret = area->hydro.series->saveToFolder(area->id,
buffer,
parameters.compatibility.hydroPmax)
&& ret;
++progression;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/tests/resources/Antares_Simulator_Tests
Submodule Antares_Simulator_Tests deleted from 2d7916

0 comments on commit 5e345eb

Please sign in to comment.