PLC系统
一、PLC基础概念 | PLC Fundamentals
二、PLC硬件架构 | PLC Hardware Architecture
三、PLC编程与指令 | PLC Programming & Instructions
四、PLC通信与网络 | PLC Communication & Networking
五、PLC应用与调试 | PLC Application & Commissioning
PLC Programming — Pump Sequence Control Logic
Alex, we need the control logic for the cooling water pump station — three pumps, duty-standby-standby configuration. The pumps should auto-rotate every 168 hours to even out the wear. And if the duty pump trips, the standby pump must start automatically within 3 seconds.
Alex,我们需要冷却水泵站的控制逻辑——三台泵,一用两备配置。泵组 每168小时自动轮换以均匀磨损。而且如果主泵跳闸,备用泵必须在3秒 内自动启动。
Got it. Three pumps — P-301A, P-301B, P-301C. I'll write this in ladder logic first, then we can discuss the sequence. Carla, what are the start permissives?
收到。三台泵——P-301A、P-301B、P-301C。我先用梯形图写,然后 我们讨论顺序。Carla,启动允许条件有哪些?
Five permissives: suction valve open, discharge valve open, cooling water basin level above 2.0 meters, no motor overload, and no emergency stop active. If any permissive is lost while running, the pump must trip and an alarm must be generated. Also, minimum run time is 30 minutes — we don't want short-cycling.
五个允许条件:进口阀开、出口阀开、冷却水池液位高于2.0米、电机 无过载、紧急停机未激活。运行时任一允许条件丢失,泵必须跳闸并产生 报警。还有,最小运行时间30分钟——我们不要频繁启停。
(typing on the programming workstation) Alright, let me structure this. I'll create three function blocks: FB_PumpControl, FB_AutoSequence, and FB_AlarmHandler. FB_PumpControl handles the individual pump — permissives, start/stop, run feedback, trip logic. FB_AutoSequence handles the duty selection, rotation timer, and auto-start on trip. FB_AlarmHandler generates the alarm tags.
(在编程工作站上敲代码)好,我来架构。创建三个功能块: FB_PumpControl、FB_AutoSequence、FB_AlarmHandler。 FB_PumpControl处理单泵——允许条件、启停、运行反馈、跳闸逻辑。 FB_AutoSequence处理主泵选择、轮换计时器、跳闸自启。 FB_AlarmHandler生成报警标签。
Walk me through the auto-start sequence. If P-301A is running and trips, what exactly happens?
给我讲讲自启动顺序。如果P-301A在运行中跳闸,具体会发生什么?
(displaying the ladder logic) Step 1: P-301A run feedback drops. The PLC detects this as "duty pump stopped unexpectedly." Step 2: A 2-second debounce timer starts — this filters out transient signal drops that aren't real trips. Step 3: If run feedback is still missing after 2 seconds, the PLC sets P-301A as "faulted" and immediately sends a start command to the next pump in the sequence — let's say P-301B. Step 4: P-301B starts. If its run feedback doesn't come back within 5 seconds, it's marked as "failed to start" and P-301C gets the start command. Step 5: Once a pump is running successfully, an alarm is raised for the tripped pump so maintenance knows to investigate.
(展示梯形图)第1步:P-301A运行反馈丢失。PLC检测为"主泵意外 停机"。第2步:2秒去抖计时器启动——过滤掉信号瞬断不是真正跳闸的 情况。第3步:如果2秒后运行反馈仍未回来,PLC将P-301A设为"故障", 立即发送启动命令给下一台顺序泵——比如P-301B。第4步:P-301B启动。 如果5秒内运行反馈未返回,标记为"启动失败",启动命令发给P-301C。 第5步:一旦任一泵成功运行,向上次跳闸泵发出报警让维修去查。
What about the rotation timer? Does it reset if a pump trips and a standby starts?
轮换计时器呢?如果一台泵跳闸、备用泵启动了,计时器重置吗?
Good question. The rotation timer only runs when the system is in normal operation — duty pump running, no alarms. If a trip occurs and a standby takes over, the rotation timer resets. The idea is: once the system returns to stable operation, we want the newly running pump to run for a full rotation cycle before switching again. This prevents rapid switching that could mask an underlying problem.
好问题。轮换计时器只在正常运行时走——主泵运行、无报警。如果 跳闸发生、备用泵接替,轮换计时器重置。逻辑是:一旦系统恢复稳定 运行,要让新运行的泵跑完一个完整轮换周期再切。这防止了可能掩盖 潜在问题的快速切换。
I like it. One more thing — the HMI needs to show which pump is currently duty, which is standby, total run hours per pump, and the time until next rotation. Can we do that?
我喜欢。还有——HMI要显示哪台泵当前是主泵、哪台是备用、各泵 累计运行小时、下次轮换倒计时。能做吗?
Absolutely. I've mapped the internal tags: PUMP_DUTY_NUMBER for the current duty pump, PUMP_RUN_HOURS array for each pump's accumulated hours, and ROTATION_TIME_REMAINING for the countdown. These all read directly into the HMI interface. Tom, when we do the SAT, we'll test all the HMI display tags as part of the functional test.
当然能。我已经映射了内部标签:PUMP_DUTY_NUMBER当前主泵号、 PUMP_RUN_HOURS数组记录每台泵累计小时、ROTATION_TIME_REMAINING 显示倒计时。这些都直接读入HMI界面。Tom,做SAT时我们把所有HMI 显示标签作为功能测试的一部分来测试。
PLC Hardware Troubleshooting — Failed I/O Module
Sven, we lost a bunch of field signals — all the instruments on the raw water intake system. The HMI is showing "???" for all readings, and the intake valve won't respond to commands. The operators are running blind. We need this fixed — the plant can't run without the raw water system.
Sven,我们丢了一批现场信号——原水取水系统所有仪表。HMI上所有 读数显示"???", 取水阀不响应命令。操作工在盲操作。必须修好—— 没有原水系统厂子没法运行。
(checking the engineering station) The PLC diagnostic buffer shows a fault on Rack 2, Slot 4 — that's the AI-08 module, an 8-channel analog input card. Status is "module failed — hardware fault." That explains why we lost all eight signals — the entire card went down. This is a critical module — it reads the raw water flow, pressure, level, and the intake valve position feedback.
(查看工程师站)PLC诊断缓冲区显示机架2、4号槽位故障——那是 AI-08模块、8路模拟量输入卡。状态"模块故障—硬件故障"。这就解释 了为什么八路信号全丢了——整块卡挂了。这是关键模块——读取原水 流量、压力、液位和取水阀位置反馈。
Let me check the hardware. (opens the PLC cabinet) The module's fault LED is solid red — no blinking. That means it's a permanent fault, not a recoverable error. Power LED is off. Let me measure the backplane power... (uses multimeter) 5.1 volts on the backplane — that's within spec. So power to the rack is good, the module itself is dead. We need to replace it.
我来查硬件。(打开PLC柜门)模块故障灯常亮红色——不闪。就是说 是永久性故障,不是可恢复错误。电源灯灭了。我量量底板电压…… (用万用表)底板5.1伏——在规格内。所以送给机架的电源是好的, 模块本身死了。得换。
OK. We have a spare AI-08 module in the warehouse. Rita, go grab it. Klaus, I need you to bypass the raw water intake interlock in the control logic so the downstream processes don't trip while we swap the module. Can you do that from the HMI?
好。仓库有备用AI-08模块。Rita,去拿。Klaus,我要你在控制逻辑 里旁通原水取水联锁,这样我们换模块时下游工艺不会跳闸。能从HMI 做吗?
Give me two minutes — I'll put the intake system in "maintenance override" mode. The downstream pumps will keep running on the water already in the system. We've got about 15 minutes of buffer before the storage tank drops below minimum. So let's move fast.
给我两分钟——我把取水系统切到"检修超驰"模式。下游泵靠系统 里已有的水保持运行。储罐水位降到最低前,我们大约有15分钟缓冲。 所以我们动作得快。
(returning with the replacement module) Got it. Part number matches — AI-08, Rev 3.2. Sven, do we need to power down the rack, or is this hot-swappable?
(拿着替换模块回来)拿到了。型号匹配——AI-08、3.2版。Sven,要 机架断电吗,还是支持热插拔?
This model supports hot-swap, but I'm going to play it safe. Let me first save the current module configuration — the channel settings, scaling, alarm limits. (uploads config from the PLC) Config saved. Now, remove the failed module. Gentle — don't force it. The backplane connector has guide pins.
这个型号支持热插拔,但我要稳一点。先保存当前模块配置——通道 设置、量程、报警限值。(从PLC上传配置)配置已保存。现在,拆下 故障模块。轻点——别用力。底板连接器有导销。
(carefully removing the module) Old module out. Inserting the new one... click — it's seated. Power LED is green, OK LED is flashing green — that means it's initializing. Now it's steady green. Module is healthy.
(小心取下模块)旧模块下来了。插入新的……咔——就位了。电源灯 绿、OK灯闪绿——意思在初始化。现在常绿了。模块正常。
Downloading the saved configuration to the new module... done. Let me verify the channel values. Channel 1 — raw water flow, 4.02 mA, that corresponds to 12.5 m³/h on the calibrated range. Channel 2 — intake pressure, 8.15 mA, reading 2.8 bar. These values look normal. HMI should be updating now. Klaus, what do you see?
把保存的配置下装给新模块……完成。我验证各通道值。通道1——原水 流量、4.02 mA、校准量程对应12.5 m³/h。通道2——取水压力、8.15 mA、 读数2.8 bar。值看着正常。HMI现在应该更新了。Klaus,你看到什么?
(at HMI screen) All readings back to normal! Intake valve position feedback is live again. I'm removing the maintenance override. System is back to automatic. Total downtime: 11 minutes. Excellent work, team.
(在HMI屏前)所有读数恢复正常!取水阀位置反馈活了。我在取消 检修超驰。系统回到自动模式。总停机时间:11分钟。干得好,团队。
Rita, tag the failed module with the date, failure description, and send it back to the vendor for root cause analysis. We want to know why an 18-month-old module failed. If it's a manufacturing defect, we might have more of these in the plant and we need to plan proactive replacement.
Rita,给故障模块贴上标签——日期、故障描述——发回厂家做根本 原因分析。我们要知道为什么一个18个月的模块就坏了。如果是制造 缺陷,厂里可能还有更多同类,需要规划主动更换。