X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e6f111b95343b45e14c154574210ef9a448369f5..493f33d30ab8b32dbf44d9f536a31eda9ff9c1d3:/include/simgrid/plugins/battery.hpp diff --git a/include/simgrid/plugins/battery.hpp b/include/simgrid/plugins/battery.hpp index 87746d393c..9d36175b5d 100644 --- a/include/simgrid/plugins/battery.hpp +++ b/include/simgrid/plugins/battery.hpp @@ -37,15 +37,46 @@ public: enum Flow { CHARGE, DISCHARGE }; class Event { - public: + friend Battery; + + private: double state_of_charge_; Flow flow_; double time_delta_ = -1; std::function callback_; bool repeat_; + public: Event(double state_of_charge, Flow flow, std::function callback, bool repeat); static std::shared_ptr init(double state_of_charge, Flow flow, std::function callback, bool repeat); + + /** @ingroup plugin_battery + * @return The state of charge at which the Event will happen. + * @note For Battery::Event objects + */ + double get_state_of_charge() { return state_of_charge_; } + /** @ingroup plugin_battery + * @return The flow in which the Event will happen, either when the Battery is charging or discharging. + * @note For Battery::Event objects + */ + Flow get_flow() { return flow_; } + /** @ingroup plugin_battery + * @return The time delta until the Event happen. + -1 means that is will never happen with the current state the Battery, + for instance when there is no load connected to the Battery. + * @note For Battery::Event objects + */ + double get_time_delta() { return time_delta_; } + /** @ingroup plugin_battery + * @return The callback to trigger when the Event happen. + * @note For Battery::Event objects + */ + std::function get_callback() { return callback_; } + /** @ingroup plugin_battery + * @return true if its a recurrent Event. + * @note For Battery::Event objects + */ + bool get_repeat() { return repeat_; } }; private: @@ -55,17 +86,17 @@ private: double charge_efficiency_; double discharge_efficiency_; double initial_capacity_wh_; - int cycles_; // total complete cycles (charge + discharge) the battery can do before complete depletion. + int cycles_; // total complete cycles (charge + discharge) the battery can do before complete depletion of its + // capacity 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;