Draft:Take-back-half controller
{{AFC submission|d|nn|u=35.145.117.156|ns=118|decliner=Pythoncoder|declinets=20250609033720|ts=20250609032403}}
{{AFC comment|1=Only one source, need more —pythoncoder (talk | contribs) 03:37, 9 June 2025 (UTC)}}
----
{{Short description|Computer Algorithm}}
{{Draft topics|computing}}
{{AfC topic|stem}}
A Take-back-half controller is a feedback loop used to manage processes that are required to maintain a constant variable, frequently temperature or speed. It works based on integrating the difference between the measured variable and its setpoint in which it is desired to be at, while trying to minimize oscillation by decreasing the integral value every time that the sign of the error changes, dividing the integral term by 2 and adding a setpoint value which dynamically changes every time that the sign of the error swaps.
Pseudocode
previous_error := 0
integral := 0
tbh := 0
kH := 0
loop:
error := setpoint - measured_value
integral := integral + error
if not (sgn(error) == sgn(previous_error)):
integral := (integral + tbh) / 2
tbh = integral
previous_error = error
output := kH * integral
In this implementation kH is the singular tuning factor, directly multiplying the value, which is one of the major advantages of the Take-back-half algorithm, where tbh is the setpoint, which is automatically tuned at runtime, despite the algorithm's much simpler usage than other control algorithms such as PID, it has multiple problems that it frequently does better in, such as flywheel speed control.
References
Christopher Samuel Harper (2011) "[https://scholarsjunction.msstate.edu/td/718/ Application of the Take-Back-Half algorithm to voltage source converter current control]" - Mississippi State University