dd

Dependencies:   BufferedSerial FastAnalogIn FastPWM mbed SHT75

controlt.h

Committer:
sbh9428
Date:
2016-03-02
Revision:
2:4c51394fb35b
Parent:
1:5c42ec7f1aeb
Child:
3:72644690e2e6

File content as of revision 2:4c51394fb35b:

/*
 * controlt.h
 *
 *  Created on: 2016. 2. 19.
 *      Author: sbh9428
 */

#ifndef CONTROLT_H_
#define CONTROLT_H_

#include "BufferedSerial.h"
#include "tempsensort.h"
#include "peltiert.h"

class control_t {
public:
	float get_temp();
	void control_PWM(float _PWM);
	void control_temp();
	
	void set_mode(int _mode);
	void set_target_temp(float _target_temp);
	void set_PWM_value(float _PWM_value);
	void set_P_value(float _P_value);
	void set_I_value(float _I_value);
	void set_D_value(float _D_value);
	
	void refresh_PWM();
	
	int get_mode();
	float get_target_temp();
	float get_P_value();
	float get_I_value();
	float get_D_value();
	float get_PWM_value();
	int get_table_count();
	
	float calc_P();
	float calc_I();
	float calc_D();
	
	void write_log();
	
	void print_table();
	
	control_t();
	control_t(temp_sensor_t* _temp_sensor, peltier_t* _peltier,BufferedSerial* _pc);
	virtual ~control_t();
private:
	float P_value;
	float I_value;
	float D_value;
	
	float PWM_value;
	
	float target_temp;
	
	float dif;
	
	float temp_log[10];
	float PWM_log[10];
	int log_count;
	
	float table[201];
	int table_count;
	int table_mode;
	
	void build_table();
	
	temp_sensor_t* temp_sensor;
	peltier_t* peltier;
	BufferedSerial *pc;
	
	int mode;//0: stop 1: set pwm 2: set temp
};

#endif /* CONTROLT_H_ */