For test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers calculate.h Source File

calculate.h

00001 #ifndef CALCULATE_H
00002 #define CALCULATE_H
00003 
00004 #include "cal_const.h"
00005 
00006 //Rt(ohm) = 1 /( (Vcc - Vamb2)/(Rs*Vamb2) - 1/Rp)
00007 //TC = 1/(Ka + Kb*ln(r)+Kc*(ln(r)^3))-273.15
00008 #define Rt_Ka   (0.00088608989f)
00009 #define Rt_Kb   (0.00025170399f)
00010 #define Rt_Kc   (0.00000019152616f)
00011 #define Rt(N_Rt)   ((N_Rt) * 7870.0 / (65535.0 - (N_Rt)))
00012 #define ToC_Rt(Rt)  (1.0 / (Rt_Ka + log(Rt)* Rt_Kb + log(Rt)*log(Rt)*log(Rt)* Rt_Kc) - 273.15)
00013 
00014 // Macro of temperature unit conversion
00015 #define CTOF(c) ((c)*1.8+32.0)
00016 #define CTOS(c) (((c)+40.0)*9.0)
00017 #define CTOK(c) ((c)+273.15)
00018 
00019 #define FTOC(f) (((f)-32.0)/1.8)
00020 #define FTOS(f) (((f)+40.0)*5.0)
00021 #define FTOK(f) (((f)-32.0)/1.8+273.15)
00022 
00023 #define STOC(s) ((s)/9.0-40.0)
00024 #define STOF(s) ((s)/5.0-40.0)
00025 #define STOK(s) ((s)/9.0+233.15)
00026 
00027 #define KTOC(k) ((k)-273.15)
00028 #define KTOF(k) (((k)-273.15)*1.8+32.0)
00029 #define KTOS(k) (((k)-233.15)*9.0)
00030 
00031 class Calculate
00032 {
00033 public:
00034     float linterp(const float* _x, const float* _y, float val, unsigned char size);
00035     void calcu_Tir_oS(float * targTempS, float PSdOut, float ambTempC, const struct CalibrationConstants CalConst, float emissivity);
00036     float get_Tamb_oC(float N_Tamb);
00037 };
00038 
00039 #endif // calculate.h