Heater for threaded program
Dependents: LEX_Threaded_Programming_V3
Diff: Heater.h
- Revision:
- 31:7c6f05326c4d
- Parent:
- 30:055d856f05b5
- Child:
- 32:34921454e932
--- a/Heater.h Thu Aug 29 16:07:56 2019 +0000 +++ b/Heater.h Fri Aug 30 14:58:47 2019 +0000 @@ -12,9 +12,11 @@ #include "FastPWM.h" #include "memspcr.pb.h" +//TODO Put these in the configuration file -#define WIND_UP_LIMIT 0.1f //The change in error which turns off the integral term +#define WIND_UP_LIMIT 0.002f //The change in error which turns off the integral term +#define PWM_LIMIT 0.6f class Heater { @@ -27,13 +29,12 @@ * @param * drive is a pointer to the main heater * @param * guard is a pointer to the guard heater **/ - Heater(const int i_port, const int v_port, FastPWM * drive, FastPWM * guard, const memspcr_ThermalConfiguration & thermal = memspcr_ThermalConfiguration_init_zero); + Heater(const int i_port, const int v_port, FastPWM * drive, FastPWM * guard, ADS8568_ADC * adc, DigitalIn adc_busy, const memspcr_ThermalConfiguration & thermal = memspcr_ThermalConfiguration_init_zero); //Public member functions void read(); //Updates the resistance and error values for the heater void update(); //Holds R_ref for hold_time miliseconds - void log() const; //Prints the current state of the heater void turn_on(); //Turns the heater on void turn_off(); //Turns the heater off @@ -41,14 +42,13 @@ //Getters and setters void Set_ref(float R); void Set_D(float D); + int Get_D() const; int Get_i() const; int Get_v() const; float Get_R() const; - - - - - + float Get_R_ref() const; + float Get_error() const; + float Get_error_integrated() const; protected: @@ -59,7 +59,8 @@ float R_ref; //Current referance for resistance float error; //R_ref - R float error_integrated; //Integrated error - + ADS8568_ADC * adc; + DigitalIn adc_busy; int i_port; //ADC port which corresponds to current measurements int v_port; //ADC port which corresponds to voltage measurements FastPWM * drive; //Pointer to the driver