<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<b>Hi all,</b></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I¡¦d like to start a discussion about a section of code in<br>
<code><a title="https://github.com/openbmc/phosphor-pid-control/blob/master/pid/pidcontroller.cpp" href="https://github.com/openbmc/phosphor-pid-control/blob/master/pid/pidcontroller.cpp">phosphor-pid-control/pid/pidcontroller.cpp</a></code><a title="https://github.com/openbmc/phosphor-pid-control/blob/master/pid/pidcontroller.cpp" href="https://github.com/openbmc/phosphor-pid-control/blob/master/pid/pidcontroller.cpp">.</a><br>
Since it¡¦s a bit difficult to fully explain my thoughts on Gerrit,<br>
I¡¦m sending this email instead.</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<i><img size="64317" style="width: 568.296px; height: 651px; max-width: 1382px;" height="651" width="568" id="image_0" data-outlook-trace="F:1|T:1" src="cid:6879d019-62da-4dcf-a821-9652adc1d422"></i></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I believe that when the closed loop <b>leaves the hysteresis region</b>,<br>
it¡¦s better <b>not to reset the integral term and output directly to zero</b>.<br>
The previous design might have intended to prevent <b>integral wind-up</b>,<br>
but now that we have <b>ILimitMax</b> and <b>ILimitMin</b>,<br>
the integration range is already well constrained.</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Instead of an abrupt reset, allowing a <b>time-based decay</b> toward zero<br>
better reflects the behavior of a standard PID controller<br>
and helps avoid large output transients when the input crosses the hysteresis boundary.</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Below are simulation results comparing two approaches<br>
one using <b>gradual decay over time</b>, and another using a <b>direct reset</b>.</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<i><img size="149610" style="width: 622px; height: 543px; max-width: 1382px;" height="543" width="622" id="image_1" data-outlook-trace="F:1|T:1" src="cid:8a8d9d42-3b1b-42b3-8378-c43b830c7ae7"></i></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<i><img size="64470" style="width: 609px; height: 532px; max-width: 1382px;" height="532" width="609" id="image_2" data-outlook-trace="F:1|T:1" src="cid:051bfa4b-99e2-4908-937d-5baf1c9dbb7b"></i></div>
<hr>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<b>Dynamic Setpoint</b></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I also tried a <b>dynamic setpoint</b> approach,<br>
which helps reduce output variations when leaving the hysteresis region<br>
(as can be observed around <i>Time 7</i> and <i>Time 8</i>).</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<i><img size="30668" style="width: 732.743px; height: 72px; max-width: 1382px;" height="72" width="732" id="image_3" data-outlook-trace="F:1|T:1" src="cid:7ab3e01d-5ce5-40e5-b574-b875b63266c0"></i></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<i><img size="138940" style="width: 730.588px; height: 421px; max-width: 1382px;" height="421" width="730" id="image_4" data-outlook-trace="F:1|T:1" src="cid:7a99cc45-e726-4219-bfe6-afa424782829"></i></div>
<hr>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<b>References</b></div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
For more detailed explanations of the <b>PID mathematical model</b>,<br>
<b>integral saturation</b>, <b>hysteresis behavior</b>, and <b>dynamic setpoint</b>, please see:</div>
<ul data-start="1639" data-end="1926">
<li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin-top: 1em; margin-bottom: 1em;" role="presentation"><a data-start="1641" data-end="1771" rel="noopener" class="decorated-link OWAAutoLink" id="OWAad82d1af-eaa9-bba5-210a-20b51be7df3c" target="_new" href="https://github.com/YouPengWu/MyMD/blob/main/docs/phosphor-pid-control/PID_Control_Documentation.md">PID_Control_Documentation.md</a></div>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin-top: 1em; margin-bottom: 1em;" role="presentation"><a data-start="1776" data-end="1924" rel="noopener" class="decorated-link OWAAutoLink" id="OWA22a0b31d-455a-0da4-3acc-bb64b9ff2d6d" target="_new" href="https://github.com/YouPengWu/MyMD/blob/main/docs/phosphor-pid-control/Discussion_on_PID_Hysteresis_Reset.md">Discussion_on_PID_Hysteresis_Reset.md</a></div>
</li></ul>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
The related Gerrit change can be found here:<br>
<a data-start="1975" data-end="2042" rel="noopener" class="decorated-link OWAAutoLink" id="OWA53cb6966-7139-f8e9-255e-7d296eafe4b8" target="_new" href="https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/84144">https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/84144</a></div>
<hr>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Best regards,<br>
<b>YouPeng Wu</b></div>
<div class="elementToProof"><br>
</div>
</body>
</html>