Presentation is loading. Please wait.

Presentation is loading. Please wait.

第六章 应用程序结构.

Similar presentations


Presentation on theme: "第六章 应用程序结构."— Presentation transcript:

1 第六章 应用程序结构

2 概述 应用管理 单站多实例软件 完整的应用程序保存在单一文件中 (*.STU) 版本号管理 软件结构 任务 (单任务或多任务, ....)
程序段和子程序 功能组件 导入 / 导出程序源文件 部分或全部 (一个或更多程序段, 整个应用, ...) 保护 程序分析

3 软件结构 不同任务 单个任务 : 主任务 (MAST) 多任务 : MAST + 快速任务 (FAST) + 辅助任务 (AUX)
事件任务 : EVT 或 TIMER 执行模式 循环执行 周期执行 程序段 任务被组织为多个程序段 子程序 - SR 在 MAST, FAST 和 AUX 任务当中 , 程序段可以调用子程序

4 任务 MAST : 主任务 由程序段 & 子程序组成 使用 LD, FBD, IL, ST 或 SFC编程
循环或周期扫描( ms, 0 = 循环操作) 由看门狗,系统位或字控制 FAST : 快速任务 使用 LD, FBD, IL, ST编程 周期执行 ( ms) MAST task System objects Description %SW0 Task period %S30 Master task activation %S11 Watchdog error %S19 Period overrun %SW30 Execution time (in ms) of the last cycle %SW31 Execution time (in ms) of the longest cycle %SW32 Execution time (in ms) of the shortest cycle FAST task %SW1 Task period %S31 Fast task activation %S11 Watchdog error %S19 Period overrun %SW33 Execution time (in ms) of the last cycle %SW34 Execution time (in ms) of the longest cycle %SW35 Execution time (in ms) of the shortest cycle

5 任务 (续) EVT 或 TIMER : 事件任务 减少应用程序对输入/输出模块,时间定时器事件的响应时间
单个程序段,可使用 LD, FBD, IL, ST语言编程 EVTi : 事件来自输入/输出模块 TIMERi : 事件来自定时器 (ITCNTRL 功能) AUX : 辅助任务 用于较慢的任务处理 可以编写最多4个辅助任务程序 (AUX0 至 AUX3) ,在 Premium TSX P57 5•• 和 Quantum 140 CPU 6•••• 上 由程序段 & 子程序组成 使用 LD, FBD, IL, ST编程 周期执行 (从10 ms 至 2.55 s) EVT-type event coming from input/output modules and expert modules: Quantum : . Interrupt module (140HLI340 00) Premium : . Input/output modules (TSXDEY6FK and TSXDMY28FK) . All counting modules . All axis control modules . All electronic cam modules

6 执行模式 循环 程序处理 读输入 写输出 循环 n 循环 n+1 周期 程序处理 读输入 写输出 S.P. 周期

7 多任务 多任务 = MAST 和 (FAST 或 EVT 或 AUX) 任务的优先级 事件任务 快速任务 主任务 辅助任务
Available tasks and processing

8 多任务 (续) 执行 举例:循环主任务, 周期快速任务 (周期 = 20 ms)

9 操作模式 新建任务 选择 “Task” 文件夹 右击 => New Task 选择类型 (快速或辅助任务) 选择周期和看门狗
点击OK确认所有输入 注 : 如果使用 AUX 任务, MAST 任务 必须是周期的

10 程序段 每个任务可以由许多程序段组成 无限制 与程序段相关联的属性 名称 : 最多 32 个字符
语言 : LD, FBD, IL, ST 或 SFC 相关任务 : Mast, Fast, Event, Aux, SR 条件 (可选) : 有效位执行, 直接配置 注释 : 最多 256 个字符 保护 : 写保护, 读/写保护 程序段的执行顺序 : 按在浏览器中显示的顺序执行

11 操作模式 新建程序段 选择 “section” 文件夹 右击 => New Section 输入参数 点击OK确认所有输入 应用
导入一个程序段 导出一个程序段 (选择要导出的程序段) 删除一个程序段 (选择要删除的程序段)

12 子程序 单独编程, 可以使用LD, IL, ST, FBD编程 可以被程序程序段或另一个子程序调用
嵌套层数限制为 8. 子程序不能调用自己 (不能递归). 程序段不能调用属于其它任务的子程序

13 功能视图 PLC 项目的结构按照实际过程的结构进行组织: 功能组件的树状结构 多任务管理简化编程环境 创建模块化应用 提高程序重用性
组件导入/导出服务, 变量的重新分配

14 原则 对功能分析的“直接翻译” 可重复使用和嵌套不同的组件 使用程序段构建 PLC 程序的基本组件 功能组件
LD, IL, ST, FBD 或带宏步的 SFC 使用指令, EFB, DFB的功能库 用户功能块-封装程序  I/O 接口可以参数化 使用非定位变量: 公共和私有 使用 LD, ST, IL, FBD 编写代码 基本和标准指令 功能组件 程序段 EFBs & DFBs 基本指令 Function modules : can be used to structure the application according to control system functions and sub-functions. A function module is a group of program elements (sections, events, macro-steps, animation tables, etc) for creating a control system function.

