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

          Line data    Source code
       1             : /*
       2             :  * CoolSystem.hpp
       3             :  *
       4             :  *  Created on: 29 Apr 2020
       5             :  *   Author(s): Jorn Reniers, Volkan Kumtepeli
       6             :  */
       7             : 
       8             : #pragma once
       9             : 
      10             : #include "../settings/settings.hpp"
      11             : #include "../StorageUnit.hpp"
      12             : #include "../types/Histogram.hpp"
      13             : #include "../types/data_storage/cell_data.hpp"
      14             : 
      15             : #include "data_storage/CoolSystemData.hpp"
      16             : 
      17             : #include <string>
      18             : #include <cstdlib>
      19             : 
      20             : namespace slide {
      21             : class CoolSystem
      22             : {
      23             : protected:
      24             :   //!< state
      25             :   double Tcoolant{ settings::T_ENV }; //!< temperature of the coolant [K]
      26             :   double flowrate{};                  //!< flow rate of cooling fluid [m3/s]
      27             : 
      28             :   //!< Coolant properties
      29             :   double fluid_rho; //!< density of cooling fluid kg / m3
      30             :   double fluid_cp;  //!< heat capcity of cooling fluid J / kG / K
      31             :   double fluid_V;   //!< total volume of coolant available for this coolsystem m3
      32             : 
      33             :   //!< number of cells this system needs to cool
      34             :   size_t Ncells{ 0 };
      35             : 
      36             :   //!< cooling system properties
      37             :   int control_strategy;      //!< integer indicating how the cooling is done
      38             :                              // 1 always on
      39             :                              //!<    2 on/off depending on T of hottest child SU [can't be coolant since that would never heat up]
      40             :                              //!<    3 on/off depending on T of hottest cell
      41             :                              //!<    4 proportional to T of hottest child SU, with a minimum of 20% flow rate (else it is off) [can't be coolant since that would never heat up]
      42             :                              //!<    5 proportional to T of hottest cell, with a minimum of 20% flow rate (else it is off)
      43             :   double control_onoff_Ton;  //!< T when the system switches on
      44             :   double control_onoff_Toff; //!< T when the system switches off
      45             :   double control_onoff_flr;  //!< flow rate when on
      46             :   double control_prop_T;     //!< T to which the proportional control cools the children
      47             :   double control_prop_gain;  //!< gain of the proportional controller
      48             :   double Across;             //!< cross section of the fluid [m2], used to convert flow rate to flow speed
      49             :   double eta{ 0.5 };         //!< efficiency
      50             : 
      51             :   friend struct CoolSystemData;
      52             : 
      53             : public:
      54             :   CoolSystemData coolData; //!< # Check this should be protected.
      55             :   CoolSystem();
      56             :   CoolSystem(size_t Ncells, int control);
      57             :   virtual ~CoolSystem() = default;
      58             : 
      59             :   double T() { return Tcoolant; }
      60             :   void setT(double Tnew);
      61             :   virtual double dstate(double Etot, double Echildren, double t); //!< calculate the new coolant temperature from a heat exchange of Etot
      62             : 
      63             :   virtual double getH();
      64             :   auto getFlr() { return flowrate; }
      65             :   auto getControl() { return control_strategy; }
      66             :   auto getEoperation() { return coolData.cData.Eoperate; }
      67             :   void reset_Eoperation() { coolData.cData.Eoperate = 0; }
      68             : 
      69             :   void setControl(int control) { control_strategy = control; }
      70             :   virtual void control(double Thot_local, double Thot_global);
      71             : 
      72             :   virtual void storeData(size_t Ncells);
      73             :   virtual void writeData(const std::string &prefix);
      74             : 
      75         162 :   auto getHeatEvac() { return coolData.cData.Qevac_life; }    //!< for unit testing, total heat evacuated from children over entire lifetime
      76         142 :   auto getHeatabsorbed() { return coolData.cData.Qabs_life; } //!< for unit testing, total heat evacuated from children over entire lifetime (heat capacity not constant -> cannot convert Tend-T1 to energy)
      77             :   auto getTotalTime() { return coolData.cData.t_life; }       //!< total time this coolsystem has existed for [s]
      78             : 
      79             :   virtual CoolSystem *copy() { return new CoolSystem(*this); }
      80             : };
      81             : 
      82             : } // namespace slide

Generated by: LCOV version 1.14