Thermistor

Dependents:   Nucleo_UDS_controller_Alberto_version

Files at this revision

API Documentation at this revision

Comitter:
macht
Date:
Sun Sep 07 16:19:42 2014 +0000
Commit message:
Thermistor

Changed in this revision

Thermistor.cpp Show annotated file Show diff for this revision Revisions of this file
Thermistor.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Thermistor.cpp	Sun Sep 07 16:19:42 2014 +0000
@@ -0,0 +1,14 @@
+#include "Thermistor.h"
+
+Thermistor::Thermistor(float T0,float R0,float B){
+    T0_ = T0;
+    K0_ = T0_+273.0;
+    R0_ = R0;
+    B_ = B;
+}
+
+float Thermistor::trans_R2T(float R){
+    float K =  (B_*K0_)/(K0_*log(R/R0_)+B_);
+    float temp = K-273.0;
+    return temp;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Thermistor.h	Sun Sep 07 16:19:42 2014 +0000
@@ -0,0 +1,25 @@
+#ifndef THERMISTOR_H
+#define THERMISTOR_H
+#include "mbed.h"
+#include "math.h"
+
+class Thermistor
+{
+    public:
+        Thermistor(float T0,float R0,float B);   
+        float trans_R2T(float R);    //transfer resistance to temperature(degrees)
+    private:
+        float R0_;     //basic resisitance of thremister at basic temperature 
+        float T0_;     //basic temperature[°C]
+        float K0_;     //basic temperature[K]
+        float B_;      //B constant 
+};
+#endif
+/*
+float R2T(float input){
+    float K0 = T0+273.0;
+    float K =  (B*K0)/(K0*log(input/R0)+B);
+    float temp = K-273.0;
+    return temp;
+    
+}*/
\ No newline at end of file