PLC与HMI在液位PID控制系统中的联合仿真

PLC和HMI的仿真联调环境实现了闭环控制回路中人机界面和控制器部分的仿真功能。

液位PID控制系统的PLC 与HMI仿真联调_功能块_02

The Controlled Object and Measuring & Transmitting part also could be simulated through the PLC programming.

被控对象和测量变送环节同样可以通过PLC编程进行仿真。


Ps.  Ignore actuator

此处忽略执行机构。


Controlled Object and Close Control Loop principle: 被控对象及闭环回路仿真原理


1.As we know, we usually use the Transfer Function to describe the Controlled Object. Using the single water tank as an example, the transfer function is

众所周知,我们通常使用传递函数来描述被控对象。以单容水箱为例,传递函数为

液位PID控制系统的PLC 与HMI仿真联调_功能块_03

2.We also know that the PID Controller‘s time domain function is

我们同样知道PID控制器的时域函数为

液位PID控制系统的PLC 与HMI仿真联调_人机界面_04

Laplace transform to get the transfer function as below

拉普拉斯变换得到传递函数如下

液位PID控制系统的PLC 与HMI仿真联调_人机界面_04


3. In the PLC program, we could set the PID function block to make it become an Integrating Element.

在PLC程序当中,我们可以通过设定PID功能块,使之变成一个积分环节。


Set the液位PID控制系统的PLC 与HMI仿真联调_功能块_06, disable the Proportion function, and link the “output” to “input” to constitute a self-feedback loop.

设定 ,禁用比例功能,并将“输出”连回到“输入”构成自反馈回路。

液位PID控制系统的PLC 与HMI仿真联调_功能块_08


Base on the block diagram transform principle get the new transfer function, an inertial element (First-order process)

由方框图变换法则得到新的传递函数, 一个惯性环节(一阶环节)

液位PID控制系统的PLC 与HMI仿真联调_传递函数_09


4.From this, we could build a whole feedback control loop with “Controlled Object”.

由此,我们可以在PLC当中构建一个完整的带有“被控对象”的反馈控制回路。

液位PID控制系统的PLC 与HMI仿真联调_人机界面_10

PLC programming: PLC编程


1.Open the “SIMATIC Manager” software, create a new project and finish the Hardware configuration.

打开编程软件,新建项目并完成硬件组态;


2.Double Click “OB1” to start programming

双击 “OB1”进入编程界面;

液位PID控制系统的PLC 与HMI仿真联调_功能块_11


3.Insert the Open Contact/Close Contact and Set Coil/Reset Coil to make the “ALWAYS ON” and “ALWAYS OFF” constant for further using.

插入常开、常闭触点和置位、复位线圈来制作常开、常闭静态常量以备后用。

液位PID控制系统的PLC 与HMI仿真联调_传递函数_12

4.Unfold the tree structure of “Libraries” → “Standard Library” →”PID Control Blocks”, find the “FB41 CONT_C  ICONT” and put to “Network 3”

展开“Libraries”的树状结构→ “Standard Library” → “PID Control Blocks”,找到“FB41 CONT_C  ICONT”并拖拽到“程序段3”;

液位PID控制系统的PLC 与HMI仿真联调_功能块_13


5.Create the corresponding Instance DB for these FB

为此功能块创建相对应的数据块;

液位PID控制系统的PLC 与HMI仿真联调_人机界面_14


6.Set the related parameters for FB;

为功能块设定相关参数;


Transfer the output back to input by using “MOVE”

通过“MOVE”指令将输出传递回输入

液位PID控制系统的PLC 与HMI仿真联调_人机界面_15


7.Create the “Network 4”, insert another “FB41” from “FB blocks”, assign “DB2” and set the related parameters or address;

新建“程序段4”,从“FB blocks”中再插入一个“FB41”为之分配“DB2”并设定相关参数或地址;

液位PID控制系统的PLC 与HMI仿真联调_功能块_16

液位PID控制系统的PLC 与HMI仿真联调_功能块_17


8.Related Parameter and Address reference as below:

