X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2865b4adad00b379d59f8ef1b9ed31ed1a7045ef..76fd6cc1330945172740464411a0b2f1170dcb2a:/src/plugins/battery.cpp diff --git a/src/plugins/battery.cpp b/src/plugins/battery.cpp index 262809584d..65077e921a 100644 --- a/src/plugins/battery.cpp +++ b/src/plugins/battery.cpp @@ -166,8 +166,8 @@ public: bool is_active() const; double get_power(); double get_state_of_charge(); - double get_state_of_charge_min(); - double get_state_of_charge_max(); + double get_state_of_charge_min() const; + double get_state_of_charge_max() const; double get_state_of_health(); double get_capacity(); double get_cumulative_cost(); @@ -195,7 +195,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_); @@ -321,12 +321,12 @@ double Battery::get_state_of_charge() return state_of_charge_; } -double Battery::get_state_of_charge_min() +double Battery::get_state_of_charge_min() const { return state_of_charge_min_; } -double Battery::get_state_of_charge_max() +double Battery::get_state_of_charge_max() const { return state_of_charge_max_; }