15 功能视图 Station Functional文件夹允许 : 访问, 创建或删除功能组件 导出或导入整个项目 访问项目属性 保护项目
功能组件文件夹包括 : 程序文件夹由一个或几个程序段组成 仿真表文件夹由一个或几个仿真表组成 操作屏文件夹由一个或几个操作屏组成 更低层次的功能组件

16 创建功能模块 创建 直接 通过导入 创建新的功能组件 添加/创建程序段, 事件, 流程图, 表格或屏幕
例 1 : 程序段, 事件或流程图已经存在结构视图中 简单拖拽,在功能组件上放置程序段 例 2 : 程序段, 事件或流程图在结构视图中不存在 当从功能视图中创建程序段时 : 相关任务必须在创建程序段的时候指定 A function module is made up of : A name : 32 characters. This name must be unique in the application A descriptive file (256 characters), not memorized in the PLC but memorized in the .STU file in the application Function submodules: lower-level function modules Associated code modules: sections, events, SFC modules Associated animation tables Associated operator screens

17 管理 移动功能组件 (简单拖拽移动功能组件) 分离功能组件 (断开功能模块与相关对象 (程序, 表格, 屏幕)之间的联系)
删除一个或多个功能组件 不删除关联的代码段和仿真表 删除关联的代码段和仿真表 导入 / 导出功能组件 不重新分配 使用导入向导重新分配 保护功能组件中的程序段 激活功能组件中的程序段条件 (强置 0, 强置 1, 强置取消)

18 导入/导出功能 导出功能 复制文件, 项目程序的部分或全部 生成的文件包括未受保护数据和受保护数据的引用
由扩展文件决定的导出类型 (举例 : *.XDB 导出 DFB 类型, 等.) 导入功能 获取已有项目程序的部分或全部 应用前自动存储 冲突管理 (如果在导入时,元素已经存在) 导入之后必须进行代码分析 A message tells in the Output Window that import or export is complete. If errors occur during import or export, a message inform of these.

19 导出文件类型

20 导出操作 通过对话框 选择导出单元 右击 => Export 选择文件夹和文件名 如果有选择, 选择同时导出 点击 Export 确认
注 : 有读/写保护的程序段不能导出. 受保护的 DFB 可以导出,但导出文件 *.XDF 被加密. Available options as a function of the elements to be exported : Export available :

21 导入操作 通过对话框 选择导入单元的位置 右击 => Import 保存应用 选择文件夹和要导入的文件 选择是否使用导入向导
注 : 导入整个应用程序, 打开并选择 *.XEF 文件 选择使用导入向导

22 冲突管理 导入错误报告对话框 (如果元素已经存在) 变量管理 : 保持全部 替换全部 重命名 : 双击一个单元的Rename 列

23 向导 在导入期间, 可以使用助手以方便元素进行重新指定 选中导入选项 “with wizard"
每种元素类型有一个选项卡 (DDT, DFB, 变量, 程序段, 子程序, 事件) 通用命令 查找和替换 (可以替换字符串) 调用和保存

24 全局保护 激活程序段的全局保护 1 – 右击并选择属性 2 – 使保护有效 3 – 输入密码 Global protection
The project protection function is accessible from the Properties screen of the project in offline mode. This function is used to protect the program sections. Note: The protection cannot be activated if there is no password. The protection is active each time a password-protected project is opened. To have a global protection of the application, select in the project settings "Without" in Upload Information window

25 程序段保护 保护程序段 (在全局保护已激活的前提下) 2 – 选择保护 : 只读 读/写 1 – 右击并选择程序段的属 性
1 – 右击并选择程序段的属 性 2 – 选择保护 : 只读 读/写 Display at each section level: Blank: no protection Padlock unlocked: section protected protection deactivated Padlock locked: protection activated

26 分析应用项目 允许检测每个应用程序修改后产生的错误 在输出窗口自动显示在分析时检测到的所有类型的错误
在输出窗口出现消息,允许你通过双击直接访问出现错误的程序部分 The output sheets display the results of an executed action or error messages. Double-clicking on an error message to open the respective Editor and mark the "faulty" entry. New error entries are displayed in red, already checked errors are displayed in underlined blue. New warning entries are displayed in blue, already checked warnings are displayed in underlined blue.

27 创建 下拉菜单 “Build” 可以用于生成项目 Rebuild All Project 创建可以下载至PLC或PLC仿真器的文件
Build Project 对现有项目的改变进行生成 Impossible to build or rebuild all the project if an error is present during the analyze. 输出窗口


Download ppt "第六章 应用程序结构."

Similar presentations


Ads by Google