ConOpSys V2970  P004.07
ANVILEX control operating system
NTCT_Sensor.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file NTCT_Sensor.h
3 //! @brief NTC termoresistor class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2016-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Common/NTCT_Sensor.h $
7 //! $Revision: 2797 $
8 //! $Date: 2021-07-12 16:13:33 +0500 (Mo, 12 Jul 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Defines.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys application header files
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Macros
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 // Class definitions
70 //------------------------------------------------------------------------------
71 
72 //! @brief Negative temperature coefficient thermistor (NTC) class
73 class TNTC
74 {
75 
76  //----------------------------------------------------------------------------
77  // Public defines, methods and variables
78  //----------------------------------------------------------------------------
79 
80  public:
81 
82  //--------------------------------------------------------------------------
83  // Public defines
84  //--------------------------------------------------------------------------
85 
86  //! @brief NTC temperature scale enumeration
87  typedef enum
88  {
89 
90  //! @brief B25/100 B=3988 scala
92 
93  //! @brief B25/100 B=3900 scala
95 
97 
98  //! @brief NTC base resistance ebuneration
99  typedef enum
100  {
101 
102  //! @brief Base resistance 10kOhm
103  enum_10000_Ohm = 1
104 
106 
107  //--------------------------------------------------------------------------
108  // Public methods
109  //--------------------------------------------------------------------------
110 
111  //!-------------------------------------------------------------------------
112  //! @brief The function calculates the electrical resistance of NTC at given temperature and defined resistance R0 at 0°C for a NTC element.
113  //! @note None
114  //! @param [out] *f32_Resistance Resistance at given temperature.
115  //! @param [in] f32_Temperature Temperature in degree celsius.
116  //! @param [in] enum_NTC_Scala Temperature scala
117  //! @param [in] enum_NTC_Value Value of the NTC element.
118  //! @return Converstion status code
119  //! @retval true Converstion successed
120  //! @retval false Converstion error
121  //! \par Override
122  //! Not allowed
123  //! @attention None
124  //! \par UML diagram
125  //! @dotfile TNTC__Temperature_To_Resistance.dt
126  //--------------------------------------------------------------------------
127 
128  BOOL Temperature_To_Resistance( F32 *f32_Resistance, F32 f32_Temperature, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value );
129 
130  //!-------------------------------------------------------------------------
131  //! @brief The function calculates temperature by given electrical resistance of a NTC sensor.
132  //! @note None
133  //! @param [out] *f32_Temperature Temperature in degree celsius.
134  //! @param [in] f32_Resistance Resistance at given temperature.
135  //! @param [in] enum_NTC_Scala Temperature scala
136  //! @param [in] enum_NTC_Value Value of the NTC element.
137  //! @return Converstion status code
138  //! @retval true Converstion successed
139  //! @retval false Conversuin error
140  //! \par Override
141  //! Not allowed
142  //! @attention None
143  //! \par UML diagram
144  //! @dotfile TNTC__Resistance_To_Temperature.dt
145  //--------------------------------------------------------------------------
146 
147  BOOL Resistance_To_Temperature( F32 *f32_Temperature, F32 f32_Resistance, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value );
148 
149  //!-------------------------------------------------------------------------
150  //! @brief The function calculates temperature by given charging time.
151  //! @note None
152  //! @param [out] *f32_Temperature Temperature in degree celsius.
153  //! @param [in] f32_Charging_Time Charging time of the slope capacitor in seconds.
154  //! @param [in] enum_NTC_Scala Temperature scala.
155  //! @param [in] enum_NTC_Value Value of the NTC element.
156  //! @param [in] f32_Relative_Reference_Voltage Comparator relative reference voltage in range 0.1 to 0.9.
157  //! @param [in] f32_Capacitance Capacitance of the integration capacitor in farad.
158  //! @return Converstion status code
159  //! @retval true Converstion successed
160  //! @retval false Conversuin error
161  //! \par Override
162  //! Not allowed
163  //! @attention None
164  //! \par UML diagram
165  //! @dotfile TNTC__Time_To_Temperature.dt
166  //--------------------------------------------------------------------------
167 
168  BOOL Time_To_Temperature( F32 *f32_Temperature, F32 f32_Charging_Time, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value, F32 f32_Relative_Reference_Voltage, F32 f32_Capacitance );
169 
170  //----------------------------------------------------------------------------
171  // Protected defines, methods and variables
172  //----------------------------------------------------------------------------
173 
174  protected:
175 
176  //----------------------------------------------------------------------------
177  // Private defines, methods and variables
178  //----------------------------------------------------------------------------
179 
180  private:
181 
182  //!-------------------------------------------------------------------------
183  //! @brief The function returns base electrical resistance in ohms.
184  //! @note None
185  //! @param [out] *f32_Base_Resistance Base resistance at given temperature.
186  //! @param [in] enum_NTC_Value Value of the NTC termomenter.
187  //! @return Converstion status code
188  //! @retval true Converstion successed
189  //! @retval false Conversuin error
190  //! \par Override
191  //! Not allowed
192  //! @attention None
193  //! \par UML diagram
194  //! @dotfile TNTC__Get_Base_Resistance.dt
195  //--------------------------------------------------------------------------
196 
197  BOOL Get_Base_Resistance( F32 *f32_Base_Resistance, TNTC_Value enum_NTC_Value );
198 
199  //!-------------------------------------------------------------------------
200  //! @brief The function returns base electrical resistance in ohms.
201  //! @note None
202  //! @param [out] *f32_Betta Betta coefficient.
203  //! @param [out] *f32_Base_Temperature Base temperature in degree celsius.
204  //! @param [in] enum_NTC_Scala Temperature scala
205  //! @return Converstion status code
206  //! @retval true Converstion successed
207  //! @retval false Conversuin error
208  //! \par Override
209  //! Not allowed
210  //! @attention None
211  //! \par UML diagram
212  //! @dotfile TNTC__Get_Scala_Coefficients.dt
213  //--------------------------------------------------------------------------
214 
215  BOOL Get_Scala_Coefficients( F32 *f32_Betta, F32 *f32_Base_Temperature, TNTC_Scala enum_NTC_Scala );
216 
217 };
218 
219 //------------------------------------------------------------------------------
220 // End of file
221 //------------------------------------------------------------------------------
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
Negative temperature coefficient thermistor (NTC) class.
Definition: NTCT_Sensor.h:74
TNTC_Value
NTC base resistance ebuneration.
Definition: NTCT_Sensor.h:100
@ enum_10000_Ohm
Base resistance 10kOhm.
Definition: NTCT_Sensor.h:103
BOOL Temperature_To_Resistance(F32 *f32_Resistance, F32 f32_Temperature, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value)
The function calculates the electrical resistance of NTC at given temperature and defined resistance ...
Definition: NTCT_Sensor.cpp:204
BOOL Get_Base_Resistance(F32 *f32_Base_Resistance, TNTC_Value enum_NTC_Value)
The function returns base electrical resistance in ohms.
Definition: NTCT_Sensor.cpp:68
TNTC_Scala
NTC temperature scale enumeration.
Definition: NTCT_Sensor.h:88
@ enum_B25_100_3900
B25/100 B=3900 scala.
Definition: NTCT_Sensor.h:94
@ enum_B25_100_3988
B25/100 B=3988 scala.
Definition: NTCT_Sensor.h:91
BOOL Get_Scala_Coefficients(F32 *f32_Betta, F32 *f32_Base_Temperature, TNTC_Scala enum_NTC_Scala)
The function returns base electrical resistance in ohms.
Definition: NTCT_Sensor.cpp:125
BOOL Resistance_To_Temperature(F32 *f32_Temperature, F32 f32_Resistance, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value)
The function calculates temperature by given electrical resistance of a NTC sensor.
Definition: NTCT_Sensor.cpp:221
BOOL Time_To_Temperature(F32 *f32_Temperature, F32 f32_Charging_Time, TNTC_Scala enum_NTC_Scala, TNTC_Value enum_NTC_Value, F32 f32_Relative_Reference_Voltage, F32 f32_Capacitance)
The function calculates temperature by given charging time.
Definition: NTCT_Sensor.cpp:348