S7-300 PLC中FB43 PWM算法开放源程序设计毕业设计 下载本文

南阳理工学院本科生毕业设计(论文)

S7-300 PLC中FB43 PWM算法开放源程序设计

The Design of FB43 PWM Algorithm Open Souce in S7-300 PLC

总 计: 35 页 表 格: 6 个 插 图: 24 幅

南 阳 理 工 学 院 本 科 毕 业 设 计(论文)

S7-300 PLC中FB43 PWM算法开放源程序设

The Design of FB43 PWM Algorithm Open Source Design in

S7-300 PLC

学 院(系): 电子与电气工程学院 专 业: 自动化 学 生 姓 名: 学 号: 指 导 老 师:

评 阅 老 师: 完 成 日 期:

南阳理工学院

Nanyang Institute of Technology

S7-300 PLC中FB43 PWM 算法开放源程序设计

S7-300 PLC中FB43 PWM算法开放源程序设计

自动化专业

[摘 要] 在温度过程控制中,时间比例输出即PWM是主要的控制方式。S7-300 PLC中有PWM模块FB43,但是源程序不公开。本设计仿照FB43的功能和形式,用梯形图语言自主编写PWM模块。程序结构主要设计了两个循环:一个是内循环,调用周期脉冲个数的循环;另一个是外循环,输出正脉冲个数循环。用自主设计的PWM模块和FB41 PID模块配合进行锅炉温度控制,完全实现了时间比例输出的控制功能。自主设计的源程序加有详细的算法说明和注释,可以作为自动化教学科研的技术资料,也可以代替FB43用于工程控制。

[关键词] 脉宽输出;三级控制;二级控制;手动控制

The Design of FB43 PWM Algorithm Open Source Design in

S7-300 PLC

Automation Specialty YANG Li-yi

Abstract: In the temperature process control, the output of time scale that is PWM is the main control mode. There is module of PWM which is FB43 in S7-300 PLC ,but the source program is not public. This design imitated the function and form of FB43 and programmed the module of PWM independently by the means of Ladder Diagram. This program consists of two loops. One is the inner for loop-the number of pulse in a period, the other is outside loop-the number of the positive. Independently designed module of PWM acted in concert with the module of FB41 PID to carry through the temperature control of boiler. And it finally realized the time proportioning control. Indecently design has detailed description. It is can be used for education and research of automatics, it also can be used for engineering control take the place of FB43.

Key words: Pulse with output; three step signal on; two step signal for bipolar manipulated value on; manual control

- I -

S7-300 PLC中FB43 PWM 算法开放源程序设计

目 录

1 引言 ........................................................................................................................................ 1

1.1 国内外研究现状 .......................................................................................................... 1 1.2 课题研究的意义 .......................................................................................................... 1 2 西门子中FB43功能 ............................................................................................................. 1 3 西门子FB43参数意义 ......................................................................................................... 2

3.1输入变量INV ............................................................................................................... 2 3.2周期时间PER_TM ....................................................................................................... 2 3.3最小脉冲时间P_B_TM ............................................................................................... 2 3.4 比率因子RATIOFAC .................................................................................................. 2 3.5 三级控制STEP3_ON .................................................................................................. 3 3.6 二级控制ST2BI_ON .................................................................................................. 3 3.7 手动控制MAN_ON .................................................................................................... 4 3.8 正脉冲输入POS_P_ON .............................................................................................. 4 3.9 负脉冲输入NEG_P_ON ............................................................................................. 5 3.10 自动同步SYN_ON ................................................................................................... 5 3.11完全重启动COM_RST .............................................................................................. 5 3.12 采样时间CYCLE ...................................................................................................... 6 3.13 QPOS_P ...................................................................................................................... 6 3.14 QNEG_P ...................................................................................................................... 6 3.15 FB43参数简述 ........................................................................................................... 6 4 数据处理和转化 .................................................................................................................... 7

4.1 数据类型 ...................................................................................................................... 7 4.2数据的处理 ................................................................................................................... 7 5 “仿FB43”算法思想 ............................................................................................................ 8

5.1运行模式的参数设置 ................................................................................................... 8 5.2 二级控制器 .................................................................................................................. 8 5.3 三级控制器 .................................................................................................................. 8 5.4 对FB43时间的理解 ................................................................................................... 9 5.5 脉冲宽度的算法思想解析 .......................................................................................... 9 6 “仿FB43”PWM算法的程序流程图“ ................................................................................ 9 7 “仿FB43”的建立、调用和设计 ...................................................................................... 10

7.1 背景数据块的建立和调用 ........................................................................................ 10 7.2 功能块“仿FB43”的建立和调用 ............................................................................ 11 7.3 功能块“仿FB43”的编写 ...................................................................................... 12 7.4 “仿FB43”数据转化方法 ........................................................................................ 13 7.5 “仿FB43”的程序设计 ............................................................................................ 13

7.5.1 程序的初始化 .................................................................................................. 13 7.5.2 手动控制 .......................................................................................................... 13 7.5.3 自动控制下的数据类型转化 .......................................................................... 14

- II -