dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
controlt.h@10:c751a0e8b7f9, 2016-07-11 (annotated)
- Committer:
- sbh9428
- Date:
- Mon Jul 11 01:05:52 2016 +0000
- Revision:
- 10:c751a0e8b7f9
- Parent:
- 6:c2fb5c188e8a
fff;
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 | 3:72644690e2e6 | 27 | void set_period(int _period); |
sbh9428 | 4:7ca449fca19b | 28 | void set_start_temp(float _start_temp); |
sbh9428 | 1:5c42ec7f1aeb | 29 | |
sbh9428 | 1:5c42ec7f1aeb | 30 | void refresh_PWM(); |
sbh9428 | 1:5c42ec7f1aeb | 31 | |
sbh9428 | 1:5c42ec7f1aeb | 32 | int get_mode(); |
sbh9428 | 1:5c42ec7f1aeb | 33 | float get_target_temp(); |
sbh9428 | 1:5c42ec7f1aeb | 34 | float get_P_value(); |
sbh9428 | 1:5c42ec7f1aeb | 35 | float get_I_value(); |
sbh9428 | 1:5c42ec7f1aeb | 36 | float get_D_value(); |
sbh9428 | 1:5c42ec7f1aeb | 37 | float get_PWM_value(); |
sbh9428 | 3:72644690e2e6 | 38 | int get_period(); |
sbh9428 | 3:72644690e2e6 | 39 | int get_table_check(); |
sbh9428 | 2:4c51394fb35b | 40 | int get_table_count(); |
sbh9428 | 1:5c42ec7f1aeb | 41 | |
sbh9428 | 1:5c42ec7f1aeb | 42 | float calc_P(); |
sbh9428 | 1:5c42ec7f1aeb | 43 | float calc_I(); |
sbh9428 | 1:5c42ec7f1aeb | 44 | float calc_D(); |
sbh9428 | 1:5c42ec7f1aeb | 45 | |
sbh9428 | 1:5c42ec7f1aeb | 46 | void write_log(); |
sbh9428 | 1:5c42ec7f1aeb | 47 | |
sbh9428 | 2:4c51394fb35b | 48 | void print_table(); |
sbh9428 | 3:72644690e2e6 | 49 | void follow_table(); |
sbh9428 | 2:4c51394fb35b | 50 | |
sbh9428 | 10:c751a0e8b7f9 | 51 | float highTemp; |
sbh9428 | 10:c751a0e8b7f9 | 52 | float lowTemp; |
sbh9428 | 10:c751a0e8b7f9 | 53 | |
sbh9428 | 10:c751a0e8b7f9 | 54 | int highTempTime; |
sbh9428 | 10:c751a0e8b7f9 | 55 | int lowTempTime; |
sbh9428 | 10:c751a0e8b7f9 | 56 | int periodNumber; |
sbh9428 | 10:c751a0e8b7f9 | 57 | |
sbh9428 | 10:c751a0e8b7f9 | 58 | void repeatPeriod(); |
sbh9428 | 10:c751a0e8b7f9 | 59 | |
sbh9428 | 10:c751a0e8b7f9 | 60 | int repeatTime; |
sbh9428 | 10:c751a0e8b7f9 | 61 | int repeatCount; |
sbh9428 | 10:c751a0e8b7f9 | 62 | int repeatSide; |
sbh9428 | 10:c751a0e8b7f9 | 63 | |
sbh9428 | 0:9bfc4aea91e2 | 64 | control_t(); |
sbh9428 | 2:4c51394fb35b | 65 | control_t(temp_sensor_t* _temp_sensor, peltier_t* _peltier,BufferedSerial* _pc); |
sbh9428 | 0:9bfc4aea91e2 | 66 | virtual ~control_t(); |
sbh9428 | 0:9bfc4aea91e2 | 67 | private: |
sbh9428 | 1:5c42ec7f1aeb | 68 | float P_value; |
sbh9428 | 1:5c42ec7f1aeb | 69 | float I_value; |
sbh9428 | 1:5c42ec7f1aeb | 70 | float D_value; |
sbh9428 | 1:5c42ec7f1aeb | 71 | |
sbh9428 | 1:5c42ec7f1aeb | 72 | float PWM_value; |
sbh9428 | 1:5c42ec7f1aeb | 73 | |
sbh9428 | 1:5c42ec7f1aeb | 74 | float target_temp; |
sbh9428 | 1:5c42ec7f1aeb | 75 | |
sbh9428 | 1:5c42ec7f1aeb | 76 | float dif; |
sbh9428 | 1:5c42ec7f1aeb | 77 | |
sbh9428 | 1:5c42ec7f1aeb | 78 | float temp_log[10]; |
sbh9428 | 2:4c51394fb35b | 79 | float PWM_log[10]; |
sbh9428 | 1:5c42ec7f1aeb | 80 | int log_count; |
sbh9428 | 1:5c42ec7f1aeb | 81 | |
sbh9428 | 6:c2fb5c188e8a | 82 | int time; |
sbh9428 | 6:c2fb5c188e8a | 83 | |
sbh9428 | 1:5c42ec7f1aeb | 84 | float table[201]; |
sbh9428 | 1:5c42ec7f1aeb | 85 | int table_count; |
sbh9428 | 2:4c51394fb35b | 86 | int table_mode; |
sbh9428 | 3:72644690e2e6 | 87 | int table_check; |
sbh9428 | 3:72644690e2e6 | 88 | float table_min; |
sbh9428 | 3:72644690e2e6 | 89 | float table_max; |
sbh9428 | 4:7ca449fca19b | 90 | float start_temp; |
sbh9428 | 3:72644690e2e6 | 91 | |
sbh9428 | 3:72644690e2e6 | 92 | int period; |
sbh9428 | 3:72644690e2e6 | 93 | int step; |
sbh9428 | 2:4c51394fb35b | 94 | |
sbh9428 | 2:4c51394fb35b | 95 | void build_table(); |
sbh9428 | 3:72644690e2e6 | 96 | float find_table(float _temp); |
sbh9428 | 2:4c51394fb35b | 97 | |
sbh9428 | 0:9bfc4aea91e2 | 98 | temp_sensor_t* temp_sensor; |
sbh9428 | 0:9bfc4aea91e2 | 99 | peltier_t* peltier; |
sbh9428 | 2:4c51394fb35b | 100 | BufferedSerial *pc; |
sbh9428 | 0:9bfc4aea91e2 | 101 | |
sbh9428 | 0:9bfc4aea91e2 | 102 | int mode;//0: stop 1: set pwm 2: set temp |
sbh9428 | 0:9bfc4aea91e2 | 103 | }; |
sbh9428 | 0:9bfc4aea91e2 | 104 | |
sbh9428 | 0:9bfc4aea91e2 | 105 | #endif /* CONTROLT_H_ */ |
sbh9428 | 0:9bfc4aea91e2 | 106 |