0
点赞
收藏
分享

微信扫一扫

液位PID控制系统的PLC 与HMI仿真联调

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

JZGKCHINA

工控技术分享平台


尊重原创 勿抄袭

勿私放其他平台


中英文双语技术文章



Simulation joint debugging between PLC and HMI for the Liquid level PID control system

液位PID控制系统的PLC 与HMI仿真联调

Introduction: 引言

The PLC and HMI simulation joint debugging environment implements the simulation function for the part of Human Machine Interface and controller in the close control loop.

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仿真联调_人机界面_06 ,禁用比例功能,并将“输出”连回到“输入”构成自反馈回路。

液位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;
    被控对象加入纯滞后环节;
  • ……


Ps.


1.本例中跳过了一些细节操作过程请转至上一篇《​​基于Step 7 PLCSIM和TIA Portal WinCC的PLC 与触摸屏的仿真联调​​

2.关于本例中使用的ON、 OFF图形,欢迎观看本公众号中公开课《​​册册手把手教你用PS做组态界面之入门篇​​》 教你如何制作~

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

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

作者简介



淡定齿轮:

常驻伊拉克油田现场的工控人

油气上游领域自动化过程控制从业多年


举报

相关推荐

MATLAB控制系统仿真与CAD

0 条评论