系统与基础设施wescottdesign.com编辑精选
无需博士学位的 PID(2016)
PID Without a PhD (2016) [pdf]
2018 — 2024,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 Tim Wescott 的经典文章《PID Without a PhD》的 PDF,面向没有控制理论背景的工程师讲解 PID(比例-积分-微分)控制器的原理与实用整定方法。文章以通俗易懂的方式说明如何在实际系统中实现和调参 PID,多年来多次登上 Hacker News 首页。
为什么经久不衰:它把看似高深的控制理论讲得工程师都能上手,而 PID 至今仍是软件和硬件系统中最常用的控制算法,实用价值经久不衰。
HN 评论精选
PID 不只用于硬件,FreeBSD 内核就用它调节内存回收,效果优于简单滞回方案。
如果有人对 PID 在系统软件中的应用感兴趣,FreeBSD 内核就用 PID 环路来调节内存回收(见 subr_pidctrl.c 和 vm_pageout.c)。在持续内存压力下,它在维持系统响应性和延迟方面表现得相当好,至少比常用的简单滞回环路好得多。
markjdb查看英文原文
If anyone is interested in their application to system software, the FreeBSD kernel uses a PID loop to regulate memory reclamation: https://svnweb.freebsd.org/base/head/sys/kern/subr_pidctrl.c?view=markup https://svnweb.freebsd.org/base/head/sys/vm/vm_pageout.c?view=markup#l2064 It does a pretty good job of maintaining system responsiveness and latency when there's sustained memory pressure, at least much better than the simpler hysteresis loops that are commonly used for this sort of thing.
PID 编码容易、调参难;并指出控制理论可追溯到麦克斯韦 1868 年的论文。
这是对 PID 控制器不错的讲解。写代码容易,调参才是难点,整定方法很多,作者给出了一个简单的。注意他引用了麦克斯韦 1868 年的《论调速器》——没错,就是那个麦克斯韦。那篇论文值得一读,线性控制理论就此诞生,而这基本就是 1950 年左右之前的技术水平。现代控制理论与机器学习紧密相关,只是控制理论的人要求解对所有输入都不会突然出怪行为的方案,其数学连控制理论博士都觉得难。
Animats查看英文原文
It's an OK explanation of a PID controller. They're easy to code; tuning is the hard part. There are lots of approaches to tuning. This author offers a simple one. I note that he cites "James Clerk Maxwell: “On Governors”. Proceedings of the Royal Society, #100,1868".[1] Yes, 1868. Yes, that Maxwell, of Maxwell's Equations. That paper is worth reading. Right there, linear control theory was born. And that's about where the state of the art was until 1950 or so. Modern control theory is closely tied to machine learning. Except that the control theory people want solutions that don't suddenly do funny stuff for some inputs. The math is way beyond me. Even control theory PhDs have trouble now. [1] https://www.maths.ed.ac.uk/~v1ranick/papers/maxwell1.pdf
控制理论应用于软件系统是一条被低估的思路。
我的一位同事多年来一直在做演讲,讲 PID 环路和控制系统理论如何应用于软件,我完全相信这是一条被低估的绝佳思路。我正把它应用到自己正在开发的软件上,非常兴奋。
ragona查看英文原文
One of my coworkers (colmmacc@ on twitter) has been giving talks [1][2] for years on how PID loops and control systems theory apply to software, and that I’m totally convinced that it’s an undermined vein of excellent thought. I’m working on applying this to a piece of software I’m building and I’m very excited. 1: https://www.infoq.com/presentations/pid-loops/ 2: https://m.youtube.com/watch?v=O8xLxNje30M
PID 只适用于线性系统;对非线性系统可用级联 PID 或 LQR 等方法。
当我意识到 PID 环路只对线性系统效果好时(而系统是否线性有时并不明显),我有了顿悟。真实例子:用电机驱动单轴运动平台控制滑块位置,控制输出是电机电压,电压约等于电流、电流约等于扭矩、扭矩产生力、力产生加速度、加速度线性增加速度、速度才改变位置——系统对被控参数来说本质上是非线性的。改进方案之一是加速度传感器并引入级联 PID(外环输出速度误差,内环输出加速度),从最内环开始整定;另一方案是改用适合非线性系统的算法(如 LQR)。
fest查看英文原文
There was an "aha" moment for me when I realized that PID loop only works well for linear systems (and sometimes it's not obvious if a system is linear or not). Real world example: imagine you have a single-axis motion stage driven by electric motor and you want to control position of a carriage. Usually your control output is motor voltage. Motor voltage approximately translates to current through motor windings, which in turn approximately translates to torque exerted by motor. Torque exerts a force (T = F * r) on carriage. Applying force to the carriage makes it accelerate (F = m * a). Acceleration linearly increases the carriage velocity (v = v0 + a * t). Carriage having some velocity finally causes the position change (s = v0 * t + a * t^2). In the essence, the system turns out to be non-linear with the respect to parameter you are controlling. To improve this system, one solution is to add velocity sensor (or differentiate the position sensor, if it's resolution is high enough) and introduce a cascading PID loop topology- the outer loop takes position error and outputs velocity error, which is fed to inner loop (input = velocity error, output = acceleration). The coefficients for the loops have to be tuned starting from innermost loop. Another solution is to use different control algorithm which is suited for non-linear systems (e.g. LQR).
历次讨论
同类还值得读
TTY 揭秘(2008)
The TTY demystified (2008)
经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。
系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选为什么 GNU grep 这么快
Why GNU grep is Fast
FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…
系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.orgXplain:为普通人讲解 X11
Xplain – Explaining X11 for the rest of us
《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。
系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)
breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。
系统与基础设施上首页 6 次 · 2007–2025muppetlabs.comPostgreSQL 内部原理
The internals of PostgreSQL
《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。
系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选