Heater for threaded program
Dependents: LEX_Threaded_Programming
Diff: Heater.h
- Revision:
- 20:2d34a03ae57e
- Parent:
- 19:fccdd7127f94
- Child:
- 23:947850bbf325
diff -r fccdd7127f94 -r 2d34a03ae57e Heater.h --- a/Heater.h Tue Jul 30 21:32:49 2019 +0000 +++ b/Heater.h Wed Aug 07 16:03:27 2019 +0000 @@ -11,18 +11,18 @@ #include "ADS8568_ADC.h" #include "FastPWM.h" -#define MEAS_DELAY 50 // measurement delay for ADC in us +#define MEAS_DELAY 60 // measurement delay for ADC in us #define WAIT_DELAY 3 // wait delay for ADC in ms #define N_ROLL_AVG 1 // rolling average for R values #define ALL_CH 15 //value of convst bus to read all chanels simultaneosly -#define Kp 30.0f //proportional gain -#define Ti 0.75f //Integration time -#define Kd 0.0f //Differentiator gain -#define WIND_UP_LIMIT 0.01f //The change in error which turns off the integral term +#define Kp 0.2f //proportional gain +#define Ti 0.5f //Integration time +#define Kd 0.1f //Differentiator gain +#define WIND_UP_LIMIT 0.1f //The change in error which turns off the integral term #define PWM_PERIOD 5 //Period of Pwm for the motor in us -#define LOG_LIM 100 //Number of reads before the result is logged -#define GUARD_PWM_RATIO 0.25 //Ratio of guard duty cycle to heater duty cycle +#define LOG_LIM 30 //Number of reads before the result is logged +#define GUARD_PWM_RATIO 0.1 //Ratio of guard duty cycle to heater duty cycle class Heater @@ -85,7 +85,7 @@ const int i_port; //ADC port which corresponds to current measurements const int v_port; //ADC port which corresponds to voltage measurements FastPWM * drive; //Pointer to the driver - FastPWM * guard; //Pointer to the guard + FastPWM * guard; //Pointer to the guard //Heater correlations give temperature for a given resistance (assume linear relationship) const float corr_grad;