fix: split inner-loop yi_max clamp to fix HOLD-state windup overshoot
Renames pid_hold/pid_heat/pid_cool to pid_outer/pid_inner/pid_inner_cool
to match what actually runs when, and splits inner-loop config into
Inner.Heat/Inner.Hold/Inner.Cool so the same PID instance gets a tight
yi_max ceiling only while HOLD drives it, without capping legitimate
1.5 K/min ramps. Fixes the overshoot from docs/overshoot_hold_windup.md
where a cold-water disturbance during HOLD wound up pid_heat's integral
term with no anti-windup engagement, taking ~35s+ to unwind naturally.
Breaking config change: Hold/Heat/Cool -> Outer/Inner.{Heat,Hold,Cool}
in config.json, both .tpl templates, the pid/sud demo scripts, and
replay_sim.py's CLI flags. Adds tests/components/pid/ (stdlib unittest)
covering the Pid clamp/recovery behavior and closed-loop disturbance,
ramp, and HOLD<->HEAT transition cases.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DGQhVQ2Y3yXAQTXhrxVd5u
This commit is contained in:
@@ -6,23 +6,32 @@ from components.pid.temp_controller import TempController
|
||||
|
||||
if __name__ == '__main__':
|
||||
ctrl_params = {
|
||||
"Hold": {
|
||||
"Outer": {
|
||||
"kp": 0.4,
|
||||
"ki": 0.0,
|
||||
"kd": 0.0,
|
||||
"kt": 0.0
|
||||
},
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
"Inner": {
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Hold": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5,
|
||||
"yi_max": 0.3
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,23 +6,32 @@ from components.pid.temp_controller_smith import TempController
|
||||
|
||||
if __name__ == '__main__':
|
||||
ctrl_params = {
|
||||
"Hold": {
|
||||
"Outer": {
|
||||
"kp": 0.4,
|
||||
"ki": 0.0,
|
||||
"kd": 0.0,
|
||||
"kt": 0.0
|
||||
},
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
"Inner": {
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Hold": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5,
|
||||
"yi_max": 0.3
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.008,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,23 +17,32 @@ if __name__ == '__main__':
|
||||
theta_amb = 20
|
||||
|
||||
ctrl_params = {
|
||||
"Hold": {
|
||||
"Outer": {
|
||||
"kp": 0.4,
|
||||
"ki": 0.0,
|
||||
"kd": 0.0,
|
||||
"kt": 0.0
|
||||
},
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.02,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.02,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
"Inner": {
|
||||
"Heat": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.02,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
},
|
||||
"Hold": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.02,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5,
|
||||
"yi_max": 0.3
|
||||
},
|
||||
"Cool": {
|
||||
"kp": 0.08,
|
||||
"ki": 0.02,
|
||||
"kd": 0.0,
|
||||
"kt": 1.5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user