Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / plugins / battery.cpp
index 2628095..b08de11 100644 (file)
@@ -83,7 +83,8 @@ Here is an example of XML declaration:
 The different properties are:
 
 - ``battery_active``: Set the battery as active if set to 1 (default=0)
-- ``battery_power``: Set the initial power of the battery in W (default=0). A negative value indicates that the battery act as a load and charge. A positive value indicates that the battery act as a generator and discharge
+- ``battery_power``: Set the initial power of the battery in W (default=0). A negative value indicates that the battery
+act as a load and charge. A positive value indicates that the battery act as a generator and discharge
 - ``battery_state_of_charge``: Set the initial state of charge of the battery (default=0)
 - ``battery_state_of_charge_min``: Set the minimal state of charge of the battery (default=0.2)
 - ``battery_state_of_charge_max``: Set the maximal state of charge of the battery (default=0.8)
@@ -195,7 +196,7 @@ void Battery::set_power(const double p)
     if (power_w_ > 0) {
       soc_shutdown = capacity_wh_ * 3600 * (state_of_charge_ - state_of_charge_min_) / (power_w_ * charge_efficiency_);
       soh_shutdown = (energy_budget_j_ - energy_exchanged_j_) / (power_w_ * charge_efficiency_);
-    } else if (power_w_ < 0) {
+    } else { // power_w_ < 0
       soc_shutdown =
           capacity_wh_ * 3600 * (state_of_charge_max_ - state_of_charge_) / (abs(power_w_) / discharge_efficiency_);
       soh_shutdown = (energy_budget_j_ - energy_exchanged_j_) / (abs(power_w_) / discharge_efficiency_);