From: Adrien Gougeon Date: Wed, 28 Jun 2023 16:05:39 +0000 (+0200) Subject: try to fix initializer order X-Git-Tag: v3.35~113^2~7 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/de30da11cec7ac5b8e37c9b971cfc85b398bdb35 try to fix initializer order --- diff --git a/include/simgrid/plugins/battery.hpp b/include/simgrid/plugins/battery.hpp index 87746d393c..7a9265ec69 100644 --- a/include/simgrid/plugins/battery.hpp +++ b/include/simgrid/plugins/battery.hpp @@ -59,13 +59,12 @@ private: double depth_of_discharge_; double energy_budget_j_; - // std::map host_loads_ = {}; std::map host_loads_ = {}; std::map named_loads_ = {}; std::vector> events_; - double capacity_wh_ = 0; - double energy_stored_j_ = 0; + double capacity_wh_; + double energy_stored_j_; double energy_provided_j_ = 0; double energy_consumed_j_ = 0; double last_updated_ = 0; diff --git a/src/plugins/battery.cpp b/src/plugins/battery.cpp index c8f602dea9..db498ad23a 100644 --- a/src/plugins/battery.cpp +++ b/src/plugins/battery.cpp @@ -180,14 +180,14 @@ double Battery::next_occurring_event() Battery::Battery(const std::string& name, double state_of_charge, double charge_efficiency, double discharge_efficiency, double initial_capacity_wh, int cycles, double depth_of_discharge) : name_(name) - , energy_stored_j_(state_of_charge * 3600 * initial_capacity_wh) , charge_efficiency_(charge_efficiency) , discharge_efficiency_(discharge_efficiency) , initial_capacity_wh_(initial_capacity_wh) - , capacity_wh_(initial_capacity_wh) , cycles_(cycles) , depth_of_discharge_(depth_of_discharge) , energy_budget_j_(initial_capacity_wh * depth_of_discharge * 3600 * cycles * 2) + , capacity_wh_(initial_capacity_wh) + , energy_stored_j_(state_of_charge * 3600 * initial_capacity_wh) { xbt_assert(state_of_charge >= 0 and state_of_charge <= 1, " : state of charge should be in [0, 1] (provided: %f)", state_of_charge);