dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
controlt.h@1:5c42ec7f1aeb, 2016-02-22 (annotated)
- Committer:
- sbh9428
- Date:
- Mon Feb 22 06:03:11 2016 +0000
- Revision:
- 1:5c42ec7f1aeb
- Parent:
- 0:9bfc4aea91e2
- Child:
- 2:4c51394fb35b
PID?;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sbh9428 | 0:9bfc4aea91e2 | 1 | /* |
sbh9428 | 0:9bfc4aea91e2 | 2 | * controlt.h |
sbh9428 | 0:9bfc4aea91e2 | 3 | * |
sbh9428 | 0:9bfc4aea91e2 | 4 | * Created on: 2016. 2. 19. |
sbh9428 | 0:9bfc4aea91e2 | 5 | * Author: sbh9428 |
sbh9428 | 0:9bfc4aea91e2 | 6 | */ |
sbh9428 | 0:9bfc4aea91e2 | 7 | |
sbh9428 | 0:9bfc4aea91e2 | 8 | #ifndef CONTROLT_H_ |
sbh9428 | 0:9bfc4aea91e2 | 9 | #define CONTROLT_H_ |
sbh9428 | 0:9bfc4aea91e2 | 10 | |
sbh9428 | 0:9bfc4aea91e2 | 11 | #include "tempsensort.h" |
sbh9428 | 0:9bfc4aea91e2 | 12 | #include "peltiert.h" |
sbh9428 | 0:9bfc4aea91e2 | 13 | |
sbh9428 | 0:9bfc4aea91e2 | 14 | class control_t { |
sbh9428 | 0:9bfc4aea91e2 | 15 | public: |
sbh9428 | 0:9bfc4aea91e2 | 16 | float get_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 17 | void control_PWM(float _PWM); |
sbh9428 | 0:9bfc4aea91e2 | 18 | void control_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 19 | |
sbh9428 | 0:9bfc4aea91e2 | 20 | void set_mode(int _mode); |
sbh9428 | 1:5c42ec7f1aeb | 21 | void set_target_temp(float _target_temp); |
sbh9428 | 1:5c42ec7f1aeb | 22 | void set_PWM_value(float _PWM_value); |
sbh9428 | 1:5c42ec7f1aeb | 23 | void set_P_value(float _P_value); |
sbh9428 | 1:5c42ec7f1aeb | 24 | void set_I_value(float _I_value); |
sbh9428 | 1:5c42ec7f1aeb | 25 | void set_D_value(float _D_value); |
sbh9428 | 1:5c42ec7f1aeb | 26 | |
sbh9428 | 1:5c42ec7f1aeb | 27 | void refresh_PWM(); |
sbh9428 | 1:5c42ec7f1aeb | 28 | |
sbh9428 | 1:5c42ec7f1aeb | 29 | int get_mode(); |
sbh9428 | 1:5c42ec7f1aeb | 30 | float get_target_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 31 | float get_P_value(); |
sbh9428 | 1:5c42ec7f1aeb | 32 | float get_I_value(); |
sbh9428 | 1:5c42ec7f1aeb | 33 | float get_D_value(); |
sbh9428 | 1:5c42ec7f1aeb | 34 | float get_PWM_value(); |
sbh9428 | 1:5c42ec7f1aeb | 35 | |
sbh9428 | 1:5c42ec7f1aeb | 36 | float calc_P(); |
sbh9428 | 1:5c42ec7f1aeb | 37 | float calc_I(); |
sbh9428 | 1:5c42ec7f1aeb | 38 | float calc_D(); |
sbh9428 | 1:5c42ec7f1aeb | 39 | |
sbh9428 | 1:5c42ec7f1aeb | 40 | void write_log(); |
sbh9428 | 1:5c42ec7f1aeb | 41 | |
sbh9428 | 0:9bfc4aea91e2 | 42 | control_t(); |
sbh9428 | 0:9bfc4aea91e2 | 43 | control_t(temp_sensor_t* _temp_sensor, peltier_t* _peltier); |
sbh9428 | 0:9bfc4aea91e2 | 44 | virtual ~control_t(); |
sbh9428 | 0:9bfc4aea91e2 | 45 | private: |
sbh9428 | 1:5c42ec7f1aeb | 46 | float P_value; |
sbh9428 | 1:5c42ec7f1aeb | 47 | float I_value; |
sbh9428 | 1:5c42ec7f1aeb | 48 | float D_value; |
sbh9428 | 1:5c42ec7f1aeb | 49 | |
sbh9428 | 1:5c42ec7f1aeb | 50 | float PWM_value; |
sbh9428 | 1:5c42ec7f1aeb | 51 | |
sbh9428 | 1:5c42ec7f1aeb | 52 | float target_temp; |
sbh9428 | 1:5c42ec7f1aeb | 53 | |
sbh9428 | 1:5c42ec7f1aeb | 54 | float dif; |
sbh9428 | 1:5c42ec7f1aeb | 55 | |
sbh9428 | 1:5c42ec7f1aeb | 56 | float temp_log[10]; |
sbh9428 | 1:5c42ec7f1aeb | 57 | int log_count; |
sbh9428 | 1:5c42ec7f1aeb | 58 | |
sbh9428 | 1:5c42ec7f1aeb | 59 | float table[201]; |
sbh9428 | 1:5c42ec7f1aeb | 60 | int table_count; |
sbh9428 | 1:5c42ec7f1aeb | 61 | int table_min; |
sbh9428 | 1:5c42ec7f1aeb | 62 | int table_max; |
sbh9428 | 1:5c42ec7f1aeb | 63 | |
sbh9428 | 0:9bfc4aea91e2 | 64 | temp_sensor_t* temp_sensor; |
sbh9428 | 0:9bfc4aea91e2 | 65 | peltier_t* peltier; |
sbh9428 | 0:9bfc4aea91e2 | 66 | |
sbh9428 | 0:9bfc4aea91e2 | 67 | int mode;//0: stop 1: set pwm 2: set temp |
sbh9428 | 0:9bfc4aea91e2 | 68 | }; |
sbh9428 | 0:9bfc4aea91e2 | 69 | |
sbh9428 | 0:9bfc4aea91e2 | 70 | #endif /* CONTROLT_H_ */ |
sbh9428 | 0:9bfc4aea91e2 | 71 |