dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
controlt.h@2:4c51394fb35b, 2016-03-02 (annotated)
- Committer:
- sbh9428
- Date:
- Wed Mar 02 16:33:23 2016 +0000
- Revision:
- 2:4c51394fb35b
- Parent:
- 1:5c42ec7f1aeb
- Child:
- 3:72644690e2e6
00;
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 | 2:4c51394fb35b | 11 | #include "BufferedSerial.h" |
sbh9428 | 0:9bfc4aea91e2 | 12 | #include "tempsensort.h" |
sbh9428 | 0:9bfc4aea91e2 | 13 | #include "peltiert.h" |
sbh9428 | 0:9bfc4aea91e2 | 14 | |
sbh9428 | 0:9bfc4aea91e2 | 15 | class control_t { |
sbh9428 | 0:9bfc4aea91e2 | 16 | public: |
sbh9428 | 0:9bfc4aea91e2 | 17 | float get_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 18 | void control_PWM(float _PWM); |
sbh9428 | 0:9bfc4aea91e2 | 19 | void control_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 20 | |
sbh9428 | 0:9bfc4aea91e2 | 21 | void set_mode(int _mode); |
sbh9428 | 1:5c42ec7f1aeb | 22 | void set_target_temp(float _target_temp); |
sbh9428 | 1:5c42ec7f1aeb | 23 | void set_PWM_value(float _PWM_value); |
sbh9428 | 1:5c42ec7f1aeb | 24 | void set_P_value(float _P_value); |
sbh9428 | 1:5c42ec7f1aeb | 25 | void set_I_value(float _I_value); |
sbh9428 | 1:5c42ec7f1aeb | 26 | void set_D_value(float _D_value); |
sbh9428 | 1:5c42ec7f1aeb | 27 | |
sbh9428 | 1:5c42ec7f1aeb | 28 | void refresh_PWM(); |
sbh9428 | 1:5c42ec7f1aeb | 29 | |
sbh9428 | 1:5c42ec7f1aeb | 30 | int get_mode(); |
sbh9428 | 1:5c42ec7f1aeb | 31 | float get_target_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 32 | float get_P_value(); |
sbh9428 | 1:5c42ec7f1aeb | 33 | float get_I_value(); |
sbh9428 | 1:5c42ec7f1aeb | 34 | float get_D_value(); |
sbh9428 | 1:5c42ec7f1aeb | 35 | float get_PWM_value(); |
sbh9428 | 2:4c51394fb35b | 36 | int get_table_count(); |
sbh9428 | 1:5c42ec7f1aeb | 37 | |
sbh9428 | 1:5c42ec7f1aeb | 38 | float calc_P(); |
sbh9428 | 1:5c42ec7f1aeb | 39 | float calc_I(); |
sbh9428 | 1:5c42ec7f1aeb | 40 | float calc_D(); |
sbh9428 | 1:5c42ec7f1aeb | 41 | |
sbh9428 | 1:5c42ec7f1aeb | 42 | void write_log(); |
sbh9428 | 1:5c42ec7f1aeb | 43 | |
sbh9428 | 2:4c51394fb35b | 44 | void print_table(); |
sbh9428 | 2:4c51394fb35b | 45 | |
sbh9428 | 0:9bfc4aea91e2 | 46 | control_t(); |
sbh9428 | 2:4c51394fb35b | 47 | control_t(temp_sensor_t* _temp_sensor, peltier_t* _peltier,BufferedSerial* _pc); |
sbh9428 | 0:9bfc4aea91e2 | 48 | virtual ~control_t(); |
sbh9428 | 0:9bfc4aea91e2 | 49 | private: |
sbh9428 | 1:5c42ec7f1aeb | 50 | float P_value; |
sbh9428 | 1:5c42ec7f1aeb | 51 | float I_value; |
sbh9428 | 1:5c42ec7f1aeb | 52 | float D_value; |
sbh9428 | 1:5c42ec7f1aeb | 53 | |
sbh9428 | 1:5c42ec7f1aeb | 54 | float PWM_value; |
sbh9428 | 1:5c42ec7f1aeb | 55 | |
sbh9428 | 1:5c42ec7f1aeb | 56 | float target_temp; |
sbh9428 | 1:5c42ec7f1aeb | 57 | |
sbh9428 | 1:5c42ec7f1aeb | 58 | float dif; |
sbh9428 | 1:5c42ec7f1aeb | 59 | |
sbh9428 | 1:5c42ec7f1aeb | 60 | float temp_log[10]; |
sbh9428 | 2:4c51394fb35b | 61 | float PWM_log[10]; |
sbh9428 | 1:5c42ec7f1aeb | 62 | int log_count; |
sbh9428 | 1:5c42ec7f1aeb | 63 | |
sbh9428 | 1:5c42ec7f1aeb | 64 | float table[201]; |
sbh9428 | 1:5c42ec7f1aeb | 65 | int table_count; |
sbh9428 | 2:4c51394fb35b | 66 | int table_mode; |
sbh9428 | 2:4c51394fb35b | 67 | |
sbh9428 | 2:4c51394fb35b | 68 | void build_table(); |
sbh9428 | 2:4c51394fb35b | 69 | |
sbh9428 | 0:9bfc4aea91e2 | 70 | temp_sensor_t* temp_sensor; |
sbh9428 | 0:9bfc4aea91e2 | 71 | peltier_t* peltier; |
sbh9428 | 2:4c51394fb35b | 72 | BufferedSerial *pc; |
sbh9428 | 0:9bfc4aea91e2 | 73 | |
sbh9428 | 0:9bfc4aea91e2 | 74 | int mode;//0: stop 1: set pwm 2: set temp |
sbh9428 | 0:9bfc4aea91e2 | 75 | }; |
sbh9428 | 0:9bfc4aea91e2 | 76 | |
sbh9428 | 0:9bfc4aea91e2 | 77 | #endif /* CONTROLT_H_ */ |
sbh9428 | 0:9bfc4aea91e2 | 78 |