LCOV - code coverage report
Current view: top level - src/cells/Cell_ECM - State_ECM.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 5 100.0 %
Date: 2023-04-08 04:19:02 Functions: 9 9 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file State_ECM.hpp
       3             :  * @brief State_ECM class definition
       4             :  * @author Jorn Reniers, Volkan Kumtepeli
       5             :  * @date 14 Apr 2022
       6             :  */
       7             : 
       8             : #pragma once
       9             : 
      10             : #include "../../types/State.hpp"
      11             : 
      12             : namespace slide {
      13             : 
      14             : /**
      15             :  * @brief State_ECM template class for holding the states of the ECM model.
      16             :  * @tparam N_RC Number of parallel resistance-capacitance elements (default: 1).
      17             :  */
      18             : template <size_t N_RC = 1>
      19             : struct State_ECM : public State<3 + N_RC>
      20             : {
      21             : 
      22             :   /**
      23             :    * @brief Enumeration of indices for state variables.
      24             :    */
      25             :   enum Index : size_t {
      26             :     i_T,      //!< Cell temperature [K].
      27             :     i_SOC,    //!< State of charge [0-1].
      28             :     i_I,      //!< Current, [A], + for discharge, - for charge.
      29             :     i_Ir,     //!< Current through the parallel resistance, [I].
      30             :     N_states, //!< Total number of states (not recommended for usage, use .size() instead).
      31             :   };
      32             : 
      33             :   /**
      34             :    * @brief Get the current value (const method).
      35             :    * @return The current value [A], + for discharge, - for charge.
      36             :    */
      37     2200934 :   inline auto I() const { return (*this)[i_I]; } //!< Current, [A], + for discharge, - for charge
      38             : 
      39             :   /**
      40             :    * @brief Get the current value (non-const method).
      41             :    * @return The current value [A], + for discharge, - for charge.
      42             :    */
      43     6214015 :   inline auto &I() { return (*this)[i_I]; }
      44             : 
      45             :   /**
      46             :    * @brief Get the current through the parallel resistance (non-const method).
      47             :    * @param i Index of the parallel resistance (default: 0).
      48             :    * @return The current through the parallel resistance [I].
      49             :    */
      50     3431367 :   inline auto &Ir(size_t i = 0) { return (*this)[i_I + i + 1]; }
      51             : 
      52             :   /**
      53             :    * @brief Get the state of charge value (non-const method).
      54             :    * @return The state of charge value [0-1].
      55             :    */
      56     4924028 :   inline auto &SOC() { return (*this)[i_SOC]; }
      57             : 
      58             :   /**
      59             :    * @brief Get the temperature value (non-const method).
      60             :    * @return The temperature value [K].
      61             :    */
      62      662687 :   inline auto &T() { return (*this)[i_T]; }
      63             : };
      64             : 
      65             : using State_Bucket = State_ECM<0>; //!< Bucket Cell with no RC pairs.
      66             : 
      67             : } // namespace slide

Generated by: LCOV version 1.14