Thermistor
Dependents: Nucleo_UDS_controller_Alberto_version
Thermistor.cpp@0:d4198719a504, 2014-09-07 (annotated)
- Committer:
- macht
- Date:
- Sun Sep 07 16:19:42 2014 +0000
- Revision:
- 0:d4198719a504
Thermistor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
macht | 0:d4198719a504 | 1 | #include "Thermistor.h" |
macht | 0:d4198719a504 | 2 | |
macht | 0:d4198719a504 | 3 | Thermistor::Thermistor(float T0,float R0,float B){ |
macht | 0:d4198719a504 | 4 | T0_ = T0; |
macht | 0:d4198719a504 | 5 | K0_ = T0_+273.0; |
macht | 0:d4198719a504 | 6 | R0_ = R0; |
macht | 0:d4198719a504 | 7 | B_ = B; |
macht | 0:d4198719a504 | 8 | } |
macht | 0:d4198719a504 | 9 | |
macht | 0:d4198719a504 | 10 | float Thermistor::trans_R2T(float R){ |
macht | 0:d4198719a504 | 11 | float K = (B_*K0_)/(K0_*log(R/R0_)+B_); |
macht | 0:d4198719a504 | 12 | float temp = K-273.0; |
macht | 0:d4198719a504 | 13 | return temp; |
macht | 0:d4198719a504 | 14 | } |