energy: Extensions to battery discharge module

This MR is an extension of the LiIonEnergySource module. The new module extends the capability of this module to support 3 new battery chemistries (NiMh, NiCd,Lead Acid).

The whole module was renamed and refactored as necessary but used the LiIonEnergySource module as a base. In addition to the new batteries chemistries support, battery presets and the possibility of configuring batteries cell pack has been added via helpers. Because of these changes, this new update names a new GenericBatteryModel intended to replace the existing LiIonEnergySource completely.

A new set of examples have been added (src/energy/examples/generic-battery-discharge-example.cc), this code produces plots that show the results of discharging different battery chemistries using constant discharge current. Results are comparable to battery manufacturers' datasheets:

LeadAcid_Discharge

NiCd_Discharge

NiMh_Discharge

LiIon_Discharge

Produced plots from generic-battery-discharge-example.cc can be made into graphs with gnuplot <plot_name.plot>.

Note: See the description of an existing bug in the EnergySource below which affect the output of generic-battery-discharge-example.cc.

We also included src/energy/examples/generic-battery-wifiradio-example.cc to demonstrate the use of a Generic Battery Model with a Wifi Radio Energy model. This example should be considered a prototype since further testing is necessary with the WifiRadioEnergyModel. It is only added here for demonstration purposes.

The battery model is mainly based on these sources:

TremblayModel TremblayModelImproved

However, several other sources were used to complete the content or to fix errors found in the main sources.

Reviewers were assigned based on people who might be interested in the module, however, feel free to comment only if you have time.

Limitations

  • The present MR removes the capacity to add Joules of energy discretely as in the LiIonEnergySource. The reason is that this approach is not realistic because it does not take into consideration the capacity and voltage of the battery which defeats the purpose of the energy source.
  • This MR focus on the accurate simulation of the discharge behavior of these 4 battery chemistries. However, I included the equations that consider the charging behavior of the battery. Unfortunately, the charging behavior is not thoroughly tested because it requires the implementation of a charging mode capable of doing constant current (CC) and a switch to a constant voltage (CV) which is typically associated with the charging methods of batteries.
  • As in the LiIonEnergySource, currently there is no mechanism in place to stop the battery from continuing discharging when the battery reaches its cutoff voltage.
  • There is a known bug in which the calculation of the total current in the EnergySource throws an invalid value (NaN). This issue is caused by invalid access to an EnergyHarvester object when there are no EnergyHarvesters installed in the EnergySource. The fix has been proposed in (Solved in !1422 (merged))
  • Further testing is necessary with the WifiRadioEnergyModel as it is not originally designed to work with other models other than the BasicEnergySource.
  • Documentation is missing but is planned for the final release.
Edited by Alberto Gallegos

Merge request reports

Loading