Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to fix initializer order
authorAdrien Gougeon <adrien.gougeon@ens-rennes.fr>
Wed, 28 Jun 2023 16:05:39 +0000 (18:05 +0200)
committerAdrien Gougeon <adrien.gougeon@ens-rennes.fr>
Tue, 11 Jul 2023 10:04:56 +0000 (12:04 +0200)
include/simgrid/plugins/battery.hpp
src/plugins/battery.cpp

index 87746d3..7a9265e 100644 (file)
@@ -59,13 +59,12 @@ private:
   double depth_of_discharge_;
   double energy_budget_j_;
 
-  // std::map<const s4u::Host*, double> host_loads_ = {};
   std::map<const s4u::Host*, bool> host_loads_     = {};
   std::map<const std::string, double> named_loads_ = {};
   std::vector<std::shared_ptr<Event>> 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;
index c8f602d..db498ad 100644 (file)
@@ -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);