Heater files
Dependents: LEX-Demo-Firmware-Logging LEX-Demo-Firmware-Logging
Diff: Heater.h
- Revision:
- 12:8a048f111140
- Parent:
- 11:785a0329f802
- Child:
- 14:f266bf960b8d
diff -r 785a0329f802 -r 8a048f111140 Heater.h --- a/Heater.h Tue Jul 23 08:04:51 2019 +0000 +++ b/Heater.h Tue Jul 23 09:41:53 2019 +0000 @@ -10,9 +10,13 @@ #include "mbed.h" #include "ADS8568_ADC.h" -#define MEAS_DELAY 40 // measurement delay for ADC -#define N_ROLL_AVG 5 // rolling average for R values +#define MEAS_DELAY 50 // measurement delay for ADC +#define WAIT_DELAY 5 // wait delay for ADC + +#define N_ROLL_AVG 3 // rolling average for R values #define ALL_CH 15 //value of convst bus to read all chanels simultaneosly +#define Kd 20 //proportional gain +#define Ki 30 class Heater { @@ -24,7 +28,7 @@ * @param drive, the motor drive * @param R_ref, the target value for R */ - Heater(int i_port, int v_port, DigitalOut drive, float corr_grad, float corr_int, float R_ref = 1); + Heater(int i_port, int v_port, PwmOut drive, float corr_grad, float corr_int, float R_ref = 1); //Public member functions @@ -61,10 +65,12 @@ int v; float R; float R_ref; + float error; + float error_integrated; int i_port; int v_port; - DigitalOut drive; + PwmOut drive; //Heater correlations give temperature for a given resistance (assume linear relationship) float corr_grad;