本页内容

水泵仿真服务器

一个实现简单水泵机模拟的 OPC UA 服务器。

水泵模拟服务器是利用OPC UA为“水泵”和Qt Quick “水泵”示例创建的。

模拟

该 OPC UA 服务器运行着一个包含两个水箱、一台水泵和一个阀门的设备仿真。 水可从第一个水箱泵入第二个水箱,随后通过打开阀门将水从第二个水箱排出。这两项操作均设有可由用户配置的设定点,从而能够控制泵入或排出第二个水箱的水量。

服务器上存在以下节点:

节点ID功能
ns=2;s=Machine包含该机器的方法和变量节点的文件夹
ns=2;s=Machine.State机器的状态
ns=2;s=Machine.Tank1.PercentFilled第一个储罐的当前填充状态
ns=2;s=Machine.Tank2.PercentFilled第二个储罐的当前填充状态
ns=2;s=Machine.Tank2.TargetPercent泵送和冲洗的设定值
ns=2;s=Machine.Tank2.ValveState第二个储罐阀门的状态
ns=2;s=Machine.Designation用于显示的人机可读设备标识
ns=2;s=Machine.Start调用此方法以启动水泵
ns=2;s=Machine.Stop调用此方法以停止水泵
ns=2;s=Machine.FlushTank2调用此方法以冲洗第2号储罐
ns=2;s=Machine.Reset调用此方法以重置仿真

所有方法在成功时返回Good ,若操作非法(例如,当第一个水箱为空时尝试启动水泵)则返回BadUserAccessDenied 。

示例项目 @ code.qt.io

另请参阅 Qt Quick 水泵和水泵。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.