summaryrefslogtreecommitdiffstats
path: root/firmware/controller_temp.h
blob: e169166513e23d3189f9e9cbf99e83e4fe051aec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef CONTROLLER_TEMP_H_
#define CONTROLLER_TEMP_H_

#include "util.h"
#include "fixpt.h"


/* Temperature controller PID parameters */
#define CONTRTEMP_PID_KP_NORMAL		4.0
#define CONTRTEMP_PID_KI_NORMAL		0.04
#define CONTRTEMP_PID_KD_NORMAL		0.5
#define CONTRTEMP_PID_D_DECAY_NORMAL	1.2
/* Temperature controller boost (1) PID parameters */
#define CONTRTEMP_PID_KP_BOOST1		6.0
#define CONTRTEMP_PID_KI_BOOST1		0.08
#define CONTRTEMP_PID_KD_BOOST1		1.0
#define CONTRTEMP_PID_D_DECAY_BOOST1	1.5
/* Temperature controller boost (2) PID parameters */
#define CONTRTEMP_PID_KP_BOOST2		12.0
#define CONTRTEMP_PID_KI_BOOST2		0.1
#define CONTRTEMP_PID_KD_BOOST2		1.5
#define CONTRTEMP_PID_D_DECAY_BOOST2	1.5

/* Temperature controller limits. */
#define CONTRTEMP_NEGLIM		0.0
#define CONTRTEMP_POSLIM		480.0

/* Temperature to current mapping. */
#define CONTRTEMP_MAP_TEMPLO		0.0
#define CONTRTEMP_MAP_CURRLO		0.0
#define CONTRTEMP_MAP_TEMPHI		180.0
#define CONTRTEMP_MAP_CURRHI		5.0


enum contrtemp_boostmode {
	TEMPBOOST_NORMAL,
	TEMPBOOST_BOOST1,
	TEMPBOOST_BOOST2,

	NR_BOOST_MODES,
};


void contrtemp_set_feedback(fixpt_t r);
fixpt_t contrtemp_get_feedback(void);

void contrtemp_set_setpoint(fixpt_t w);
fixpt_t contrtemp_get_setpoint(void);

void contrtemp_set_enabled(bool enabled);
void contrtemp_set_emerg(bool emergency);
bool contrtemp_in_emerg(void);
bool contrtemp_is_heating_up(void);
enum contrtemp_boostmode contrtemp_get_boost_mode(void);
void contrtemp_update_pid_config(void);

void contrtemp_init(void);

#endif /* CONTROLLER_TEMP_H_ */
bues.ch cgit interface