dd

Dependencies:   BufferedSerial FastAnalogIn FastPWM mbed SHT75

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers controlt.h Source File

controlt.h

00001 /*
00002  * controlt.h
00003  *
00004  *  Created on: 2016. 2. 19.
00005  *      Author: sbh9428
00006  */
00007 
00008 #ifndef CONTROLT_H_
00009 #define CONTROLT_H_
00010 
00011 #include "BufferedSerial.h"
00012 #include "tempsensort.h"
00013 #include "peltiert.h"
00014 
00015 class control_t {
00016 public:
00017     float get_temp();
00018     void control_PWM(float _PWM);
00019     void control_temp();
00020     
00021     void set_mode(int _mode);
00022     void set_target_temp(float _target_temp);
00023     void set_PWM_value(float _PWM_value);
00024     void set_P_value(float _P_value);
00025     void set_I_value(float _I_value);
00026     void set_D_value(float _D_value);
00027     void set_period(int _period);
00028     void set_start_temp(float _start_temp);
00029     
00030     void refresh_PWM();
00031     
00032     int get_mode();
00033     float get_target_temp();
00034     float get_P_value();
00035     float get_I_value();
00036     float get_D_value();
00037     float get_PWM_value();
00038     int get_period();
00039     int get_table_check();
00040     int get_table_count();
00041     
00042     float calc_P();
00043     float calc_I();
00044     float calc_D();
00045     
00046     void write_log();
00047     
00048     void print_table();
00049     void follow_table();
00050     
00051     float highTemp;
00052     float lowTemp;
00053     
00054     int highTempTime;
00055     int lowTempTime;
00056     int periodNumber;
00057     
00058     void repeatPeriod();
00059     
00060     int repeatTime;
00061     int repeatCount;
00062     int repeatSide;
00063     
00064     control_t();
00065     control_t(temp_sensor_t* _temp_sensor, peltier_t* _peltier,BufferedSerial* _pc);
00066     virtual ~control_t();
00067 private:
00068     float P_value;
00069     float I_value;
00070     float D_value;
00071     
00072     float PWM_value;
00073     
00074     float target_temp;
00075     
00076     float dif;
00077     
00078     float temp_log[10];
00079     float PWM_log[10];
00080     int log_count;
00081     
00082     int time;
00083     
00084     float table[201];
00085     int table_count;
00086     int table_mode;
00087     int table_check;
00088     float table_min;
00089     float table_max;
00090     float start_temp;
00091     
00092     int period;
00093     int step;
00094     
00095     void build_table();
00096     float find_table(float _temp);
00097     
00098     temp_sensor_t* temp_sensor;
00099     peltier_t* peltier;
00100     BufferedSerial *pc;
00101     
00102     int mode;//0: stop 1: set pwm 2: set temp
00103 };
00104 
00105 #endif /* CONTROLT_H_ */
00106