# 快速控制原型

快速控制原型（rapid control prototyping，RCP）是一种基于模型的设计实践：在图形化仿真工具中开发的控制算法被自动转换为代码，并在实时硬件上执行，从而在最终嵌入式目标上实现之前，能够针对真实或仿真的被控对象（受控的物理系统）对控制器进行测试与整定。它在早期设计阶段取代了在生产硬件上手工编写代码的做法：控制器模型由原型硬件上的初步实现所替代，使设计能够在贴近真实的环境中得以验证，从而确保最终实现满足设计规格。<sup>[1](https://www.mathworks.com/help/hdlcoder/real-time-hardware-deployment.html)</sup><sup> • </sup><sup>[2](https://www.eolss.net/sample-chapters/c18/E6-43-07-05.pdf)</sup> RCP 是一种成熟的快速设计迭代方法，其中基于图形化模型的规格被编译为代码，并在 PC 或与被控系统相连的独立实时硬件上执行。<sup>[3](https://ckirsch.github.io/publications/reports/KTH06-ControlSystemsToolSurvey.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 核心机制 | 从框图模型自动生成代码，免除手工编码；工程师得以专注于控制设计而非底层编程。<sup>[4](https://www.ijee.ie/articles/Vol21-4/1649.pdf)</sup> |
| 典型 CPU 循环速率 | 在目标计算机 CPU 上可实现 1–20 kHz 的闭环采样率，某些情况下可达 100 kHz；更快的循环在 FPGA I/O 模块上运行。<sup>[5](https://www.speedgoat.com/solutions/simulink-real-time-workflow)</sup> |
| FPGA 阈值 | dSPACE 将短于 20 µs 的采样时间视为由用户可编程的 Xilinx Kintex-7 FPGA 接替 CPU 工作的分界点。<sup>[6](https://www.dspace.com/en/pub/home/applicationfields/stories/electricaldrive/rcp_industrial-controller.cfm)</sup> |
| 电力电子领域 | 亚微秒级采样时间、宽带隙（SiC/GaN）半导体在 MHz 范围内的开关频率，以及纳秒分辨率的数据记录。<sup>[7](https://www.speedgoat.com/solutions/industries/power-electronics/rcp-for-power-converter-control)</sup> |
| 测试阶段 | RCP 开发区分系统仿真、软件在环（SiL）和硬件在环（HiL）测试。<sup>[8](https://publications.rwth-aachen.de/record/828187/files/828187.pdf)</sup> |
| 主要行业 | 汽车 ECU 开发、风力发电机控制、功率变换器与驱动、航空航天作动器控制，以及工业机器人。<sup>[9](https://www.mdpi.com/2079-9292/11/15/2462)</sup><sup> • </sup><sup>[10](https://www.opal-rt.com/industries-and-applications/simulation-and-testing/rapid-control-prototyping/)</sup> |
| 主要失效模式 | 若在目标上的执行产生超时，则模型不具备实时能力；超时可通过任务执行时间（TET）报告检测。<sup>[11](https://www.mathworks.com/help/simscape/ug/hardware-in-the-loop-simulation-workflow.html)</sup> |

## 工作原理

RCP 的关键要素是自动代码生成，它免除了繁琐且易出错的手工编码过程。<sup>[4](https://www.ijee.ie/articles/Vol21-4/1649.pdf)</sup> 在 MATLAB/Simulink 等工具中以[框图](https://www.edgepedia.org/zh/block-diagram)形式设计的控制器被编译为可执行代码，下载到实时目标机，并通过模拟和数字输入/输出（I/O）与被控对象相连——无论该对象是物理设备还是[实时仿真](https://www.edgepedia.org/zh/real-time-simulation)。<sup>[12](https://opal-rt.atlassian.net/wiki/spaces/PSSDD/pages/144676961/RCP-EC2K+Quick+Start+Guide)</sup> 在被控对象处于仿真的情况下，于实时目标上运行控制器，可以用贴近真实的时序测试完整的闭环，并暴露出仅在存在 I/O、量化、延迟和调度时才会出现的问题。<sup>[13](https://www.opal-rt.com/blog/rapid-control-prototyping-guide-for-control-engineers/)</sup>

时序是支配性的约束。RCP 中的硬件选择优先考虑确定性，其次是 I/O 保真度，再次是计算余量；延迟是从输入采样到输出更新的端到端系统属性，控制器周期、ADC 时序、计算时间和输出更新调度都必须在不超时的前提下纳入步长之内。<sup>[13](https://www.opal-rt.com/blog/rapid-control-prototyping-guide-for-control-engineers/)</sup> 传统 RCP 系统应能提供比目标处理器快数倍的强大浮点处理器、灵活的 I/O 类型以及大容量内存。<sup>[4](https://www.ijee.ie/articles/Vol21-4/1649.pdf)</sup>

## 实施方法

以 Simulink Real-Time 与 Speedgoat 工具链为例记录的典型工作流包含三步：在 Simulink 中设计控制器或被控对象模型，并添加厂商的 I/O 驱动模块；利用自动 C 与 HDL 代码生成，自动构建实时应用并下载到目标机；随后在实时执行过程中从 Simulink 整定参数并监测信号。<sup>[5](https://www.speedgoat.com/solutions/simulink-real-time-workflow)</sup> 设计过程始于在 Matlab/Simulink 或 MatrixX 等工具中对被控对象模型与控制器模型进行联合仿真，对于高维物理问题则使用 Dymola（采用 Modelica 语言）或 [VHDL-AMS](https://www.edgepedia.org/zh/vhdl-ams) 仿真器；硬件在环与实时仿真是随后与硬件交互的形式。<sup>[2](https://www.eolss.net/sample-chapters/c18/E6-43-07-05.pdf)</sup> 对于 FPGA 目标，控制器模型在 MATLAB/Simulink 中借助厂商的 FPGA 编程模块集与 HDL 库开发，被控对象模型的 VHDL/Verilog 代码可被生成并部署到目标硬件上用于 HIL 仿真。<sup>[6](https://www.dspace.com/en/pub/home/applicationfields/stories/electricaldrive/rcp_industrial-controller.cfm)</sup><sup> • </sup><sup>[1](https://www.mathworks.com/help/hdlcoder/real-time-hardware-deployment.html)</sup>

## 起源

面向快速控制原型的“整体开发环境”（Total Development Environment，TDE）将 MATLAB、Simulink、实时车间（Real-Time Workshop，RTW）、基于 DSP 的硬件以及在线数据可视化工具（COCKPIT、TRACE）结合在一起，控制器板卡 DS1104 与 DS1103 可由 Simulink 编程。<sup>[4](https://www.ijee.ie/articles/Vol21-4/1649.pdf)</sup> 施普林格出版的一本专著《快速控制原型：方法与应用》（*Rapid Control Prototyping: Methoden und Anwendungen*）将 RCP 描述为：借助强大的硬件/软件环境，将自动化解决方案的设计与实现融合为一个连续的开发过程。<sup>[14](https://link.springer.com/book/10.1007/3-540-29525-9)</sup> 自 20 世纪 90 年代以来，汽车行业的研究与开发团队一直采用 HIL 仿真来测试嵌入式 ECU，这已成为 ECU 开发的事实标准。<sup>[9](https://www.mdpi.com/2079-9292/11/15/2462)</sup>

## 变体

RCP 属于基于模型的测试阶段家族中的一员。RCP 开发过程区分系统仿真——控制算法与过程模型在开发平台上进行仿真；软件在环（SiL）——控制算法被编译为可执行代码，与过程模型一起在开发平台上运行；以及硬件在环（HiL）——算法在目标硬件上运行，控制一个实时仿真的过程，从而验证功能、鲁棒性与安全性。<sup>[8](https://publications.rwth-aachen.de/record/828187/files/828187.pdf)</sup> 在 SiL 中，控制功能模型被生产代码替代，并将其行为与功能模型进行比较；在 HIL 中，真实控制单元被嵌入到一个包含实时仿真、电气部件仿真以及部分真实物理部件的测试环境中，支持残余总线仿真、故障注入以及诊断与通信测试。<sup>[3](https://ckirsch.github.io/publications/reports/KTH06-ControlSystemsToolSurvey.pdf)</sup> 实时仿真（RTS）是第三条路径，其中被控对象与控制器均在仿真器上运行，以在线精细整定参数。<sup>[12](https://opal-rt.atlassian.net/wiki/spaces/PSSDD/pages/144676961/RCP-EC2K+Quick+Start+Guide)</sup>

文献对于 RCP 相对于 HIL 的定义并不统一。有资料将 RCP 描述为“硬件在环（HIL）的一种变体，但与 HIL 的不同之处在于，控制策略是实时仿真的，而被控对象或受控系统是真实的”。<sup>[15](https://pubs.ub.ro/uploads/articole/3300/JESR20101604V16S01A0003.pdf)</sup> 另一种定义则将 RCP 视为在被控对象处于仿真的情况下，于实时目标上运行控制器。<sup>[13](https://www.opal-rt.com/blog/rapid-control-prototyping-guide-for-control-engineers/)</sup> 同一厂商文献给出的一个实用区分是：在 RCP 中被控对象是真实的，而控制器运行在实时仿真器上；而在 HIL 中，控制器是真实硬件，被控对象是仿真的；被控对象的保真度与硬件接口因应用而异，并不构成将 HIL 定义为后续阶段的依据。<sup>[13](https://www.opal-rt.com/blog/rapid-control-prototyping-guide-for-control-engineers/)</sup>

## 应用

RCP 用于加速汽车控制系统中电子控制单元（ECU）的开发，<sup>[16](https://journals.sagepub.com/doi/10.1243/0954407041580049)</sup> 其应用涵盖 ECU 与电池管理系统测试、航空航天作动器控制、工业机器人以及电力系统。<sup>[10](https://www.opal-rt.com/industries-and-applications/simulation-and-testing/rapid-control-prototyping/)</sup> 在风能领域，曾使用从 Matlab/Simulink 到风机 PLC 的连续工具链，为在一台真实的 3 MW 风力发电机上进行测试而准备了一个模型预测控制器（MPC），在系统仿真与 SiL 测试中展示了控制器在整个运行范围内的运行情况，并在 PLC 上的 HiL 测试中验证了实时可行性。<sup>[8](https://publications.rwth-aachen.de/record/828187/files/828187.pdf)</sup> 在电力电子领域，由于数字控制的传统设计过程繁琐且易出错，人们开发了一种将虚拟试验台（Virtual Test Bed）与 Matlab/Simulink 软件及 dSPACE DSP 硬件相结合的快速原型方法。<sup>[17](https://scholarcommons.sc.edu/cgi/viewcontent.cgi?article=1023&context=elct_facpub)</sup>

## 局限与替代方案

**实时超时。** 若在实时目标上的仿真产生超时，即某个任务未能在其截止时间内完成，则模型不具备实时能力；超时可通过任务执行时间（TET）报告诊断，补救措施包括调整模型的保真度或范围。此外，与参考结果的一致性是一项对照仿真结果进行检查的验证准则。<sup>[11](https://www.mathworks.com/help/simscape/ug/hardware-in-the-loop-simulation-workflow.html)</sup>

**数值与接口失配。** 使用独立控制器与被控对象硬件的 HIL 装置面临时钟失配问题，可能引起可归因于混叠问题的显著振荡，并且需要会增加搭建复杂度的 ADC 或 DAC 接口。<sup>[18](https://link.springer.com/article/10.1007/s42835-025-02173-x)</sup> HIL 仿真器充当黑盒测试器，只读取嵌入式系统的输出，因此内部故障可能难以诊断，而且准备异常工况测试场景十分耗时。<sup>[9](https://www.mdpi.com/2079-9292/11/15/2462)</sup>

**迁移鸿沟。** 传统 RCP 平台用于汽车 ECU 开发的一个关键缺点是从 RCP 平台到目标 ECU 实现的迁移；一种应对方案是采用与目标完全一致（target-identical）的 RCP 平台，在原型阶段就使用量产 ECU 硬件。<sup>[16](https://journals.sagepub.com/doi/10.1243/0954407041580049)</sup>

**替代方案。** 面向微控制器的低成本测试台使用标准 Simulink 模块生成针对该微控制器编译的代码，据称其易用性几乎与 dSPACE 或 Speedgoat 的 RCP 装置相当，其速度环与电流环以不同速率采样。<sup>[19](https://hal.science/hal-02928430v1/file/2020_IFAC_WC_2_HAL.pdf)</sup> 另一条非专有路线为 Linux RTAI——Linux 的硬实时扩展——生成可执行代码，生成的代码作为用户空间硬实时进程运行。<sup>[20](https://repository.supsi.ch/2661/)</sup>

## References

1. [Real-Time Hardware Deployment - MATLAB & Simulink](https://www.mathworks.com/help/hdlcoder/real-time-hardware-deployment.html)
2. [Rapid Prototyping For Model And Controller Implementation (EOLSS encyclopedia chapter)](https://www.eolss.net/sample-chapters/c18/E6-43-07-05.pdf)
3. [Co-design of Control Systems and their real-time implementation - A Tool Survey (KTH report)](https://ckirsch.github.io/publications/reports/KTH06-ControlSystemsToolSurvey.pdf)
4. [Rapid Control Prototyping using MATLAB/Simulink with a DSP-based motor controller (IJEE Vol 21-4)](https://www.ijee.ie/articles/Vol21-4/1649.pdf)
5. [Speedgoat and Simulink Real-Time Workflow](https://www.speedgoat.com/solutions/simulink-real-time-workflow)
6. [Developing and Validating Controller Algorithms - dSPACE](https://www.dspace.com/en/pub/home/applicationfields/stories/electricaldrive/rcp_industrial-controller.cfm)
7. [RCP for Power Converter Control | Speedgoat](https://www.speedgoat.com/solutions/industries/power-electronics/rcp-for-power-converter-control)
8. [Rapid control prototyping of model predictive wind turbine control toward field testing](https://publications.rwth-aachen.de/record/828187/files/828187.pdf)
9. [Hardware-in-the-Loop Simulations: A Historical Overview of Engineering Challenges](https://www.mdpi.com/2079-9292/11/15/2462)
10. [Rapid Control Prototyping | OPAL-RT](https://www.opal-rt.com/industries-and-applications/simulation-and-testing/rapid-control-prototyping/)
11. [Real-Time Code Generation and Deployment Process - MATLAB & Simulink](https://www.mathworks.com/help/simscape/ug/hardware-in-the-loop-simulation-workflow.html)
12. [RCP-EC2K Quick Start Guide - OPAL-RT](https://opal-rt.atlassian.net/wiki/spaces/PSSDD/pages/144676961/RCP-EC2K+Quick+Start+Guide)
13. [Rapid Control Prototyping Guide For Control Engineers (OPAL-RT blog)](https://www.opal-rt.com/blog/rapid-control-prototyping-guide-for-control-engineers/)
14. [Rapid Control Prototyping: Methoden und Anwendungen (Springer book)](https://link.springer.com/book/10.1007/3-540-29525-9)
15. [Modeling and Simulation Methods for Designing Mechatronic Systems (JESR 2010)](https://pubs.ub.ro/uploads/articole/3300/JESR20101604V16S01A0003.pdf)
16. [Target-identical rapid control prototyping platform for model-based engine control](https://journals.sagepub.com/doi/10.1243/0954407041580049)
17. [Rapid Prototyping of Digital Controls for Power Electronics](https://scholarcommons.sc.edu/cgi/viewcontent.cgi?article=1023&context=elct_facpub)
18. [Rapid Prototyping for Design and Test of FPGA-Based Model Predictive Controllers for Power Converters (J. Electrical Engineering & Technology, 2025)](https://link.springer.com/article/10.1007/s42835-025-02173-x)
19. [Test benches for Rapid Control Prototyping targeting microcontrollers (IFAC World Congress 2020)](https://hal.science/hal-02928430v1/file/2020_IFAC_WC_2_HAL.pdf)
20. [Rapid controller prototyping with Matlab/Simulink and Linux](https://repository.supsi.ch/2661/)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 工程与制造 › 电气与电子工程 › Electric machines and drives

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/rapid-control-prototyping

English original: https://www.edgepedia.org/rapid-control-prototyping
