{"id":8749,"date":"2024-05-28T08:01:03","date_gmt":"2024-05-28T00:01:03","guid":{"rendered":""},"modified":"2024-05-28T08:01:03","modified_gmt":"2024-05-28T00:01:03","slug":"\u98ce\u6247control mode_bios \u98ce\u6247\u8c03\u8282","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8749.html","title":{"rendered":"\u98ce\u6247control mode_bios \u98ce\u6247\u8c03\u8282"},"content":{"rendered":"
BMC\u7684\u98ce\u6247\u63a7\u5236\u7b97\u4e00\u4e2a\u86ee\u91cd\u8981\u7684\u529f\u80fd\uff0c\u90a3\u8fd9\u4e2a\u529f\u80fd\u5305\u542b\u4e86\"TACH\"\u548c\"PWM\"\u8fd9\u4e24\u4e2a\u5e38\u7528\u8baf\u53f7\u600e\u4e48\u89e3\u8bfb\uff0c\u8fd8\u6709\u6700\u5e38\u7528\u7684\u63a7\u5236\u6f14\u7b97\u6cd5\"PID(closed loop)\"\u548c\"Stepwise(openloop)\"\uff0c\u800cError control \uff0c\u56e0\u4e3a\u6bcf\u5bb6\u505a\u6cd5\u4e0d\u540c\uff0c\u5c31\u4e0d\u4f1a\u5728\u8fd9\u8fb9\u4f5c\u4ecb\u7ecd<\/p>\n
##\u5b9e\u4f5c\u4ee3\u7801\u662f\u6765\u81eaFacebook\u7684openBMC<\/p>\n<\/p>\n
\u5728\u670d\u52a1\u5668\u4e2d\u7684\u98ce\u6247\u662f\u975e\u5e38\u9ad8\u901f\u4e5f\u8017\u7535\u7684\uff0c\u6839\u636e\u7edf\u8ba1\u5728\u6570\u636e\u4e2d\u5fc3\u7684\u8fd0\u7ef4\u6210\u672c\u4e0a\uff0c\u7535\u8d39\u5360\u4e867\u6210\uff0c\u5e76\u4e14\u5982\u679c\u8ba9\u98ce\u6247\u957f\u671f\u5904\u5728\u5168\u8f6c\u72b6\u6001\u4e5f\u4f1a\u6709\u566a\u97f3\u548c\u8017\u635f\u5ea6\u7684\u95ee\u9898\u3002<\/p>\n
\u76ee\u524dCPU\u53ef\u4ee5\u8fbe\u5230\u5355\u4e00\u8017\u7535\u91cf200W\u4ee5\u4e0a\uff0c\u4f34\u968f\u800c\u6765\u7684\u9ad8\u70ed\u4e5f\u4f1a\u4f7f\u4e2a\u6676\u7247\u8001\u5316\u901f\u5ea6\u52a0\u5feb\uff0c\u5f53\u7136\u670d\u52d9\u5668\u4e2d\u7684SSD, NIC card, E1.S\u7b49\u88c5\u7f6e\u4e5f\u662f\u6709\u540c\u6837\u7684\u60c5\u51b5\uff0c\u56e0\u6b64\u6211\u4eec\u5e0c\u671b\u80fd\u6839\u636e\u8fd9\u4e9b\u9ad8\u70ed\u7684\u5143\u4ef6\u6e29\u5ea6\u6765\u51b3\u5b9a\u98ce\u6247\u7684\u8f6c\u901f\uff0c\u8fbe\u5230\u7701\u7535\u548c\u6b63\u5e38\u8fd0\u4f5c\u7684\u6548\u679c<\/p>\n
<\/p>\n<\/p>\n
PWM\u662f\u900f\u8fc7\u5e73\u5747\u7535\u538b\u6765\u4f20\u9012\u7c7b\u6bd4\u8baf\u53f7\uff0c\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u5728\u4e00\u4e2acycle\u4e2d\uff0c\u9ad8\u7535\u4e3a\u5360\u767e\u5206\u4e4b\u591a\u5c11\uff0c\u5c31\u8868\u793a\u4ed6\u8981\u4f20\u9012\u7684\u503c\u662f\u591a\u5c11<\/p>\n
\u4f8b\u5982\u5728\u4e00\u4e2a\u5468\u671f\u4e2d\uff0c\u5982\u679c\u9ad8\u7535\u4f4d\u536025%\uff0c\u4f4e\u7535\u4f4d\u536075%\uff0c\u8fd9\u6837\u8868\u793a\u6211\u4eec\u8981\u4f20\u9012\u7684\u503c\u662f25%\uff0c\u98ce\u6247\u5c31\u4f1a\u8f6c25%<\/p>\n
\u90a3\u5982\u679c\u4eca\u5929\u6211\u4eec\u90fd\u4e00\u76f4\u662fhigh (\u9ad8\u7535\u4f4d)\uff0c\u8fd9\u6837\u98ce\u6247\u5c31\u4f1a\u5168\u8f6c\uff0c\u56e0\u6b64\u5728\u7ebf\u8def\u56fe\u7684review\u8fc7\u7a0b\u4e2d\uff0c\u90fd\u4f1a\u6ce8\u610fPWM\u6709\u6ca1\u6709pull high\uff0c\u907f\u514d\u5728BMC\u66f4\u65b0\u8fc7\u7a0b\u6216\u662f\u6b7b\u6389\u540e\uff0c\u673a\u5668\u8fc7\u70ed<\/p>\n
\u90a3\u6bcf\u4e2a\u5468\u671f\u7684\u65f6\u95f4\u662f\u591a\u5c11\u5462? PWM\u7684\u4f20\u9012\u9891\u7387\u4f1a\u5b9a\u4e49\u5728\u98ce\u6247\u7684spec\u4e2d<\/strong>\uff0c\u6bcf\u4e00\u9897\u98ce\u6247\u7684\u63a5\u6536\u9891\u7387\u6709\u53ef\u80fd\u4f1a\u4e0d\u4e00\u6837<\/p>\n <\/p>\n \u6211\u4eec\u53ef\u4ee5\u900f\u8fc7Tach\u6765\u4f20\u9012\u98ce\u6247\u7684\u8f6c\u901f\uff0c\u6709\u4fee\u8fc7\u673a\u68b0\u65b9\u9762\u7684\u8bfe\u7a0b\u5c31\u4f1a\u77e5\u9053\uff0c\u9a6c\u8fbe\u4f1a\u6709n\u4e2a\u673a\u68b0\u539f\u70b9\uff0c\u4f20\u4e00\u5708\u7684\u8bdd\u4f1a\u4ea7\u751fn\u4e2apulse\uff0c\u4e00\u5708\u4f1a\u4ea7\u751f\u51e0\u4e2apulse\u4e5f\u662f\u5b9a\u4e49\u5728\u98ce\u6247\u7684spec\u4e2d<\/strong><\/p>\n \u5047\u5982\u4eca\u5929\u98ce\u6247\u8f6c\u4e00\u5708\u4f1a\u4ea7\u751f\u4e24\u4e2apulse\uff0c\u6211\u4eec\u5728\u4e00\u79d2\u5185\u6536\u52301000\u4e2apulse\uff0c\u8fd9\u6837\u8868\u793a\u98ce\u6247\u4e00\u79d2\u8f6c\u4e86500\u5708\uff0c\u98ce\u6247\u8f6c\u901f\u662f\u7528rpm(\u4e00\u5206\u949f\u8f6c\u51e0\u5708)\u8868\u793a\u7684\uff0c\u56e0\u6b64500*60 rpm\u5c31\u662f\u6211\u4eec\u8981\u6c42\u7684\u503c<\/p>\n TACH\u7684\u8baf\u53f7\u5927\u6982\u5c31\u957f\u5f97\u50cf\u5e95\u4e0b\u8fd9\u6837\uff0c\u53ea\u8981\u7edf\u8ba1\u4e00\u79d2\u949f\u6709\u51e0\u4e2a\u8baf\u53f7\uff0c\u5c31\u80fd\u5f97\u5230\u98ce\u6247\u7684\u8f6c\u901f<\/p>\n \u5728\u4f20\u7edf\u63a7\u5236(Classical Control )\u7406\u8bba\u4e2d\uff0c\u901a\u5e38\u4f1a\u7528\u6709\u6ca1\u6709feedback \u6765\u533a\u5206open loop control \u548c closed loop control\uff0c\u524d\u8005\u901a\u5e38\u5c31\u662f\u6211\u4eec\u5e38\u8bf4\u7684stepwise\uff0c\u540e\u8005\u5c31\u662f\u5de5\u4e1a\u63a7\u5236\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684PID control\uff0c\u4ed6\u4eec\u7684\u793a\u610f\u56fe\u5982\u4e0b\uff0c\u63a5\u4e0b\u6765\u4f1a\u5206\u522b\u4ecb\u7ecd\u8fd9\u4e24\u4e2a\u7b97\u6cd5\u7684\u7684\u5185\u5bb9<\/p>\n <\/p>\n Open loop\uff0c\u4f1a\u6839\u636einput\u6765\u76f4\u63a5\u6c42\u51faoutput\u5e76\u8f93\u51fa\uff0c\u4e0d\u4f1a\u53c2\u8003feedback\u6216\u4efb\u4f55\u7684actuating error<\/p>\n \u901a\u5e38thermal team\u4f1a\u7ed9BMC\u4e00\u4e2a\u8868(fan table)\uff0c\u8868\u793aSensor \u6e29\u5ea6(input)\u4e3a\u591a\u5c11\u7684\u65f6\u5019\uff0c\u98ce\u6247\u8f6c\u901f(output)\u4e3a\u591a\u5c11\uff0c\u5927\u6982\u5982\u4e0b<\/p>\n \u5b9e\u4f5c\u4e5f\u76f8\u5bf9\u7b80\u5355\uff0c\u5c31\u4e00\u4e2afor \u56de\u5708\u5c31\u53ef\u4ee5\u4e86<\/p>\n # Threshold table def run(self, value, ctx): if value >= self.compare_fsc_value: if value <= self.compare_fsc_value: for (in_thr, out) in self.table: self.compare_fsc_value = value PID\u5206\u522b\u662fproportional(\u6bd4\u4f8b) , integral(\u79ef\u5206) and derivative(\u5fae\u5206) \u4e09\u4e2a\u5355\u5b57\u7684\u7f29\u5199\u6240\u7ec4\u6210\u7684<\/p>\n \u6211\u4eec\u5728\u505a\u98ce\u6247\u63a7\u5236\u7684\u65f6\u5019\uff0c\u4f1a\u5e0c\u671b\u6211\u4eec\u7684\u7535\u8111\u4e0a\u5143\u4ef6\u7684\u6e29\u5ea6\u7ef4\u6301\u5728\u51e0\u5ea6\uff0c\u4ee5\u4e0b\u4f1a\u4ee5CPU\u6e29\u5ea6\u4e3a\u4f8b\u5b50\u3002\u5047\u8bbe\u4eca\u5929\u6211\u4eec\u5e0c\u671bCPU\u6e29\u5ea6\u7ef4\u6301\u572860\u5ea6\u5de6\u53f3\uff0c\u90a360\u5c31\u662fset-point (S)\uff0c\u800cCPU\u76ee\u524d\u6e29\u5ea6\u5c31\u662fprocess value (P)\uff0c\u90a3S\u548cP\u4e4b\u95f4\u7684\u5dee\u503c\u5c31\u662ferror value (E) \uff0c\u4ed6\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u5c31\u662fE=S-P<\/p>\n PID\u6f14\u7b97\u6cd5\u5c31\u662f\u62ff\u6c42\u5f97\u7684E\u5206\u522b\u505a\u6bd4\u4f8b\u8fd0\u7b97\uff0c\u79ef\u5206\u548c\u5fae\u5206\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u7b97\u51fa\u6765\u7684\u7ed3\u679c\u4f1a\u8f93\u51faPWM\u53bb\u63a7\u5236\u98ce\u6247<\/p>\n <\/p>\n \u90a3\u6211\u4eec\u73b0\u5728\u6765\u5206\u522b\u804a\u804aPID\u8fd9\u4e09\u4e2a\u7b97\u6cd5<\/p>\n<\/p>\n Proportional(\u6bd4\u4f8b)<\/strong><\/p>\n \u6bd4\u4f8b\u63a7\u5236\u5c31\u662f\u4f9d\u636e\u5f53\u524d\u6e29\u5ea6\u6765\u51b3\u5b9a\u98ce\u6247\u8f6c\u901f\uff0c\u5c06\u6c42\u5f97\u7684E\u4e58\u4e0a\u4e00\u4e2aKp\u5e38\u6570<\/p>\n <\/p>\n \u56e0\u4e3a\u5f53E \u6700\u5927\uff0c\u8868\u793aP\u79bbS\u5f88\u8fdc\uff0c\u98ce\u6247\u7684\u8f6c\u901f\u9700\u8981\u53d8\u5316\u5927\u4e00\u70b9\uff0c\u4e3e\u4f8b\u6765\u8bf4<\/p>\n Set-point: 60, Kp = -2<\/p>\n case 1 : CPU \u6e29\u5ea6 70\u5ea6 \u2192 E=60-70 = -10<\/p>\n case 2 : CPU \u6e29\u5ea6 90\u5ea6 \u2192 E=60-70 = -30<\/p>\n<\/blockquote>\n \u4ece\u4e24\u4e2acase\u5f53\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u5f53 | E | \u8d8a\u5927\uff0c\u98ce\u6247\u9700\u8981\u7684\u8f6c\u901f\u53d8\u5316\u4e5f\u8981\u5f88\u5927\uff0c\u6240\u4ee5\u98ce\u6247\u8f6c\u901f\u5206\u522b\u5c31\u662f20 (=-2*-10) \u548c60 (=-30*-2)<\/p>\n <\/p>\n<\/p>\n class PID: def run(self, value, ctx): Integral(\u79ef\u5206) <\/strong><\/p>\n \u79ef\u5206\u63a7\u5236\u662f\u6839\u636e\u5386\u53f2\u7ecf\u9a8c\u6765\u51b3\u5b9a\u98ce\u6247\u8f6c\u901f\uff0c\u5c06\u4ece\u521a\u5f00\u673a\u5230\u73b0\u5728\u7684Error value\u5168\u90e8\u76f8\u52a0\u8d77\u6765\uff0c\u5728\u4e58\u4e0aKi<\/p>\n <\/p>\n E0~Ei\u76f8\u52a0\u7684\u503c\u8d8a\u5927\u8868\u793a\u76ee\u524d\u7684\u5386\u53f2\u7ecf\u9a8c\u544a\u8bc9\u6211\u4eec\u98ce\u6247\u53d8\u5316\u8981\u5927\u4e00\u70b9\uff0c\u800c\u76f8\u52a0\u7684\u503c\u662f\u4e0d\u4f1a\u4e3a\u65e0\u9650\u5927\u7684\uff0c\u56e0\u4e3aE\u503c\u662f\u6709\u6b63\u6709\u8d1f<\/p>\n \u4f46I \u6709\u4e2a\u95ee\u9898 \u5c31\u662fovershoot \uff0c\u5728CPU\u6e29\u5ea6\u5df2\u7ecf\u8fbe\u5230set-point\u7684\u65f6\u5019\uff0c\u98ce\u6247\u5374\u4ecd\u6ca1\u51cf\u5c11\u98ce\u91cf\uff0c\u9020\u6210CPU\u6e29\u5ea6\u6301\u7eed\u4e0b\u964d\uff0c\u539f\u56e0\u662f\u56e0\u4e3asum(E)\u4ecd\u672a\u8d8b\u8fd1\u4e8e0\uff0c\u8fd9\u4e2a\u95ee\u9898\u662f\u5b58\u5728\u4e8ePID\u6f14\u7b97\u6cd5\u7684\uff0c\u5927\u90e8\u5206\u7684\u7a0b\u5f0f\u7801\u4f1a\u5728\u8fd9\u4e2a\u95ee\u9898\u4e0a\u505awork around<\/p>\n <\/p>\n <\/p>\n <\/p>\n \u5e95\u4e0b\u84dd\u8272\u7684\u5b57\u5c31\u662f\u5bf9overshoot\u6240\u505a\u7684workaround<\/p>\n class PID: def run(self, value, ctx): Derivative(\u5fae\u5206) <\/strong><\/p>\n \u6765\u5230\u6700\u540e\u7684\u5fae\u5206\uff0cD\u5c31\u662f\u6c42Error value\u7684\u53d8\u5316\u91cf\uff0c\u4ee5\u6700\u8fd1\u4e00\u4e24\u6b21\u7684\u8bef\u5dee\u53d8\u5316\u91cf\u6765\u51b3\u5b9a\u98ce\u6247\u8f6c\u901f<\/p>\n <\/p>\n \u628a\u8fd9\u6b21\u7684error\u548c\u4e0a\u6b21\u7684error\u505a\u76f8\u51cf\u5728\u9664\u4e0a\u65f6\u95f4\u5dee\uff0c\u5c31\u662fD\u503c\u4e86<\/p>\n <\/p>\n \u4ee3\u7801\u5927\u6982\u5982\u4e0b\uff1a <\/p>\n class PID: def run(self, value, ctx): \u98ce\u6247\u63a7\u5236\u4f1a\u7528\u5230\u7684\u6982\u5ff5\u5927\u6982\u5c31\u8fd9\u4e9b \ud83d\ude42TACH (Tachometer)<\/h3>\n
\n <\/figcaption><\/figure>\n<\/p>\nSystem Control <\/h3>\n
Open loop control \u6f14\u7b97\u6cd5 (Stepwise)<\/h4>\n
<\/h4>\n
\n\n
\n CPU \u6e29\u5ea6<\/td>\n \u98ce\u6247\u8f6c\u901f<\/td>\n<\/tr>\n \n 60<\/td>\n 40<\/td>\n<\/tr>\n \n 70<\/td>\n 50<\/td>\n<\/tr>\n \n 80<\/td>\n 70<\/td>\n<\/tr>\n \n 90<\/td>\n 80<\/td>\n<\/tr>\n \n 100<\/td>\n 98<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \n
class TTable:
def __init__(self, table, neg_hyst=0.0, pos_hyst=0.0):
self.table = sorted(
table, key=lambda in_thr_out: in_thr_out[0], reverse=True)
self.compare_fsc_value = 0
self.last_out = None
self.neghyst = neg_hyst
self.poshyst = pos_hyst<\/p>\n
mini = 0<\/p>\n
if math.fabs(self.compare_fsc_value - value) <= self.poshyst:
return self.last_out<\/p>\n
if math.fabs(self.compare_fsc_value - value) <= self.neghyst:
return self.last_out<\/p>\n
mini = out
if value >= in_thr:
self.compare_fsc_value = value
self.last_out = out
return out<\/strong><\/span><\/p>\n
self.last_out = mini
return mini<\/p>\n<\/blockquote>\nPID algorithm<\/h4>\n
\n
\n
def __init__(self, setpoint, kp=0.0, ki=0.0, kd=0.0, neg_hyst=0.0, pos_hyst=0.0):
self.last_error = 0
self.I = 0
self.kp = kp
self.ki = ki
self.kd = kd
self.minval = setpoint - neg_hyst
self.maxval = setpoint + pos_hyst
self.last_out = None<\/p>\n
dt = ctx[\"dt\"]
# don't accumulate into I term below min hysteresis
if value < self.minval:
self.I = 0
self.last_out = None
# calculate PID values above max hysteresis
if value > self.maxval:
error = self.maxval - value<\/strong>
self.I = self.I + error * dt
D = (error - self.last_error) \/ dt
out = self.kp * error<\/strong> + self.ki * self.I + self.kd * D
self.last_out = out
self.last_error = error
return out
# use most recently calc'd PWM value
return self.last_out<\/p>\n<\/blockquote>\n\n
def __init__(self, setpoint, kp=0.0, ki=0.0, kd=0.0, neg_hyst=0.0, pos_hyst=0.0):
self.last_error = 0
self.I = 0
self.kp = kp
self.ki = ki
self.kd = kd
self.minval = setpoint - neg_hyst
self.maxval = setpoint + pos_hyst
self.last_out = None<\/p>\n
dt = ctx[\"dt\"]
# don't accumulate into I term below min hysteresis
if value < self.minval:
self.I = 0
self.last_out = None<\/span><\/strong>
# calculate PID values above max hysteresis
if value > self.maxval:
error = self.maxval - value
self.I = self.I + error * dt<\/strong><\/span>
D = (error - self.last_error) \/ dt
out = self.kp * error + self.ki * self.I <\/strong><\/span>+ self.kd * D
self.last_out = out
self.last_error = error
return out
# use most recently calc'd PWM value
return self.last_out<\/p>\n<\/p>\n<\/blockquote>\n\n
def __init__(self, setpoint, kp=0.0, ki=0.0, kd=0.0, neg_hyst=0.0, pos_hyst=0.0):
self.last_error = 0
self.I = 0
self.kp = kp
self.ki = ki
self.kd = kd
self.minval = setpoint - neg_hyst
self.maxval = setpoint + pos_hyst
self.last_out = None<\/p>\n
dt = ctx[\"dt\"]
# don't accumulate into I term below min hysteresis
if value < self.minval:
self.I = 0
self.last_out = None
# calculate PID values above max hysteresis
if value > self.maxval:
error = self.maxval - value
self.I = self.I + error * dt
D = (error - self.last_error) \/ dt<\/strong><\/span>
out = self.kp * error + self.ki * self.I + self.kd * D<\/strong><\/span>
self.last_out = out
self.last_error = error
return out
# use most recently calc'd PWM value
return self.last_out<\/p>\n<\/blockquote>\n
\u5269\u4e0b\u7684\u90e8\u5206\u56e0\u4e3a\u5404\u5bb6\u505a\u6cd5\u90fd\u4e0d\u4e00\u6837\uff0c\u6240\u4ee5\u5c31\u5148\u4e0d\u8ba8\u8bba<\/p>\n","protected":false},"excerpt":{"rendered":"\u98ce\u6247control mode_bios \u98ce\u6247\u8c03\u8282\u8fd9\u7bc7\u6587\u7ae0\u662f\u6211\u521a\u5f00\u59cb\u505a\u98ce\u6247\u529f\u80fd\u7684\u65f6\u5019\u5199\u7684\uff0c\u56e0\u4e3a\u90a3\u65f6\u5019\u90fd\u627e\u4e0d\u5230\u4e3b\u7ba1\u8981\u6211\u62a5\u544a\u7684\u5185\u5bb9\uff0c\u6240\u4ee5\u62a5\u544a...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8749"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8749"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8749\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}