NTC Thermistor class.
Dependents: FermenterTempArray
Fork of Thermistor by
NTCThermistor.cpp@3:e9f38dc974f8, 2014-09-09 (annotated)
- Committer:
- macht
- Date:
- Tue Sep 09 02:53:49 2014 +0000
- Revision:
- 3:e9f38dc974f8
- Parent:
- 2:b052ac698148
add documents
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
macht | 2:b052ac698148 | 1 | #include "NTCThermistor.h" |
macht | 2:b052ac698148 | 2 | |
macht | 2:b052ac698148 | 3 | /** Create a NTCThermistor instance |
macht | 2:b052ac698148 | 4 | *@param T0 basic temperature[degrees/celsious] |
macht | 2:b052ac698148 | 5 | *@param R0 basic resistance[ohm]. Thermistor takes this resistance at basic temperature T0. |
macht | 2:b052ac698148 | 6 | *@param B B-parameter. |
macht | 2:b052ac698148 | 7 | */ |
macht | 2:b052ac698148 | 8 | NTCThermistor::NTCThermistor(float T0,float R0,float B){ |
macht | 2:b052ac698148 | 9 | T0_ = T0; |
macht | 2:b052ac698148 | 10 | K0_ = T0_+273.0; |
macht | 2:b052ac698148 | 11 | R0_ = R0; |
macht | 2:b052ac698148 | 12 | B_ = B; |
macht | 2:b052ac698148 | 13 | } |
macht | 2:b052ac698148 | 14 | |
macht | 2:b052ac698148 | 15 | /** Transfer temperature from resistance |
macht | 2:b052ac698148 | 16 | */ |
macht | 2:b052ac698148 | 17 | float NTCThermistor::trans_R2T(float R){ |
macht | 2:b052ac698148 | 18 | float K = (B_*K0_)/(K0_*log(R/R0_)+B_); |
macht | 2:b052ac698148 | 19 | float temp = K-273.0; |
macht | 2:b052ac698148 | 20 | return temp; |
macht | 2:b052ac698148 | 21 | } |