LCOV - code coverage report
Current view: top level - Preamplifier - TransistorFunction.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 17 17 100.0 %
Date: 2021-02-18 20:07:22 Functions: 8 8 100.0 %

          Line data    Source code
       1             : /**
       2             :  * \file TransistorFunction.h
       3             :  */
       4             : 
       5             : #ifndef ATK_PREAMPLIFIER_TRANSISTORFUNCTION_H
       6             : #define ATK_PREAMPLIFIER_TRANSISTORFUNCTION_H
       7             : 
       8             : #include <utility>
       9             : 
      10             : namespace ATK
      11             : {
      12             :   template <typename DataType_>
      13             :   class TransistorFunction
      14             :   {
      15             :   protected:
      16             :     const DataType_ Is;
      17             :     const DataType_ Br;
      18             :     const DataType_ Bf;
      19             :     
      20             :   public:
      21             :     const DataType_ Vt;
      22             : 
      23       45327 :     DataType_ Lb(const std::pair<DataType_, DataType_>& exp)
      24             :     {
      25       45327 :       return Is * ((exp.first - 1) / Bf + (exp.second - 1) / Br);
      26             :     }
      27             : 
      28       45327 :     DataType_ Lb_Vbe(const std::pair<DataType_, DataType_>& exp)
      29             :     {
      30       45327 :       return Is / Vt * (exp.first / Bf);
      31             :     }
      32             : 
      33       45327 :     DataType_ Lb_Vbc(const std::pair<DataType_, DataType_>& exp)
      34             :     {
      35       45327 :       return Is / Vt * (exp.second / Br);
      36             :     }
      37             : 
      38       45327 :     DataType_ Lc(const std::pair<DataType_, DataType_>& exp)
      39             :     {
      40       45327 :       return Is * ((exp.first - exp.second) - (exp.second - 1) / Br);
      41             :     }
      42             : 
      43       45327 :     DataType_ Lc_Vbe(const std::pair<DataType_, DataType_>& exp)
      44             :     {
      45       45327 :       return Is / Vt * (exp.first);
      46             :     }
      47             : 
      48       45327 :     DataType_ Lc_Vbc(const std::pair<DataType_, DataType_>& exp)
      49             :     {
      50       45327 :       return -Is / Vt * (exp.second + exp.second / Br);
      51             :     }
      52             : 
      53           3 :     TransistorFunction(DataType_ Is, DataType_ Vt, DataType_ Br, DataType_ Bf)
      54           3 :       :Is(Is), Br(Br), Bf(Bf), Vt(Vt)
      55             :     {
      56           3 :     }
      57             : 
      58             :     /// Build a new transistor function for a filter
      59           3 :     static TransistorFunction build_standard_function(DataType_ Is=1e-12, DataType_ Vt=26e-3, DataType_ Br=1, DataType_ Bf=100)
      60             :     {
      61           3 :       return TransistorFunction(Is, Vt, Br, Bf);
      62             :     }
      63             :   };
      64             : }
      65             : 
      66             : #endif

Generated by: LCOV version TK-3.3.0-4-gdba42eea