From 05cea49c822b62103948f492ddbb3235086429ef Mon Sep 17 00:00:00 2001 From: mj-xmr <63722585+mj-xmr@users.noreply.github.com> Date: Wed, 5 Oct 2022 18:09:42 +0200 Subject: [PATCH] Default max battery charge percentage of 90% (#133) --- src/opti-lib/src/BatterySimulation.cpp | 7 +++++++ src/opti-lib/src/ConfigSol.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/src/opti-lib/src/BatterySimulation.cpp b/src/opti-lib/src/BatterySimulation.cpp index e33d0a8..5ec0726 100644 --- a/src/opti-lib/src/BatterySimulation.cpp +++ b/src/opti-lib/src/BatterySimulation.cpp @@ -56,6 +56,13 @@ double BatterySimulation::iter_get_load(double inp, double out, double hours) //num_overvolted += 1 + diff * 2; num_overvolted += 1 + diff; //num_overvolted += GMat().Pow(1 + diff, 1.01); + + // Warning: You may do this only AFTER the penalty was calculated. + // It will however impact the penalty in the NEXT iteration, which is very bad. + if (load > pars.MAX_CAPACITY_AMPH) + { + //load -= inp * m_mulPowerToCapacity; + } } if (load < pars.MIN_LOAD_AMPH) { diff --git a/src/opti-lib/src/ConfigSol.cpp b/src/opti-lib/src/ConfigSol.cpp index 2c61c2b..13b218f 100644 --- a/src/opti-lib/src/ConfigSol.cpp +++ b/src/opti-lib/src/ConfigSol.cpp @@ -14,6 +14,7 @@ using namespace EnjoLib; ConfigSol::~ConfigSol(){} ConfigSol::ConfigSol() { + BATTERY_CHARGE_MAX_PERCENTAGE = 0.90; } EnjoLib::Str ConfigSol::GetFileNameProt() const