Skip to content

Commit

Permalink
New hydro remix : some more renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Jan 7, 2025
1 parent 47af157 commit 8ce9f25
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 66 deletions.
30 changes: 15 additions & 15 deletions src/solver/simulation/hydro-remix-new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static bool operator>=(const std::vector<double>& v, const double c)
return std::ranges::all_of(v, [&c](const double& e) { return e >= c; });
}

static void checkInputCorrectness(const std::vector<double>& ThermalGen,
static void checkInputCorrectness(const std::vector<double>& DispatchGen,
const std::vector<double>& HydroGen,
const std::vector<double>& UnsupE,
const std::vector<double>& levels,
Expand All @@ -97,7 +97,7 @@ static void checkInputCorrectness(const std::vector<double>& ThermalGen,
throw std::invalid_argument(msg_prefix + "initial level > reservoir capacity");
}
// Arrays sizes must be identical
std::vector<size_t> sizes = {ThermalGen.size(),
std::vector<size_t> sizes = {DispatchGen.size(),
HydroGen.size(),
UnsupE.size(),
levels.size(),
Expand All @@ -115,7 +115,7 @@ static void checkInputCorrectness(const std::vector<double>& ThermalGen,
}

// Arrays are of size 0
if (!ThermalGen.size())
if (!DispatchGen.size())
{
throw std::invalid_argument(msg_prefix + "all arrays of sizes 0");
}
Expand All @@ -141,7 +141,7 @@ static void checkInputCorrectness(const std::vector<double>& ThermalGen,
}
}

RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
RemixHydroOutput new_remix_hydro(const std::vector<double>& DispatchGen,
const std::vector<double>& HydroGen,
const std::vector<double>& UnsupE,
const std::vector<double>& HydroPmax,
Expand All @@ -154,7 +154,7 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
const std::vector<double>& Spillage,
const std::vector<double>& DTG_MRG)
{
std::vector<double> levels(ThermalGen.size());
std::vector<double> levels(DispatchGen.size());
if (levels.size())
{
levels[0] = initial_level + inflows[0] - overflow[0] + pump[0] - HydroGen[0];
Expand All @@ -164,7 +164,7 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
}
}

checkInputCorrectness(ThermalGen,
checkInputCorrectness(DispatchGen,
HydroGen,
UnsupE,
levels,
Expand All @@ -183,11 +183,11 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,

int loop = 1000;
double eps = 1e-3;
double top = *std::max_element(ThermalGen.begin(), ThermalGen.end())
double top = *std::max_element(DispatchGen.begin(), DispatchGen.end())
+ *std::max_element(HydroGen.begin(), HydroGen.end())
+ *std::max_element(UnsupE.begin(), UnsupE.end()) + 1;

std::vector<bool> filter_hours_remix(ThermalGen.size(), false);
std::vector<bool> filter_hours_remix(DispatchGen.size(), false);
for (unsigned int h = 0; h < filter_hours_remix.size(); h++)
{
if (Spillage[h] + DTG_MRG[h] == 0. && HydroGen[h] + UnsupE[h] > 0.)
Expand All @@ -196,16 +196,16 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
}
}

std::vector<double> Thermal_plus_Hydro(ThermalGen.size());
std::transform(ThermalGen.begin(),
ThermalGen.end(),
std::vector<double> Thermal_plus_Hydro(DispatchGen.size());
std::transform(DispatchGen.begin(),
DispatchGen.end(),
OutHydroGen.begin(),
Thermal_plus_Hydro.begin(),
std::plus<>());

while (loop-- > 0)
{
std::vector<int> tried_creux(ThermalGen.size(), 0);
std::vector<int> tried_creux(DispatchGen.size(), 0);
double delta = 0;

while (true)
Expand All @@ -222,7 +222,7 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
break;
}

std::vector<int> tried_pic(ThermalGen.size(), 0);
std::vector<int> tried_pic(DispatchGen.size(), 0);
while (true)
{
int idx_pic = find_max_index(Thermal_plus_Hydro,
Expand Down Expand Up @@ -293,8 +293,8 @@ RemixHydroOutput new_remix_hydro(const std::vector<double>& ThermalGen,
break;
}

std::transform(ThermalGen.begin(),
ThermalGen.end(),
std::transform(DispatchGen.begin(),
DispatchGen.end(),
OutHydroGen.begin(),
Thermal_plus_Hydro.begin(),
std::plus<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ namespace Antares::Solver::Simulation

struct RemixHydroOutput
{
std::vector<double> new_H;
std::vector<double> new_D;
std::vector<double> HydroGen;
std::vector<double> UnsupE;
std::vector<double> levels;
};

RemixHydroOutput new_remix_hydro(const std::vector<double>& G,
const std::vector<double>& H,
const std::vector<double>& D,
const std::vector<double>& P_max,
const std::vector<double>& P_min,
RemixHydroOutput new_remix_hydro(const std::vector<double>& DispatchGen,
const std::vector<double>& HydroGen,
const std::vector<double>& UnsupE,
const std::vector<double>& HydroPmax,
const std::vector<double>& HydroPmin,
double init_level,
double capacity,
const std::vector<double>& inflow,
const std::vector<double>& overflow,
const std::vector<double>& pump,
const std::vector<double>& S,
const std::vector<double>& Spillage,
const std::vector<double>& DTG_MRG);

} // namespace Antares::Solver::Simulation
Loading

0 comments on commit 8ce9f25

Please sign in to comment.