Files
brewpi/components/pid/tc_constants.py
T
jensandClaude Sonnet 4.6 4256622e9d Make FSM hysteresis thresholds configurable
THRESH_HOLD_IDLE/HOLD_HEAT/IDLE_HEAT/IDLE_HOLD/HEAT_HOLD/HEAT_IDLE in
tc_constants.py were hardcoded module-level constants shared by every
controller instance, so tuning the IDLE/HOLD/HEAT hysteresis required
a code change.

Replace them with DEFAULT_THRESHOLDS plus an optional
TempCtrl.Thresholds config section, merged at construction time in
TempControllerBase.__init__ so configs that omit the section keep
behaving exactly as before. Documented the new section in
config.json.templ; left config.json.sim without it to exercise the
default-fallback path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:09:39 +02:00

61 lines
740 B
Python

from enum import Enum
class States(Enum):
INIT = -1,
IDLE = 0,
HEAT = 1,
HOLD = 2
DEFAULT_THRESHOLDS = {
"HoldIdle": 0.1,
"HoldHeat": 1.0,
"IdleHeat": 1.0,
"IdleHold": 0.1,
"HeatHold": 1.0,
"HeatIdle": 1.0
}
class Test:
tc_ctrl_params = {
"Kalman": {
"var_P": 1.0,
"var_Q": 0.0001,
"var_R": 1.0
},
"Hold": {
"kp": 0.4,
"ki": 0.0,
"kd": 0.0,
"kt": 0.0
},
"Heat": {
"kp": 0.02,
"ki": 0.01,
"kd": 0.0,
"kt": 1.5
}
}
tc_model_params = {
"theta" : 20,
"C" : 4190,
"M" : 20,
"L" : 0.01,
"Td" : 30,
"kn" : 0.2,
"gain" : 1.0
}
tc_pot_params = {
"theta" : 20,
"C" : 4190,
"M" : 20,
"L" : 0.01,
"Td" : 30,
"kn" : 0.2,
"gain" : 1.0
}