2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file thermistors.h
|
|
|
|
*
|
|
|
|
* @date Feb 17, 2013
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef THERMISTORS_H_
|
|
|
|
#define THERMISTORS_H_
|
|
|
|
|
2018-09-16 19:26:57 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#define KELV 273.15f
|
|
|
|
|
|
|
|
#include "sensor_types.h"
|
|
|
|
#include "engine.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Vout=r2/(r1+r2)*Vin
|
|
|
|
*/
|
|
|
|
float getR1InVoltageDividor(float Vout, float Vin, float r2);
|
|
|
|
float getR2InVoltageDividor(float Vout, float Vin, float r1);
|
|
|
|
float getTempK(float resistance);
|
|
|
|
/**
|
|
|
|
* converts Kelvin temperature into Celsius temperature
|
|
|
|
*/
|
|
|
|
#define convertKelvinToCelcius(tempK) ((tempK) - KELV)
|
|
|
|
#define convertCelsiusToKelvin(tempC) ((tempC) + KELV)
|
|
|
|
|
|
|
|
float convertCelciustoF(float tempC);
|
|
|
|
float convertFtoCelcius(float tempF);
|
|
|
|
|
2016-12-23 11:01:45 -08:00
|
|
|
float getKelvinTemperature(float resistance, ThermistorMath *tm);
|
2016-12-22 11:02:38 -08:00
|
|
|
float getResistance(ThermistorConf *config, float voltage);
|
2017-06-12 15:48:55 -07:00
|
|
|
float getTemperatureC(ThermistorConf *config, ThermistorMath *tm, bool useLinear);
|
2017-05-15 20:33:22 -07:00
|
|
|
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
bool isValidCoolantTemperature(float temperature);
|
2017-05-15 20:33:22 -07:00
|
|
|
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
bool isValidIntakeAirTemperature(float temperature);
|
2017-05-15 20:33:22 -07:00
|
|
|
bool hasIatSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
bool hasCltSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
void setThermistorConfiguration(ThermistorConf * tc, float temp1, float r1, float temp2, float r2, float temp3,
|
|
|
|
float r3);
|
|
|
|
|
|
|
|
class Engine;
|
|
|
|
|
2017-05-15 20:33:22 -07:00
|
|
|
void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
void setCommonNTCSensor(ThermistorConf *thermistorConf);
|
|
|
|
void setDodgeSensor(ThermistorConf *thermistorConf);
|
|
|
|
|
|
|
|
#endif /* THERMISTORS_H_ */
|