相关地址参数参照如下:

液位PID控制系统的PLC 与HMI仿真联调_功能块_18


HMI Touch Screen configuration and joint simulation: HMI触摸屏组态及联合仿真

1.Open the “TIA Portal” software and Create a new project, add the HMI device and configure the communication with PLCSIM

打开“TIA Portal”软件并创建新项目,添加HMI设备并组态与PLCSIM的通讯连接;


2.Create the tags in “Default tag table”, and set the related parameters and address;

在“默认变量表”中新建变量并设置相关参数和地址;

液位PID控制系统的PLC 与HMI仿真联调_功能块_19


3.Inert the “Trend View” Controls, add the trend set the related properties.

插入“趋势”控件,添加趋势并设置相关属性。

液位PID控制系统的PLC 与HMI仿真联调_功能块_20

液位PID控制系统的PLC 与HMI仿真联调_传递函数_21


4.Inert the “Bar” Elements and static Graphics, set the related properties.;

插入“棒图”元素以及静态图形,并设置相关属性;

液位PID控制系统的PLC 与HMI仿真联调_人机界面_22


5.Inert the “I/O field” Elements, set the related properties.;

插入“IO域”元素,并设置相关属性;

液位PID控制系统的PLC 与HMI仿真联调_功能块_23


6.Regarding the “P, I, D, Manual Switch” element, which consists of three parts.

关于“P、I、D、手自动开关”元素,它由三个部分组成;

液位PID控制系统的PLC 与HMI仿真联调_传递函数_24


“ON” and “OFF” graph with the tag status related with “Visibility” animation;

“ON”和“OFF”图形以“可见性”动画关联标签状态;

液位PID控制系统的PLC 与HMI仿真联调_人机界面_25

液位PID控制系统的PLC 与HMI仿真联调_人机界面_26


One invisible “Button” related with “Click” event;

一个不可见的“按钮”关联“单击”事件;

液位PID控制系统的PLC 与HMI仿真联调_功能块_27


Make these three parts overlap, and set the button to be the top position;

将三个部分重叠,并将按钮设置为最上层;


7.Open the PLCSIM software, download the program and turn to Run, Start HMI simulation and test;

打开PLCSIM软件,下装程序并打到运行状态,启动人机界面仿真并开始测试;


PID Controller set to Manual mode, and give the manual value, will see the PID output hold in value, and Controlled Object value (PV) increased as the inertial element (First-order process);

PID控制器设为手动模式,设定手动值,可以看到PID输出保持不变,被控对象的过程量持续增长表现为一个一阶惯性环节;

液位PID控制系统的PLC 与HMI仿真联调_功能块_28


PID Controller set to Auto mode, set the “P, I, D” parameters and give the SP value, will see the Controlled Object response faster and follow the SP value;

将PID控制器设置为自动模式,设置“P, I, D”参数并给出SP值,会看到被控对象响应更快并跟随SP值;

液位PID控制系统的PLC 与HMI仿真联调_功能块_29



Conclusion: 结语


For this case only provide to reader the way of Controlled Object simulation in PID control loop, and still have so many improvement parts such as:

本例仅提供给读者一个在PID控制回路中被控对象的仿真方法,仍然有许多地方可以改进例如:

  • Using the FC and FB to package the simulated controlled object program logic;
    使用功能和功能块对仿真被控对象程序逻辑进行封装;
  • Using the OB35 Cyclic Interrupt Organization Block to programming the PID loop;
    使用OB35 循环中断组织块进行PID回路编程;
  • Controlled Object use the Engineering Unit and add the AI, AO range switching program;
    被控对象使用实际工程量单位, 则加入模拟量输入、输出量程转换逻辑程序;
  • PID controller adding undisturbed switching function;
    PID控制器加入无扰切换功能;
  • HMI adding Alarm, Flashing, data export function etc.;
    人机界面加入报警、闪烁、数据导出等功能;
  • Controlled Object adding the pure time delay process;
    被控对象加入纯滞后环节;



P

免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删

QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空