CODESYSControlV3_Overview
Codesys中文编程手册-CN
Codesys中文编程手册_CNCodesys PLC目录第 1 页目录1 Codesys PLC Control 简介...................................................................... .. (1)1.1 引言...................................................................... .................................................................. 1 1.2 项目组件...................................................................... ........................................................... 3 1.3 语言...................................................................... . (10)1.3.1 编程语言...................................................................... (10)1.3.2 指令表(IL) ................................................................... .. (10)1.3.3 结构化文本(ST).................................................................. . (12)1.3.4 顺序功能图(SFC) ................................................................ (17)1.3.5 功能块图(FBD)................................................................. (21)1.3.6 连续功能图编辑器(CFC) ................................................................ . (21)1.3.6 梯形图(LD).................................................................. .. (22)1.4 调试,联机功能...................................................................... .. (24)1.5 IEC 61131-3 ...................................................................... .................................................... 26 2 样例程序...................................................................... ................................................................ 27 2.1 样例程序...................................................................... ......................................................... 27 3 子项组件...................................................................... ................................................................ 36 3.1 主窗口 ..................................................................... ............................................................. 36 3.2 选项...................................................................... ................................................................ 38 3.3 项目管理...................................................................... ......................................................... 53 3.4 对象...................................................................... ................................................................ 74 3.5 编辑功能...................................................................... ......................................................... 87 3.6 联机功能...................................................................... ......................................................... 92 3.7 窗口...................................................................... .............................................................. 101 3.8 帮助系统...................................................................... ........................................................ 102 3.9 日志...................................................................... .............................................................. 103 4 编辑器 ..................................................................... (105)4.1 概述...................................................................... .............................................................. 105 4.2 声明编辑器 ..................................................................... .. (107)4.3 文本编辑器 ..................................................................... .. (118)4.4 指令表编辑器...................................................................... . (122)4.5 结构化文本编辑器...................................................................... (124)4.6 图形编辑器 ..................................................................... .. (125)4.7 功能块图编辑器 ..................................................................... . (127)2目录第 2 页4.8 梯形图编辑器...................................................................... . (132)4.9 连续功能图编辑器...................................................................... (137)4.10 顺序功能图编辑器...................................................................... (150)5 资源...................................................................... ..................................................................... 159 5.1 概述...................................................................... .............................................................. 159 5.2 全局变量...................................................................... ........................................................ 160 5.3 PLC 配置............................................................................................................................ 163 5.4 任务配置...................................................................... ........................................................ 164 5.5 抽样跟踪...................................................................... ........................................................ 167 5.6 监视和接收管理器...................................................................... (172)6 库管理 ..................................................................... (175)6.1 库管理器...................................................................... ........................................................ 175 7 工程接口(ENI) ................................................................ .. (177)7.1 概述...................................................................... .............................................................. 177 8 附录...................................................................... ..................................................................... 180 8.1 数据类型...................................................................... ........................................................ 180 8.1.1 概述...................................................................... ........................................................ 180 8.1.2 标准数据类型...................................................................... (181)8.1.2.1 BOOL.................................................................... ................................................. 181 8.1.2.2 BYTE.................................................................... .................................................. 181 8.1.2.3 WORD.................................................................... ................................................ 182 8.1.2.4 DWORD................................................................... ............................................... 182 8.1.2.5SINT ................................................................... .................................................... 182 8.1.2.6USINT .................................................................. ................................................... 182 8.1.2.7 INT..................................................................... ..................................................... 182 8.1.2.8UINT ................................................................... .................................................... 182 8.1.2.9DINT ................................................................... .................................................... 183 8.1.2.10UDINT .................................................................. .................................................. 183 8.1.2.11 REAL.................................................................... .................................................. 183 8.1.2.12 LREAL................................................................... ................................................. 183 8.1.2.13 STRING.................................................................. ................................................ 183 8.1.2.14 TIME.................................................................... ................................................... 184 8.1.2.15TIME_OF_DAY ............................................................ ........................................... 184 8.1.2.16 DATE.................................................................... .................................................. 184 8.1.2.17DATE_AND_TIME........................................................... (184)8.1.3. 用户数据类型...................................................................... (185)8.1.3.1 数组...................................................................... .. (185)8.1.3.2 指针...................................................................... .. (186)8.1.3.3 枚举(ENUM) ............................................................... (186)3目录第 3 页8.1.3.4 结构(STRUCT) ............................................................. . (187)8.1.3.5 参考类型(别名).................................................................... . (188)8.1.3.6 子范围类型 ..................................................................... . (189)8.2 操作符 ..................................................................... ........................................................... 190 8.2.1 概述...................................................................... ........................................................ 190 8.2.2 IEC 操作符概述...................................................................... .. (190)8.2.3 数值操作符 ..................................................................... . (193)8.2.3.1 ABS..................................................................... ................................................... 193 8.2.3.2 ACOS.................................................................... ................................................. 193 8.2.3.3ASIN ................................................................... ................................................... 193 8.2.3.4 ATAN.................................................................... .................................................. 193 8.2.3.5 COS..................................................................... .................................................. 194 8.2.3.6 EXP..................................................................... ................................................... 194 8.2.3.7EXPT ................................................................... .................................................. 194 8.2.3.8 LN...................................................................... .................................................... 194 8.2.3.9 LOG..................................................................... .................................................. 195 8.2.3.10SIN .................................................................... ..................................................... 195 8.2.3.11 SQRT.................................................................... .................................................. 195 8.2.3.12 TAN..................................................................... ................................................... 195 8.2.4 算术操作符 ..................................................................... . (196)8.2.4.1ADD .................................................................... ................................................... 196 8.2.4.2MUL .................................................................... ................................................... 196 8.2.4.3SUB .................................................................... ................................................... 196 8.2.4.4DIV .................................................................... ..................................................... 197 8.2.4.5MOD .................................................................... .................................................. 197 8.2.5 位串操作符 ..................................................................... . (198)8.2.5.1AND .................................................................... ................................................... 198 8.2.5.2OR ..................................................................... .................................................... 198 8.2.5.3XOR .................................................................... ................................................... 198 8.2.5.4NOT .................................................................... ................................................... 199 8.2.6 位移操作符 ..................................................................... . (199)8.2.6.1SHL .................................................................... .................................................... 199 8.2.6.2SHR .................................................................... ................................................... 200 8.2.6.3ROL .................................................................... ................................................... 201 8.2.6.4 ROR..................................................................... .................................................. 201 8.2.7 选择操作符 ..................................................................... . (203)8.2.7.1SEL .................................................................... .................................................... 203 8.2.7.2 MAX..................................................................... .................................................. 203 8.2.7.3MIN..................................................................... ................................................... 204 8.2.7.4 LIMIT................................................................... ................................................... 204 8.2.7.5 MUX..................................................................... .................................................. 204 8.2.8 比较操作符 ..................................................................... . (206)8.2.8.1 GT...................................................................... . (206)48.2.8.2 LT...................................................................... ..................................................... 206 目录第 4 页8.2.8.3LE ..................................................................... ..................................................... 206 8.2.8.4 GE...................................................................... .................................................... 207 8.2.8.5 EQ...................................................................... .................................................... 207 8.2.8.6 NE...................................................................... .................................................... 208 8.2.9 选择不同的操作符...................................................................... .. (209)8.2.9.1 INDEXOF................................................................. .............................................. 209 8.2.9.2 SIZEOF.................................................................. ................................................ 209 8.2.9.3 ADR(地址操作符)) ................................................................. . (209)8.2.9.4 ^(内容操作符) ................................................................... (209)8.2.9.5 CAL(调用操作符) ................................................................... . (209)8.2.9.6BITADR ................................................................. ................................................. 210 8.2.10 类型转换操作符 ..................................................................... (211)8.2.10.1 BOOL_TO 转换...................................................................... . (211)8.2.10.2 TO_BOOL 转换...................................................................... .. (211)8.2.10.3 STRING_TO 转换...................................................................... . (211)8.2.10.4 TO_STRING 转换...................................................................... . (211)8.2.10.5 TIME_TO 转换...................................................................... (212)8.2.10.6 DATE_TO 转换...................................................................... .. (212)8.2.10.7 TOD_TO 转换...................................................................... . (212)8.2.10.8 ―DT_TO 转换...................................................................... .. (212)8.2.10.9 REAL_TO-/LREAL_TO 转换...................................................................... (213)8.2.10.10 整型数类型之间的转换...................................................................... . (213)8.2.10.11TRUNC .................................................................. ................................................ 213 8.3 操作数 ..................................................................... ........................................................... 214 8.3.1 常数...................................................................... ........................................................ 214 8.3.1.1 BOOL 常数...................................................................... .. (214)8.3.1.2 TIME 常数...................................................................... . (214)8.3.1.3 DATE 常数...................................................................... (214)8.3.1.4 TIME_OF_DAY 常数...................................................................... (214)8.3.1.5 DATE_AND_TIME 常数...................................................................... . (215)8.3.1.6 数值常数...................................................................... .. (215)8.3.1.7 REAL/LREAL 常数...................................................................... (215)8.3.1.8 STRING 常数...................................................................... .. (215)8.3.1.9 类型符...................................................................... .. (216)8.3.2 变量...................................................................... ........................................................ 217 8.3.2.1 变量...................................................................... .. (217)8.3.2.2 地址...................................................................... .. (217)8.3.2.3 存取数组、结构和 POU 变量...................................................................... .. (218)8.3.2.4 变量的位寻址...................................................................... (218)8.3.2.5 功能...................................................................... .. (218)8.3.2.6 系统标志...................................................................... . (218)8.3.2.6.1 概述...................................................................... .. (218)58.3.2.6.2SYSTEMINFO ............................................................. . (219)8.3.2.6.3 SYSTEMTASKINFOARR....................................................... (219)目录第 5 页8.4 系统功能...................................................................... ........................................................ 220 8.4.1 CheckBounds 功能...................................................................... .. (220)8.4.2 CheckDivByte 功能...................................................................... .. (221)8.4.3 CheckDivReal 功能 ..................................................................... .. (221)8.4.4 CheckDivWord 功能...................................................................... .. (222)8.4.5 CheckDivDWord 功能 ..................................................................... .. (222)8.4.6 CheckRangeSigned 功能...................................................................... . (223)8.4.7 CheckRangeUnsigned 功能...................................................................... . (224)8.5 使用键盘...................................................................... ........................................................ 226 8.6 创建错误表...................................................................... . (230)8.7 命令行命令 ..................................................................... .. (245)6Codesys PLC Control:简介第 1 页共 249 页1 Codesys PLC Control 简介1.1 引言Codesys PLC ControlCodesys PLC Control 是为PLC 设计的一种完整的开发环境。
CODESYS V3 基础编程指南4.
图9.X 路径3D配置在主程序中,声明了VISUStruct3Dcontrol及调用了PathGenerator的功能块,该功能块的作用是用于产生3D路径及跟踪轨迹,该轨迹可以存放2200个点。
这两个变量都与该工具的属性有相应关系。
(2)程序编写FUNCTION_BLOCK VisuStruct3DTrackVAR_INPUTpData: POINTER TO ARRAY[0..0] OF VisuStruct3DPathPoint;udiNumberOfPointsInArray: UDINT;udiFirstPoint: UDINT;udiNumberOfPointsToDraw: UDINT;pProjection: POINTER TO Projection;END_VARpData 指向一个VisuStruct3DPathPoint 元素数组。
这个数字必须至少含有udiNumberOfPointsInArray 个元素。
数组必须包含在应用中并且数据指针必须通过应用进行设置。
一个点的说明TYPE VisuStruct3DPathPoint :STRUCTv: Vector3;udiSourceElementID: UDINT;dwAddInfo: DWORD;END_STRUCTEND_TYPE(3)变量映射如图9.x所示,在属性中的“变量”中可以设置拨码开关的映射变量。
图9.X 变量映射程序最终的运行效果如图9.x所示。
图9.X 路径3D示意图示例程序可以在Sample\第九章\ActiveX\下进行查看。
9.3.6报警管理报警管理工具主要包括报警表格和报警条。
报警管理工具视图如图9.x所示。
图9.X 报警管理工具视图1.报警表格用户可以自定义可视化报警,但必须在CoDesys报警配置中预先进行定义。
在可视化编辑器中,用户可以通过在工具箱中添加“”,将其拖拽至画面编辑区域;故需要完成报警显示需要有两部分的设置,第一,需要在“Application”中设置报警配置,第二,需要在可视化编辑器中进行设置。
codesys编程手册
1.1 CoDeSys 是什么 ................................................................................................................... 4 1.2 CoDeSys 功能一览................................................................................................................ 4 2. CoDeSys 组成 ............................................................................................................................... 7 2.1 工程组件............................................................................................................................. 7
Codesys中文编程手册-CN
Codesys中文编程手册_CNCodesys PLC目录第 1 页目录1 Codesys PLC Control 简介...................................................................... .. (1)1.1 引言...................................................................... .................................................................. 1 1.2 项目组件...................................................................... ........................................................... 3 1.3 语言...................................................................... . (10)1.3.1 编程语言...................................................................... (10)1.3.2 指令表(IL) ................................................................... .. (10)1.3.3 结构化文本(ST).................................................................. . (12)1.3.4 顺序功能图(SFC) ................................................................ (17)1.3.5 功能块图(FBD)................................................................. (21)1.3.6 连续功能图编辑器(CFC) ................................................................ . (21)1.3.6 梯形图(LD).................................................................. .. (22)1.4 调试,联机功能...................................................................... .. (24)1.5 IEC 61131-3 ...................................................................... .................................................... 26 2 样例程序...................................................................... ................................................................ 27 2.1 样例程序...................................................................... ......................................................... 27 3 子项组件...................................................................... ................................................................ 36 3.1 主窗口 ..................................................................... ............................................................. 36 3.2 选项...................................................................... ................................................................ 38 3.3 项目管理...................................................................... ......................................................... 53 3.4 对象...................................................................... ................................................................ 74 3.5 编辑功能...................................................................... ......................................................... 87 3.6 联机功能...................................................................... ......................................................... 92 3.7 窗口...................................................................... .............................................................. 101 3.8 帮助系统...................................................................... ........................................................ 102 3.9 日志...................................................................... .............................................................. 103 4 编辑器 ..................................................................... (105)4.1 概述...................................................................... .............................................................. 105 4.2 声明编辑器 ..................................................................... .. (107)4.3 文本编辑器 ..................................................................... .. (118)4.4 指令表编辑器...................................................................... . (122)4.5 结构化文本编辑器...................................................................... (124)4.6 图形编辑器 ..................................................................... .. (125)4.7 功能块图编辑器 ..................................................................... . (127)2目录第 2 页4.8 梯形图编辑器...................................................................... . (132)4.9 连续功能图编辑器...................................................................... (137)4.10 顺序功能图编辑器...................................................................... (150)5 资源...................................................................... ..................................................................... 159 5.1 概述...................................................................... .............................................................. 159 5.2 全局变量...................................................................... ........................................................ 160 5.3 PLC 配置............................................................................................................................ 163 5.4 任务配置...................................................................... ........................................................ 164 5.5 抽样跟踪...................................................................... ........................................................ 167 5.6 监视和接收管理器...................................................................... (172)6 库管理 ..................................................................... (175)6.1 库管理器...................................................................... ........................................................ 175 7 工程接口(ENI) ................................................................ .. (177)7.1 概述...................................................................... .............................................................. 177 8 附录...................................................................... ..................................................................... 180 8.1 数据类型...................................................................... ........................................................ 180 8.1.1 概述...................................................................... ........................................................ 180 8.1.2 标准数据类型...................................................................... (181)8.1.2.1 BOOL.................................................................... ................................................. 181 8.1.2.2 BYTE.................................................................... .................................................. 181 8.1.2.3 WORD.................................................................... ................................................ 182 8.1.2.4 DWORD................................................................... ............................................... 182 8.1.2.5SINT ................................................................... .................................................... 182 8.1.2.6USINT .................................................................. ................................................... 182 8.1.2.7 INT..................................................................... ..................................................... 182 8.1.2.8UINT ................................................................... .................................................... 182 8.1.2.9DINT ................................................................... .................................................... 183 8.1.2.10UDINT .................................................................. .................................................. 183 8.1.2.11 REAL.................................................................... .................................................. 183 8.1.2.12 LREAL................................................................... ................................................. 183 8.1.2.13 STRING.................................................................. ................................................ 183 8.1.2.14 TIME.................................................................... ................................................... 184 8.1.2.15TIME_OF_DAY ............................................................ ........................................... 184 8.1.2.16 DATE.................................................................... .................................................. 184 8.1.2.17DATE_AND_TIME........................................................... (184)8.1.3. 用户数据类型...................................................................... (185)8.1.3.1 数组...................................................................... .. (185)8.1.3.2 指针...................................................................... .. (186)8.1.3.3 枚举(ENUM) ............................................................... (186)3目录第 3 页8.1.3.4 结构(STRUCT) ............................................................. . (187)8.1.3.5 参考类型(别名).................................................................... . (188)8.1.3.6 子范围类型 ..................................................................... . (189)8.2 操作符 ..................................................................... ........................................................... 190 8.2.1 概述...................................................................... ........................................................ 190 8.2.2 IEC 操作符概述...................................................................... .. (190)8.2.3 数值操作符 ..................................................................... . (193)8.2.3.1 ABS..................................................................... ................................................... 193 8.2.3.2 ACOS.................................................................... ................................................. 193 8.2.3.3ASIN ................................................................... ................................................... 193 8.2.3.4 ATAN.................................................................... .................................................. 193 8.2.3.5 COS..................................................................... .................................................. 194 8.2.3.6 EXP..................................................................... ................................................... 194 8.2.3.7EXPT ................................................................... .................................................. 194 8.2.3.8 LN...................................................................... .................................................... 194 8.2.3.9 LOG..................................................................... .................................................. 195 8.2.3.10SIN .................................................................... ..................................................... 195 8.2.3.11 SQRT.................................................................... .................................................. 195 8.2.3.12 TAN..................................................................... ................................................... 195 8.2.4 算术操作符 ..................................................................... . (196)8.2.4.1ADD .................................................................... ................................................... 196 8.2.4.2MUL .................................................................... ................................................... 196 8.2.4.3SUB .................................................................... ................................................... 196 8.2.4.4DIV .................................................................... ..................................................... 197 8.2.4.5MOD .................................................................... .................................................. 197 8.2.5 位串操作符 ..................................................................... . (198)8.2.5.1AND .................................................................... ................................................... 198 8.2.5.2OR ..................................................................... .................................................... 198 8.2.5.3XOR .................................................................... ................................................... 198 8.2.5.4NOT .................................................................... ................................................... 199 8.2.6 位移操作符 ..................................................................... . (199)8.2.6.1SHL .................................................................... .................................................... 199 8.2.6.2SHR .................................................................... ................................................... 200 8.2.6.3ROL .................................................................... ................................................... 201 8.2.6.4 ROR..................................................................... .................................................. 201 8.2.7 选择操作符 ..................................................................... . (203)8.2.7.1SEL .................................................................... .................................................... 203 8.2.7.2 MAX..................................................................... .................................................. 203 8.2.7.3MIN..................................................................... ................................................... 204 8.2.7.4 LIMIT................................................................... ................................................... 204 8.2.7.5 MUX..................................................................... .................................................. 204 8.2.8 比较操作符 ..................................................................... . (206)8.2.8.1 GT...................................................................... . (206)48.2.8.2 LT...................................................................... ..................................................... 206 目录第 4 页8.2.8.3LE ..................................................................... ..................................................... 206 8.2.8.4 GE...................................................................... .................................................... 207 8.2.8.5 EQ...................................................................... .................................................... 207 8.2.8.6 NE...................................................................... .................................................... 208 8.2.9 选择不同的操作符...................................................................... .. (209)8.2.9.1 INDEXOF................................................................. .............................................. 209 8.2.9.2 SIZEOF.................................................................. ................................................ 209 8.2.9.3 ADR(地址操作符)) ................................................................. . (209)8.2.9.4 ^(内容操作符) ................................................................... (209)8.2.9.5 CAL(调用操作符) ................................................................... . (209)8.2.9.6BITADR ................................................................. ................................................. 210 8.2.10 类型转换操作符 ..................................................................... (211)8.2.10.1 BOOL_TO 转换...................................................................... . (211)8.2.10.2 TO_BOOL 转换...................................................................... .. (211)8.2.10.3 STRING_TO 转换...................................................................... . (211)8.2.10.4 TO_STRING 转换...................................................................... . (211)8.2.10.5 TIME_TO 转换...................................................................... (212)8.2.10.6 DATE_TO 转换...................................................................... .. (212)8.2.10.7 TOD_TO 转换...................................................................... . (212)8.2.10.8 ―DT_TO 转换...................................................................... .. (212)8.2.10.9 REAL_TO-/LREAL_TO 转换...................................................................... (213)8.2.10.10 整型数类型之间的转换...................................................................... . (213)8.2.10.11TRUNC .................................................................. ................................................ 213 8.3 操作数 ..................................................................... ........................................................... 214 8.3.1 常数...................................................................... ........................................................ 214 8.3.1.1 BOOL 常数...................................................................... .. (214)8.3.1.2 TIME 常数...................................................................... . (214)8.3.1.3 DATE 常数...................................................................... (214)8.3.1.4 TIME_OF_DAY 常数...................................................................... (214)8.3.1.5 DATE_AND_TIME 常数...................................................................... . (215)8.3.1.6 数值常数...................................................................... .. (215)8.3.1.7 REAL/LREAL 常数...................................................................... (215)8.3.1.8 STRING 常数...................................................................... .. (215)8.3.1.9 类型符...................................................................... .. (216)8.3.2 变量...................................................................... ........................................................ 217 8.3.2.1 变量...................................................................... .. (217)8.3.2.2 地址...................................................................... .. (217)8.3.2.3 存取数组、结构和 POU 变量...................................................................... .. (218)8.3.2.4 变量的位寻址...................................................................... (218)8.3.2.5 功能...................................................................... .. (218)8.3.2.6 系统标志...................................................................... . (218)8.3.2.6.1 概述...................................................................... .. (218)58.3.2.6.2SYSTEMINFO ............................................................. . (219)8.3.2.6.3 SYSTEMTASKINFOARR....................................................... (219)目录第 5 页8.4 系统功能...................................................................... ........................................................ 220 8.4.1 CheckBounds 功能...................................................................... .. (220)8.4.2 CheckDivByte 功能...................................................................... .. (221)8.4.3 CheckDivReal 功能 ..................................................................... .. (221)8.4.4 CheckDivWord 功能...................................................................... .. (222)8.4.5 CheckDivDWord 功能 ..................................................................... .. (222)8.4.6 CheckRangeSigned 功能...................................................................... . (223)8.4.7 CheckRangeUnsigned 功能...................................................................... . (224)8.5 使用键盘...................................................................... ........................................................ 226 8.6 创建错误表...................................................................... . (230)8.7 命令行命令 ..................................................................... .. (245)6Codesys PLC Control:简介第 1 页共 249 页1 Codesys PLC Control 简介1.1 引言Codesys PLC ControlCodesys PLC Control 是为PLC 设计的一种完整的开发环境。
基于Codesys V3的可视化编程
基于Codesys V3的可视化编程作者:耿庆州来源:《市场周刊·市场版》2017年第16期Codesys是由德国3S公司开发的一款开放式控制软件,广泛应用于控制器及显示器的软件开发。
本文以hesmor 公司L7系列显示器作为硬件,基于CodesysV3软件平台开发了3m天井钻机的显示器界面。
一、智能人机界面设计主界面中间显示钻机的破岩力及扭矩值,上方信息栏显示各压力传感器、液压油温、液压油位、钻杆称重值、钻杆计数值及时间。
最下方为功能菜单区域,可查看系统设置、系统状态、操作登录、钻杆计数历史、系统故障及历史故障记录。
右侧区域显示机械手的状态及急停、故障信息。
图1 主界面二、人机界面逻辑控制为了实现智能、丰富的人机交互,除了普通的数据显示外,一些复杂的功能需要通过后台程序代码实现。
以项目中比较典型的动态图像、数据库读取、存储、删除及用户管理为例,讲解了Codesys 可视化的具体应用。
(一)报警图标显示系统故障判断点数较多,在主界面无法一一单独显示。
为了不需要切换到故障查看界面即可查看系统实时故障,在主界面设计了三个”Image”元件用于显示系统故障的图标。
图标每3秒钟切换一组,图标的显示通过”Image”元件的“Bitmap ID”属性设置,该属性为字符串变量值,以下示例代码中,stAlarmImage1字符串变量用于存储报警图标的地质,该变量通过一个自定义函数”FUN_AlarmImage”来实现赋值,该数值与imagepool中的ID相对应。
位变量”visible_AlarmImage1”用来控制”state variable”属性,可实现报警图标的显示与隐藏。
部分代码如下:(*主界面报警信息显示*)maxView:=(count+2)/3;T1(IN:=NOT T1.Q , PT:=T#3S , Q=> , ET=> );IF T1.Q THENcurView:=curView+1;END_IFIF curView>=maxView OR curView>16 THENcurView:=0;END_IF(*报警图标1*)IF curView*3stAlarmImage1:=Fun_AlarmImage(n:=Buffer[curView*3]);visible_AlarmImage1:=TRUE;ELSEstAlarmImage1:=’’;visible_AlarmImage1:=FALSE;END_IF(二)历史信息记录程序系统参数、故障历史、钻杆历史等信息记录采用显示器硬件设备附带的Record组件库。
CODESYS V3 基础编程指南
1. CoDeSys 侧 Modbus TCP 主站配置 如使用 CoDeSys 所配置的 Modbus TCP 的主站需要首先对主站进行配置,此外,需要对从站的
配置也在主站的参数下也作相应的配置,具体步骤在下文会有详细的介绍。 1) 添加主站 添加 Modbus TCP 硬件设备,由于 Modbus TCP 基于以太网的通讯,故先添加硬件,鼠标右键
图 12.x Modbus 串行通信从站设置 从站地址:设置从站的站地址,1~247 有效。 响应超时:设置从站的响应超时时间,如果超过该时间从站还没有相应主站,则主站认为该从 站有通讯故障。 6) 设置从站的通讯通道 如图 12.x 所示,在该设置选项中,用户可以自定义从站的 Modbus 通讯通道,但必须与实际的 从站硬件相匹配,按下“添加通道”后,系统会自动弹出对话框,用户可以直接选择访问功能码、 地址偏移、数据长度及通讯周期时间等。
图 12.x Modbus 串行通信主站配置 传输模式:选择 RTU 或者 ASCII 码。 响应超时(ms):指主站等待从站响应的时间间隔。如果在这段时间中从站没有发出响应,主 站将会请求下一个从站。此时输入的值会认为是每个从站的缺省值。在 ⇘ 从站配置页面,可单独 为每个从站设置合适的时间间隔。 框架之间的时间(ms):指主站接收上一个响应数据帧到下一个请求数据帧之间等待的时间间 隔。这个参数可用于调节数据交换率。 至此,主站的配置结束,接下来,需要对主站连接的从站做相应的配置。 5) 主站下配置第三方的 Modbuቤተ መጻሕፍቲ ባይዱ 串行设备 在 CoDeSys 的设备树下,鼠标选中主站,右键选择“添加设备” ,选择添加 Modbus 串口设备 从站,Modbus 串行通信从站配置界面如图 12.x 所示。
Turck CoDeSys 3软件与程序可编程控制器应用指南说明书
Your Global Automation Partner Application Guide2 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | Create a control system without a panelThe CoDeSys 3 (IEC 61131-3) software provides a powerful control environment supporting multiple common programming languages including ladder, structured text, function block diagram, and sequential function chart. This software can be downloaded for free at .A small button podium may be used to house items that must be enclosed in the panel.Turck programmable controllers provide up to IP68/IP69k protection, ideal for complete control of a system without the need for an enclosed control cabinet. These devices can function as a network master for remote I/O, additionally the flexible BL67 modular system allows for a variety of local I/O modules.3These devices can function as a network master or remoteI/O over multiple industrial fieldbus protocols including:*Indicates length in meters.BL67-PG-EN-V3TBEN-Lx-PLC-01■-40...+70 °C operating temperature ■IP67 Protection■Up to 32 local I/O modules(Discrete, analog, IO-Link, RFID, serial, etc.)■-40...+70 °C operating temperature ■IP68/IP69K Protection ■Onboard serial andconfigurable discrete I/O4 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | Connect BL Ident RFID to any PLC5BL Ident Tags■Read/write times up to 2000 bytes/sec possiblewith FRAM Technology■Standard tags include 128 byteEEPROM and 2 kbyte FRAM tags■Available in high temperature packages, capable of up to 210 °C■Variety of tags available: bolts, ID-cards, adhesivelabels, autoclave, laundry, FDA approved■Data storage for 10 years at ambient temperatures■Flexible assembly lines: for custom build operations the required BOM could be stored into the tag and read out at each station ■Replace existing barcode system:barcode is reapplied due to paint or heat treatment where RFID can survivePLC6 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | Connect fieldbus techology products to analog input devicesBL remote is a feature available on some gateway products. This feature allows bridging of device level networks to Ethernet. In this example, BL67 is operating on EtherNet/IP and drops down to the BL compact station using BL remote.Rod Style Series: ■Rugged rod style housing toallow operation in high shock and vibration environments ■Hydraulic cylinder applications where rod can withstand up to 5000 PSI continuously■Various analog output options ■16-bit resolution■Stroke length up to 168 inchesQ-track™ Series:■■ ■ ■ ■ ■Level Probe Series: ■Ideal for continuous level monitoring ■Uses magnetostrictive technologyto monitor float location■Analog output■Programmable monitoring span ■Stroke length up to 288 inches ■FM approved7Analog Sensors:■Pressure, temperature, sensors and transmittersfor use in pneumatic and hydraulic applications■Programmable digital read out flow sensors ■Highly reliable and precise temperature sensors ■Ultrasonic sensors■Linear analog sensors with wide range ofhousing styles and output options8 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 |BL67 I/O System can include digital, analog, IO-Link and RFID.2Parker Valve ManifoldsParker supplies a BL67 valve adapter base to directly connect Isys ISO and Micro valve banks to the Turck BL67 modular I/O system. Standard TurckBL67-16DO-0,1A-P output modules insert into the adapter base to provide direct control of up to 32 valve solenoids.Contact a local Parker distributor to order BL67 valve adapter and Parker valve banks.1Connect BL67 to valve banks with molded cables and discrete outputs, IO-Link, or direct connection9Possible Valve Bank Combinations■Channel-relatedshort-circuit monitoring■Wire-break detection■Configurable current monitoring ■Connection of multiple valve banksfrom different manufacturers■Integration of valve banks with digital output modules with 4, 8 or 16 channelsStandard and custom cordset lengthsThe 16-channel specially developed for switching valve banks. It features:10 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | Hoist and hoist control systems for stage rigging systems move lights, sets and people using gear motors, brakes and winches.Amusement Machine groups product into case quantities and applies shrink film. Encoder tracks length of product ensuring the bar carrying film does not touch product.Packaging Encoder tracks rotations of a drum used to store cable.Cable ManagementVia SSIVia High Speed CounterConnect BL67 to rotary position sensorsAutomotive A shaft encoder is mounted to the drive rollers of a dynamometer to provide velocity feedback.11Features of QR24Rotary Position Sensors: ■Non-contact position measurement ■SSI communication interface ■Bus interface to CANopen ■Rugged IP68/IP69K rating■Highly resistant to noise interference ■Extremely fast (up to 12,000 RPM) andprecise (up to 29 bit resolution) ■Easy setup: IO-Linkparameterization via Pactware ■Available with analog andincremental outputsFeatures ofIncremental Encoders:■Optical technology■Solid and hollow shaft models ■Differential and single-endedmodes of operation■High noise immunity and precision ■Extremely fast (up to 12,000 RPM) ■Standard M12 and M23 connection12 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | BL 67 I/O System■Rugged IP 67 construction allowsfor mounting directly on a machine without the use of an enclosure ■Modular design allows for variousI/O connections: up to 32 electronic modules, 256 digital or 64 analog■Support current and voltage I/O, RTDs, thermocouples, CAN Valve interface, RS232, RS422/485 and serial synchronous interfaces■Support of PROFIBUS, DeviceNet,CANopen, EtherNet/IP , Modbus TCP/IP , and PROFINET fieldbus■System diagnostic and per point diagnostic ■Fast and easy connectorization using7/8-16 UN Minifast ®, M12 Eurofast ®, M8 Picofast ® or M23 Multifast ® ■Configuration using free I/O-Assistantsoftware or rotary switchesEncoders BL ident (RFID)Sensors Solenoids Motor StartersTCP/IP13Possible CombinationsColor VisionBar Code VisionMachine Vision■Gray scale pattern and colorspectrum analysis■Two convenient form factors: one-piece PresencePLUS P4or compact PresencePLUS Pro sensor with a separate DIN-mountable controller ■Rugged IP 68-rated models suitablefor washdown applications* Indicates length in meters.Features of PresencePLUS ® Systems:■All PresencePLUS vision sensorsinclude built-in serial, EtherNet/IP and Modbus TCP/IP drivers with 4 (P4) or 6 (PROII) programmable I/O. A PresencePLUS sensor, with the Turck BL67 delivers expanded I/O, DeviceNet, PROFIBUS or PROFINET connectivity ■General-purpose or dedicated-function vision sensors■Discrete I/O on-board ■Wide range of mountingbrackets, lighting and lenses remote TEACH functionality to adjust image without PC ■Simple and intuitive userinterface with three-step, point-and-click operation■Rugged IP67 construction allows for mounting directly on a machine without the use of an enclosure ■Modular design allows for various I/O connections: up to 32 electronic modules, 256 digital or 64 analog ■Support current and voltage I/O, RTDs, thermocouples, CAN Valve interface, RS232, RS422/485 and serial synchronous interfaces ■System diagnostic andper point diagnostic■Fast and easy connectorization using7/8-16 UN Minifast®, M12 Eurofast®,M8 Picofast® or M23 Multifast®■Configuration using free I/O-Assistantsoftware or rotary switches■Support a wide variety offieldbuses including:»EtherNet/IP™»Modbus TCP/IP»PROFINET»DeviceNet™»PROFIBUS®-DP»CANopenBL67 I/O SystemInput/Output DevicesEncoders BL ident (RFID)Sensors SolenoidsConnect BL67 to wireless networkswith DX80 wireless gatewaysTCP/IP214 Turck Inc.|3000 Campus Drive, Minneapolis, MN 55441|T +1 763 553-7300|F +1 763 509-7709|15Possible Wireless Combinations* Indicates length in meters.Factory AutomationAgriculture and WaterTraffic ManagementCommercial andConsumer Monitoring16 Turck Inc. | 3000 Campus Drive, Minneapolis, MN 55441 | T +1 763 553-7300 | F +1 763 509-7709 | Stand alone I/O solutions powered by ARGEEWhen the door is closed the input sensor is on.No ARGEE actions take place in this condition.When the freezer door is open for more than 10seconds a warning light is turned on.With the freezer door open for more than 20seconds an audible alarm is turned on as well.When the door is closed at any time, the light and alarm are turned off and the timers are reset to zero.Door ClosedDoor OpenedDoor Opened for 20 Secs or MoreProgramming with an FLC (field logic controller) powered by ARGEE for a stand alone application could not be simpler. In the ARGEE Flow editor, a ladder like diagram editor, users use a drop down menu to select inputs, operations and outputs. When the program is running, the FLC carries out the program logic. Take the following stand alone freezer door application for example:17• This step in the program will monitor the door.• When the door is closed, our input value is on.• With this condition , we utilize the Boolean NOT operation to prevent Timer 1 and Timer 2 from starting.•With this logic, when the door opens, the action of starting Timer 1 and Timer 2 will begin.•When Timer 1 is expired, turn on Output 3 and illuminate our warning light.•When Timer 2 is expired, turn on Output 7 and sound our audible alarm.Slot 2. Input_value_0Time 1 ExpiredTime 2 ExpiredNOT Pass ThroughPass Through Pass Through Pass ThroughPass ThroughTON Timer 1No ActionSlot 2. Output_value_7TON Timer 2Slot 2. Output_value_3No ActionNo Action28 subsidiaries and over 60 representations worldwide!B3106 B 03/16©2016 by Turck Inc. All rights reserved. No part of the publication may be reproduced without written permission.Printed in USA。
CoDeSys V3 基础编程入门
马立新
康存锋
德国 3S 软件有限公司(3S-Smart Software Solutions GmbH)版权所有
目
录
1.概述和基本概念 ....................................................................................................................3 1. 编程对象 ( POUs ) .........................................................................................................3 2. 资源对象 (设备树) ..........................................................................................................3 2.创建并运行一个工程 ...........................................................................................................4 启动 CoDeSys 并创建一个工程 ...........................................................................................4 (1) 启动 CoDeSys ........................................................................................................4 (2) 创建工程 ....................................................................................................................4 编写 PLC 程序.........................................................................................................................6 (1) 在 PLC_PRG 中声明变量 .......................................................................................6 (2) 在 PLC_PRG 的实现部分输入程序代码 ...............................................................7 (3) 创建编程 POU ( 用 ST 语言编写功能块 FB1) .....................................................8 为在 PLC 上运行和控制程序,定义资源对象 .....................................................................9 (1) 启动 Gateway Server 和 PLC.................................................................................9 (2) 激活“应用” ............................................................................................................9 (3) 设置通讯参数 ..........................................................................................................10 在 PLC 中运行并查看应用...................................................................................................12 (1) 编译并将应用程序下载到 PLC .............................................................................12 (2) 启动和监控应用程序 ..............................................................................................13 在 PLC 上启动应用程序:...................................................................................................13 监控应用程序.........................................................................................................................13 (1) 打开程序的示例窗口 ..............................................................................................13 (2)写入和强制变量 (3)使用监控视窗 调试程序.................................................................................................................................15 (1) 设置断点并单步执行程序 ......................................................................................15 3.CoDeSys V3 – 快速入门 ...............................................................................................17 使用 CoDeSys V3 来编写一个控制车库门的程序 ...........................................................17 CoDeSys V3 – 快速学习 1/6 .............................................................................................17 CoDeSys V3 – 快速学习 2/6.............................................................................................18 CoDeSys V3 – 快速学习 3/6 .............................................................................................21 CoDeSys V3 – 快速学习 4/6 .............................................................................................22 CoDeSys V3 – 快速学习 5/6 .............................................................................................26 CoDeSys V3 – 快速学习 6/6 .............................................................................................28 下载基于 CoDeSys V3 的整个工程的应用程序 ...............................................................32
【安全研究】CODESYSV3漏洞复现之环境配置
【安全研究】CODESYSV3漏洞复现之环境配置01.概述CODESYS是可编程逻辑控制PLC的完整开发环境(CODESYS是Controlled DevelopmentSystem的缩写),在PLC程序员编程时,CODESYS为强大的IEC语言提供了一个简单的方法,系统的编辑器和调试器的功能是建立在高级编程语言的基础上。
CODESYS支持IEC61131-3标准IL、ST、 FBD 、LD、 CFC、 SFC 六种PLC编程语言,用户可以在同一项目中选择不同的语言编辑子程序,功能模块等。
CODESYS的应用领域涉及工厂自动化、汽车自动化、嵌入式自动化、过程自动化和楼宇自动化等。
02.环境配置安装完成后,双击“CODESYS V3.5 SP15Patch 3”启动运行:新建一个“test”的标准工程:到系统服务中列表中,找到如下图所示的服务并手动启动:点击界面左边列表中的Device,在Device标签中配置网关(将鼠标点击至右边计算机名册框中,回车,系统将自动扫描并激活节点):右击界面左边列表中的Application,“添加对象”->“视图管理器”进行视图管理器添加(由于需要访问WebVisu服务,因此需要开启视图,并使用视图管理器对视图进行配置):可对各参数进行配置:继续“添加对象”->“视图”进行视图添加:在视图标签中,可在“可视化工具箱”中选择各种图标、组件,并进行参数配置(此处即为组态画图的过程了),此处随便一个即可:画图完成后,在主菜单栏中选择“编译”->“重新编译”对所有的代码进行编译,确保无报错即可。
接着点击“Application[Device:PLC逻辑图]”右边的按钮“登录到”(或Alt+F8)快捷键:将代码下载到Device中:点击“启动”(或快捷键F5)启动设备运行:运行成功后可以看到组态的界面了:Cmd下执行netstat查看TCP Port 8080端口已经成功开启(8080端口为漏洞利用对应的业务端口):在物理机中远程访问WebVisu服务:03.漏洞复现由于本环境配置使用的是CODESYS V3 x64版本,因此将无法进行漏洞复现。
CODESYSV3基础编程使用指南
CODESYSV3基础编程使用指南将响应报文中的寄存器数据分成每个寄存器有两字节,在每个字节中直接地调整二进制内容。
对于每个寄存器,第一个字节包括高位字节,并且第二个字节包括低位字节。
【例12.x】将寄存器108的内容表示为十进制数555。
寄存器109和110中的内容分别为十进制0 和100。
当要读取保持寄存器108-110中的内容时,Modbus发送的请求报文和响应报文如下所示。
请求报文如下:响应报文如下:12.4.5电缆和接头在Modbus的通信协议中,对通讯线缆及接头定义有了明确的定义。
1.Modbus 串口通讯线缆Modbus串口通信线缆必须使用屏蔽线,并且至少有一端必须要连接到地线,如果在两端使用了连接器,那连接器必须与通信线缆的屏蔽层相通。
在实际应用中,为了减少接线的错误,基于RS-485的Modbus 通信对通信线缆颜色有所推荐,建议广大读者可以参考表12-x的规范接线。
表12-X 基于RS-485的Modbus通信推荐线缆当使用RS-485AWG24的标准。
如果使用5类线用于RS-485 Modbus通信时,最大的距离为600米。
2.Modbus 串口通讯接头1)2线-Modbus接口定义如果使用RJ45(mini-Din或者D型)作为Modbus的连接头,外壳选择带有屏蔽功能。
以保证通讯的抗干扰性能。
2线 Modbus连接器的输出引脚如图12.x所示。
图12.x 中使用的RJ-45连接器D型9针口的示意图如图12.x所示。
图12.x D型9针口若一台标准的MODBUS设备使用RJ45或9引脚D 型连接器,对每种实际电路必须注意下述输出引脚。
表12-X RJ45与D型9针口连接器输出引脚2)4线Modbus连接器的输出引脚如图12.x所示,该图中使用的是RJ-45的通讯,在实际的应用中,施耐德常采用此通讯接口。
图12.x 4线-Modbus中使用的RJ-45连接器D型9针口的示意图如图12.x所示。
CODESYSV3未经身份验证的远程堆溢出漏洞分析与复现
CODESYSV3未经身份验证的远程堆溢出漏洞分析与复现1 概述2020年3月25日CODESYS发布CODESYS V3未经身份验证的远程堆溢出漏洞,攻击者利用精心设计的请求可能会导致基于堆的缓冲区溢出。
CODESYS软件工具包是一款基于先进的.NET架构和IEC 61131-3国际编程标准的面向工业4.0及物联网应用的软件开发平台。
CODESYS软件平台可实现逻辑控制(PLC)、运动控制(Motion Control)及CNC控制、人机界面(HMI)、基于Web Service的网络可视化编程和远程监控、冗余控制(Redundancy)和安全控制(Safety)、项目开发与工程协同管理等多个目标和需求。
安天针对CODESYS的CVE-2020-10245[1]漏洞进行了分析和复现,该漏洞存在于CmpWebServerHandlerV3.dll(文件版本3.5.15.20)库中,源于该dll库未能正确验证由用户提交的发往Web Server URL端点的数据。
此漏洞会造成Web 服务器崩溃、拒绝服务或者可能被用于远程代码执行。
对此,安天研究人员分析了该漏洞原理并给出相应的防护建议。
2 漏洞情况该漏洞允许未经身份验证的远程攻击者破坏服务器或远程代码执行。
存在漏洞的服务器用于在Web浏览器中显示CODESYS系统可视化屏幕。
该漏洞基于堆的缓冲区溢出,是由于名为CmpWebServerHandlerV3.dll的Web服务器库无法正确验证发送到Web服务器URL端点的用户数据而导致。
攻击者可以通过发送给CmpWebServerHandlerV3组件的WEB_CLIENT_OPENCONNECTION消息请求非常大的内存分配,来利用这个漏洞,最终导致Web服务器崩溃、拒绝服务或远程执行代码[2]。
该漏洞严重程度评分如下表所示:表格 2-1 CVSS评分[3]2.1披露时间2019年12月02日:发现漏洞2019年12月11日:CODESYS承认漏洞。
CODESYSV3基础编程指南4.pdf
图9.X 路径3D配置在主程序中,声明了VISUStruct3Dcontrol及调用了PathGenerator的功能块,该功能块的作用是用于产生3D路径及跟踪轨迹,该轨迹可以存放2200个点。
这两个变量都与该工具的属性有相应关系。
(2)程序编写FUNCTION_BLOCK VisuStruct3DTrackVAR_INPUTpData: POINTER TO ARRAY[0..0] OF VisuStruct3DPathPoint;udiNumberOfPointsInArray: UDINT;udiFirstPoint: UDINT;udiNumberOfPointsToDraw: UDINT;pProjection: POINTER TO Projection;END_VARpData 指向一个VisuStruct3DPathPoint 元素数组。
这个数字必须至少含有udiNumberOfPointsInArray 个元素。
数组必须包含在应用中并且数据指针必须通过应用进行设置。
一个点的说明TYPE VisuStruct3DPathPoint :STRUCTv: Vector3;udiSourceElementID: UDINT;dwAddInfo: DWORD;END_STRUCTEND_TYPE(3)变量映射如图9.x所示,在属性中的“变量”中可以设置拨码开关的映射变量。
图9.X 变量映射程序最终的运行效果如图9.x所示。
图9.X 路径3D示意图示例程序可以在Sample\第九章\ActiveX\下进行查看。
9.3.6报警管理报警管理工具主要包括报警表格和报警条。
报警管理工具视图如图9.x所示。
图9.X 报警管理工具视图1.报警表格用户可以自定义可视化报警,但必须在CoDesys报警配置中预先进行定义。
在可视化编辑器中,用户可以通过在工具箱中添加“”,将其拖拽至画面编辑区域;故需要完成报警显示需要有两部分的设置,第一,需要在“Application”中设置报警配置,第二,需要在可视化编辑器中进行设置。
CODESYSControlRTEV3_Manual
CODESYS Control RTE V3ManualVersion: 9.0Template: templ_tecdoc_en_V1.0.docxFilename: CODESYSControlRTEV3_Manual.docxT e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xCONTENTPage1 Overview4 What is a real time extension? 4 1.11.1 The System in Details5 2 Installation6 2.1 Important steps of the Setup 6 3The user interface9 3.1 Remote PLC 9 3.2 PLC Configuration 10 3.2.1 The tab Startup10 3.2.2 The tab Component Manager 11 3.2.3 The tab Application 11 3.2.4 The tab Logger 12 3.2.5 The tab Scheduler 12 3.2.6 The tab File 12 3.2.7 The tab Target 12 4 Available dynamic components 13 4.1 The hardware platform adaption 13 4.2 CmpSJACanDrv 13 4.3 CmpEt100Drv 13 4.4 CmpEt1000Drv 14 4.5 CmpRTL81x9Mpd 14 4.6 CmpRTL8169Mpd 14 4.7 CmpSercos3Master 14 4.8 CmpHilscherCIFX 14 4.9 CmpNetXCanDlDrv 15 4.10 CmpCX5000Mpd 15 4.11 CmpPciRetain 15 4.12 CmpCXSecUPS 16 5Appendix17 5.1 Appendix A: The registry entries used by the RTE 17 5.2 Appendix B: Real time behavior on special platforms 18 5.2.1 Check BIOS for suspicious settings 19 5.2.2 Check the settings in Windows 19 5.3 Appendix C: Methods to simply check the real time behavior 20 5.4 Appendix D: Examples for BIOS configurations 20 5.4.1 CELERON Device 20 5.4.1.1 ACPI Configuration 20 5.4.1.2 CPU Settings 21 5.4.1.3 Chipset Settings 21 5.4.1.4 Clock Configuration22T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x5.4.1.5 USB Configuration 22 5.4.2 INTEL ATOM Device 23 5.4.2.1 ACPI Configuration 23 5.4.2.2 CPU Settings 24 5.4.2.3 Chipset Settings 24 5.4.2.4 Clock Configuration 25 5.4.2.5 USB Configuration25 5.4.3 INTEL DUAL CORE Device 26 5.4.3.1 ACPI Configuration 26 5.4.3.2 CPU Settings 27 5.4.3.3 Chipset Settings 27 5.4.3.4 USB Configuration28 5.4.4 More common hints on hardware configuration 28 5.5 Appendix E: Startup of a PROFIBUS Master by Hilscher CIFX 50-DP(M/S)29 5.5.1 Installation of a Windows driver29 5.5.2 Copy NetX firmware and NetX boot loader 29 5.5.3 Configure the RTE in “CODESYSControl.cfg” 29 5.5.4 Start runtime30 5.5.5 Create CODESYS project with IO configuration 31 5.5.6 FAQ34 5.5.6.1 If the fieldbus master is not green, how can I find the problem? 34 5.5.6.2 There are unresolved references34 5.5.6.3 I’ve activated the Trace, but I do not see a new entry of theCmpHilscherCIFX component 34 Bibliography 35 Change History36T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x1 OverviewCODESYS Control RTE is a softPLC system, a PLC in software, on Windows, which is programmable withCODESYS V3. Therefore a powerful PLC within the operating system based on a CODESYS runtime system is available. Warning: For security reasons, controllers must not be accessible from the Internet under any circumstances. Specifically, the TCP/IP programming port of the controller (usually 1200 and 1210/1211, or the controller specific ports) must not be accessible. The port numbers by default given by the system (however changeable perconfiguration!) are (here only the most important ones for the RTE): ▪ 1740..1743 UDP-Blocktreiber in Gateway und Laufzeitsystem. ▪ 11740..11743 TCP-Blocktreiber in Gateway und Laufzeitsystem. ▪ 1217 Gateway, zur Verbindung von CODESYS zum Gateway. ▪8080 Web-ServerIn case Internet access is needed, a safe mechanism has to be used for connecting to thecontroller (e.g. VPN).Within this document we assume the reader is familiar with the principles of a PLC and CODESYS. Only the specialities of the runtime system for the realtime extension on a Windows PC will be described.What is a real time extension?1.1A real time system is defined to be deterministic with respect to its time response. This means, for example, if a routine is configured to be called within a certain time, this will happen within a deterministic interval. Otherwise the system fails. For a CODESYS PLC, this means if a task is configured to be a cyclic task, this cycle time has to be kept under any circumstances within constant tolerances.Experience shows, this seems to be impossible using an operating system based on “pure” Windows NT. But the hardware of a PC is normally good enough to meet the demands of real time for most industrial applications. The real time extension for Windows is a Windows kernel mode driver that installs an interrupt service routine for a periodic interrupt, generated on demand by the PC hardware. This routine now is able to call the tasks, defined by a CODESYS application, within small intervals.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x1.1 The System in Detailskernel of the real time extension CODESYS Control RTE of 3S-Smart Software Solutions GmbH consists of a user mode system service and a kernel mode driver. The standard hardware of the PC is used to generate two interrupts within every millisecond and call the task scheduler. The first interrupt is used for calling tasks of its own and the second interrupt is used for calling the operating system. These tasks are interrupted once per millisecond form the operating system with a configurable time scheduling.The dynamic components are inserted into a list in the configuration file of the runtime. These components provide the component interface to become a part of the CODESYS runtime. After being loaded by Windows, they can directly exchange data and calls with the runtime system. It is not necessary to change the Windows kernel.The RTE consists of runtime components that are loaded together with the RTE and some that are loaded “on demand”. What dynamic components are available and what functionality they cover is described later in this document. Note:The common properties of a 3S runtime system (means a 3S PLC) are described in the document …Runtime System Overview“ of 3S-Smart Software Solutions GmbH. There all variations andpeculiarities of a runtime system are explained. So this technically detailed document is designed for development work.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x2 InstallationThe installation of CODESYS Control (respectively Softmotion depending on the type of the runtime system) RTE V3 - in the following just referred to as "RTE" - is done by the Setup. Depending on the type of delivery, the setup is available as a single exe-file or in an archive file or on a CD/DVD. The Setup installs all available drivers provided with the delivery.The Setup detects the type of platform on which the system gets installed, mainly it detects whether it is an (old, hardly any more used) AT-compatible platform, or a system basing on the newer APIC standard. Depending on the platform, another component gets inserted in the file CodesysControl.cfg.As from version V3.5.3.0 it is also possible to run the RTE on an own (reserved and then not any longer usable by Windows) physical CPU core. In this case the Setup inserts the "AMP"-platform adaption:Component.1=CmpDrvSchedulerAMP(AMP means "asymmectric multiprocessor system") Note:As from V3.5.4.0 the following is true: After an installation for AMP the RTE can get switched to APIC mode without the need of a re-installation. For this purpose you just have to replace entry Component.1=CmpDrvSchedulerAMP by Component.1=CmpDrvSchedulerAPIC in the fileCODESYSControl.cfg (configuration file oft he RTC). Additionally the boot entry …numproc=“ (see chap.2.1) should be deleted in order to get Windows rebooting with all kernels. (This is not necessary for test purposes.)2.1 Important steps of the SetupAfter you have started the setup and run through some standard steps, this dialog will appear on systems with multiple CPU kernels or on systems, where it is not clear whether there is only one or several CP kernels. At this time you must know whether the system indeed has multiple CPU kernels and whether you want to use one of them exclusively for the RTE. This kernel then will not any longer be available for Windows and thus the performance of Windows will be reduced. However, of course at the same time the performance and temporal precision of the RTE will be increased.If you choose the option "No, run RTE on Windows CPU core", the RTE will be installed in a way, that - like before in all versions of the RTE - the tasks of the RTE will be executed together with those of Windows on the first kernel and will share that kernel with the operating system in fix time slices.If you choose the option "Yes, run RTE on a non-Windows CPU core", the RTE will be installed in a way, that the RTE tasks will run on an own CPU core which is reserved for this purpose only. In this case subsequentlythe following dialog will appear:T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xHere you must regard the following:▪The number (in the example shown above: "2") is only a proposal of the setup. It is not always possible to detect the exact number of physical CPU kernels available in your system. So now you should know that number. Regard also that a CPU kernel, reported by Windows, could be a "logical" CPU kernel, not suitable for running a realtime system. (These CPU kernels i.a. are known as "hyperthreading kernels".)▪The dialog makes you aware that you should deactivate any features like hyperthreading by all means via the system configuration, because experience has shown, that they have bad influcence on the realtime behaviour.Later on the Setup will try to reserve a CPU kernel for the RTE by modifying the start configuration of the system. In the subsequent dialog this modification will be indicated, however not yet done.Only after the next dialog, where you get asked whether the boot configuration should be changed by the Setup, actually the modification of the system start configuration will be done. The modifications are (see also the text in the previous setup dialog):▪ Limitation of the number of CPU kernels available for Windows, via the boot option "numproc",to <number of physical kernels> - 1.▪ Deactivation of the processor feature "Data Execution Prevention".▪Switching off the processor feature "physical address extension (PAE)".Note: The processor features "Data Execution Prevention" and "PAE" not necessarily must be switched off. Just as well you can limit just the number of kernels for Windows by a manually defined start configuration. However 3S-Smart Software Solutions GmbH does not test such configurations!T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xAs from V3.5.4.20 there is only one setup for CODESYS Control RTE and CODESYS SoftMotion RTE. You can choose between the two options. The configuration file CODESYSControl.cfg will be adapted accordingly. If there is already a configuration file from an earlier installation, you also can choose this file. In this case a backup of the configuration file will be created during the running setup. Otherwise the already existing file gets stored.Switching to SoftMotion also can be done later, manually. For this purpose the following entries must be added to the coniguation file CODESYSControl.cfg:[SysTarget]TargetType=0x1006DeviceName=CODESYS SoftMotion RTE V3By removing these entries (or by preceding a semicolon) you can get back to the CODESYS Control RTE variant.Unused cfg-files will be kept in the installation folder under different names.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x3 The user interfaceAccess to the user interface of the CODESYS Control RTE is obtained via an icon in the systray. The tray icon offers the possibility to edit some of the settings in the configuration file. With a click on the icon of the RTEa menu is displayed. It consists of the entries- Start PLC - Stop PLC - Exit PLC Control - PLC Configuration - Remote PLC -About…With Start PLC resp. Stop PLC the PLC is loaded respectively unloaded. This is equivalent to turning on/off power on a “real” PLC.With Exit PLC Control just the tray icon disappears, the PLC keeps on running. The About … dialog shows the icon and the version of the RTE. 3.1Remote PLCWith the menu item Remote PLC a dialog appears to determine whether the local RTE or a remote one shall be configured. The entire configuration done will then affect the locally installed RTE or the one running on the system with the IP-address Target PC address .T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x3.2 PLC ConfigurationWith PLC Configuration the configuration dialog of the RTE is shown, which allows to view some states and edit some common configuration settings.The dialog appears with the tab Diagnostic . Some states and IDs of the RTE are displayed here. 3.2.1The tab StartupIn the tab Startup three options are available:▪Start the RTE basic system service when booting :Enabling this option leads to an automatic start of the system service (…3S RTE Service V3“) of the RTE, no matter if a Windows user is logged on or not. ▪Start the PLC with the basic system service :With this option the RTE is loaded (means, the PLC is started) together with the system service. Together with the option above, this leads to a PLC start at boot time of the PC. ▪Do not load boot applications:This option prevents loading the boot application automatically. This is sometimes required fortest purposes.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x3.2.2 The tab Component ManagerThis is made for adding dynamic components. Some of the available dynamic components are available in the drop down lists, some have to be entered manually to the lists by typing the name into the edit control. 3.2.3The tab ApplicationSome settings for the application component can be edited here.The options Create on Download and Store only on Download specify if the boot project is created implicitly on download. The additional option Store only on Download leads to not loading the project into memory. With this option enabled, the boot project is stored in the file system only and loaded when the PLC is started the next time.The options for the handling of corrupt retain data specify how the PLC shall behave in these cases. With Do not load , the boot project is not loaded. With option Load with Exception the boot project will be loaded but not started. With the option Load and Initialize Retains the boot project will run with all retain data being reset to their initialization values.To make sure the boot project is loaded only in case the PLC terminated correctly the last time, the possibility exists to invalidate the boot project after it has been loaded. The option Never prevents this. The option BySetting leads to an entry in the configuration file that invalidates the boot project. With the option By Rename theapp-file will be renamed.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xThe options under Retain Type specify how the RTE stores the retain data. None will disable the use of retain data. SRAM should not be set by the user directly. As this is hardware dependent, refer the hardware’s manual or let an appropriate vendor specific component do this implicitly. The default retain handling of the RTE is On Powerfail .. In this case the retain data will be saved to a file if the controller is shutdown. To enable this, the system must be equipped with a UPS. Then potential power failures are taken into account, too. 3.2.4The tab LoggerLogging of log entries to a file is configured here.Using the default values 5 Files , 50000 Max File Size , 1000 Max Entries , for example, 5 files with a maximum size of 50000 Bytes or 1000 entries are created. The eldest file will then be overwritten. With a number of 0 file, everything is logged to files, no files are overwritten. 3.2.5The tab SchedulerThe task scheduler within the PLC can also be configured. These entries are necessary in special cases only. You can provide settings here, for example, to prevent some task being no longer scheduled in case other tasks with a higher priority consume all the CPU time. You can also determine how the system should behave in case of such problems.Max CPU Load by RTE : Default value is 50. If you change this value then the entry MaxPLCTime in the registry data base is set with the value entered here. This change will result in an adjustment in the CPU timingaccording to the value. This may be necessary if the RTE task is interrupted too often by Windows system tasks or vice versa. 3.2.6The tab FileThe file system of the PLC offers the feature to store files with a configurable extension to dedicated directories automatically. 3.2.7The tab TargetBy default, the RTE appears with the name of the computer in the PLC scan. The name can be configured hereto a fixed name.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c x4 Available dynamic componentsOptional drivers like PCI card drivers for field busses are available as IEC libraries or runtime components, where in case of the RTE these drivers are sys-files. If a driver is a component, it has to be entered to the configuration file, to make the runtime loading it. One can enter this by using the configuration dialog or a text editor.The configuration file of the RTE is to be found at “C:\Program Files\3S CODESYS\CODESYS Control RTE3\CODESYSControl.cfg“ in case of standard installation.Alternatively, you can also use the Tab Component Manager to tell the runtime system, which components to load at startup in addition to the RTE. 4.1The hardware platform adaptionThere are mainly two PC platforms available nowadays. The AT compatible, rarely used today and the newer one, the APIC platform. Both platforms are supported by the RTE. The necessary adaption to the platform is contained in the drivers CmpDrvSchedulerAT and –APIC. The setup detects the platform and the driver isentered as “Component.1” into the configuration file by the setup always. This component must not be changed ever.These drivers store under their name in the registry path of the system services(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services) in the key Param their measurementsconcerning the hardware speed at the first start. On any following system starts, these measurements are used. (In case the values are missing, a new measurement is initiated.) 4.2CmpSJACanDrvThis driver is a generic driver for SJA1000 based passive CAN cards or on board hardware. The PCI cards by Peak, Ixxat and Automata are supported instantly. When installing such a CAN PCI card, one can use the appropriate driver from W2K_XP_Drivers, a subdirectory in the RTE installation path.The installation of a driver can be done through the device manager or the wizard “New hardware found”. In the Windows device manager you can use “Update driver” from the context menu, which creates the same wizzard like …New hardware found“. By choosing the driver manually from one of the above dircetories, the correct driver can be installed.The device will then show up in the category …3S compatible devices“. Do not install the original driver of the card manufacturer.The CmpSJACanDrv can also use on board SJA1000. The properties of such hardware have to be configured in the cfg-file, in the CmpSJACanDrv section. Possible entries are:NumDevices=1 <number of following controllers>(optional: <DisableRetain=1> You can tell the driver, not to use possibly available NVRAM as retain memory.)0.Address=<physical address of the SJA1000> 0.MapAddress=1 <always 1 on a PC>0.Interrupt=<Interrupt Vector of the SJA1000 > 0.IntEdgeTrig=<0 or 1. 0 hardware dependent>0.XtalFrequency=<normally 16000000Hz, 24000000Hz is also possible, depends on the hardware.>0.BusType=<type of connection of the SJA to the CPU, 1 for ISA, 3 for PCI, 0 for memory>0.Alignment=<normally 1, hardwaredependent> =<any name>0.OutputCtrl=<valid values are for example 0xFE, 4C, 1A and others. Hardwaredependent.>0.PortAddress=<A portaddress the driver will once on startup write to.> 0.PortValue=<The value to write once on startup.>4.3 CmpEt100DrvThis driver supports Pro100-compatible Intel Ethernet controllers. To use this component, the Windows network driver for this Ethernet controller has to be superseded by the one shipped with the RTE. To manage this, do the following:▪ Open the Windows device manager.▪Choose Update driver from the context menu of the appropriate network card.T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xUse Manual Driver Choice and choose the one in <RTE-Installationdirectory>\CmpET100MPD .In case the device manager refuses to install the driver, first uninstall the Intel driver and then delete theassociated inf file from <SystemRoot>\inf. (SystemRoot is often c:\Windows) (The associated inf files refer to Pro100 and are normally called net557*.inf/pnf or net559*.inf/pnf. The pnf file is called like the inf file and has to be deleted also.) After the following reboot of the system, Windows is no longer able to automatically install the driver and the hardware wizard will appear. Now the driver from <RTE-Installationdirectory>\CmpET100MPD will be accepted. 4.4CmpEt1000DrvThe installation of this driver is performed analogue to 4.3, but support Pro1000 compatible Ethernet chipsets by Intel. 4.5CmpRTL81x9MpdThis driver supports the Realtek RTL8139 (and compatible) Ethernet controller. The combi-chipsets 8100 and 8110 are included also.The installation of this driver is performed analogue 4.3 also. 4.6CmpRTL8169MpdLike 4.5, for the Gigabit capable Realtek controller RTL8169 and compatible chipsets, like 8111. 4.7CmpSercos3MasterThis driver supports the SERCOS III PCI card 700353x0 of Automata. After installing the hardware, used the driver from W2K_XP_Drivers\Automata_SERCOS3 directory in the hardware wizard. 4.8CmpHilscherCIFXThis component supports the CIFX-cards, manufactured by Hilscher.After the hardware installation use the driver shipped with the card or the SysDrv3S, which comes with the setup of the 3S soft PLC “CODESYS Control V3”, the soft-PLC without real time extension by 3S-SmartSoftware Solutions GmbH. The component has to be entered to the configuration file and additionally needs a section [CmpHilscherCIFX]. The driver needs the entriesDevice.0.BootloaderFilePath=NXCIF50-RTE.bin Device.0.Channel.0.FirmwareFile=cifxdpm.nxfHere in the example, 0 is the zero based index of the card, in case more than one is used. Channel.0 has to be used always for CIFX PCI (or PCIexpress) cards.The files referenced here normally are shipped with the card and have to be placed in the root file path of the RTE. The names of the files (or the entries in the configuration file) have to be adjusted. See chapter 0 “T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xAppendix E: Startup of a PROFIBUS Master by Hilscher CIFX 50-DP(M/S)”. 4.9CmpNetXCanDlDrvThis component is a CAN mini driver, to support the Net-X (or CIFX) CAN cards natively. With this driver, the can interface of the CIFX CAN cards can be used with the 3S CanOpen libraries.This component can only be used together with the CmpHilscherCIFX component, which is required to perform the firmware download to the card. A CAN firmware (master or slave) is required to make this component work. Then the CAN card is used as a native CAN interface, the protocol is completely managed in the libraries. The component is configured with the following entries.[CmpNetXCanDlDrv]MaxNumberOfCanNetworks=0..n -> number of CAN networks (number of NetIds)NetId.0.Channel=0 -> mapping of the NetId to board and channel of the NetX -> see CmpHilscherCIFX NetId.0.Board=04.10 CmpCX5000MpdThis driver is a Windows network driver. It can only be used on a Beckhoff PC of type CXxxx,, on which a CX5000 communication processor is available.When the RTE setup gets executed on a CXxxxx, this driver will be installed automatically and get entered in the list of components (in the cfg-file of the RTE).Additional informationen and manual installation:On a CX-IPC – basing on the default delivery state, that is with …Windows7 embedded standard“ installed – the Beckhoff driver for the PCI device with the hardward IDs:- VendorID = SubVendorID = 0x15ec -DeviceID = SubDeviceID = 0x5000can be replaced by CmpCX5000Mpd.sys. With the feature …Update driver“ of the Windows system controller this is possible in a simple way (after having installed the RTE):-Open the Device Manager von Windows, search the system device of Beckhoff and with the right mouse key select Update driver .- In the dialogs select option manually chose device driver and click on have disk . - Then in the RTE installation folder, in subfolder CmpCX5000Mpd,.select the inf-file.-Respond to any prompts whether you want to install the driver. Then Windows will install a network adapter named …CX5000 driver for CODESYS Ethernet“.In the configuration file oft he RTE (installation folder, file …CodesysControl.cfg“) the driver must be entered manually:e.g. Component.3=CmpCX5000MpdAfterwards a download of a CODESYS project with EtherCAT should no longer show any unresolved references.Attention: After installation of this driver it is no longer possible to use EtherCAT over the front networkconnection of the CXxxxxx. Reason: For this purpose anonther SysEthernet driver would have to be used, which however would result in a mixed operation of network drivers. This however is not possible until having fixed CDS-37463.The internal (extending) connection pin must be used. With a EK1110 also EtherCAT slaves (bus coupler) can be coupled to this internal connection. 4.11 CmpPciRetainThis driver supports the usage of NVRAM on a PCI device as retain memory. It is required that the NVRAM is directly accessible through a base address and that it supports 8-, 16- and 32-bit-accesses. The component is configurable through the configuration file of the RTE. In the section [CmpPciRetain] the following entries are available:T e m p l a t e : t e m p l _t e c d o c _e n _V 1.0.d o c xVendorID DeviceID SubDeviceID SubVendorID AddressIndex MemorySize AddrOffsetTo identify the PCI-device, the entries VendorID, DeviceID, SubDeviceID and SubVendorID are used.AddressIndex identifies the PCI address register that contains the physical base address of the NVRAM (BAR0 – BAR5). The default value is 0.MemorySize tells the system on how many bytes NVRAM are available on the PCI-device. The default value is 0x80000, means 512kByte.All these values can be taken from the documentation of the PCI device. All default values are made to work with a Siemens NanoBOX-PC (MRAM). 4.12 CmpCXSecUPSThis component supports the 1S-UPS on an embedded PC oft he series CX5000 and CX5100 manufactured by the company Beckhoff.The component monitors the state of the power supply. This is done in a cyclic, low priority task.In case a powerloss is detected, the component stops all applications and saves the retain data. (Typically a file named Application.ret is created.)Attention: Due to the natur of the capacitive power buffer, there are restrictions:- According the CPU load the powerloss may be recognized with a delay.-According the over all hardware utilization the available time for saving data may vary.Due to these restrictions the powerfail-situation and the storing of the retaindata has to be tested together with the complete application. Further it is recommended to check if the retain variables are valid before executing the application.There are no configuration settings available for this component. To use it, it is enough to add it to the component’s list.。
油门V3安装手册说明书
INSTALLATION MANUAL FOR USING YOUR THROTTLE V3Version 1.6.402 33.A ug.20176w w w.c o k c p f it o r y o u .c moTo r s t e n Mül l e rInstallation manual for using your TQThank you for purchasing the motorized version V3 of our new COCKPITFORYOU 737throttle quadrant. It has been assembled and tested with the greatest care. To makethe installation as convenient as possible for you, we tried to describe the installationprocess in great detail. Should you still experience difficulties with the setup oroperation of your throttle quadrant, please do not hesitate to contact us via email orphone. In the near future we will release a video setup tutorial in addition to thismanual that will guide you through all the necessary steps.We hope you will have as much fun flying your new TQ as we had engineering andassembling it.1.Before getting started•download CFY_TQ.zip•download vJoy.rar2. Connecting your ThrottlewYour motorized butterfly comes with 1 Ethernet portand 1 female PC power supply.PC power supply (100-240V / 50-60Hz)Ethernet cable:Plug in the Ethernet cable into a free port of an Ethernet switch.Minimum requirement for switch is 100 Mbit.3. installation software1.Create new folder "CFY" on drive C:2.Extract CFY_TQ.zip to C: CFY3.In the folder C:\CFY double click the file "vJoy_216_150815". Installationmay take 5 minutes. Restart computer. If installation seems to be haltedafter approx 5 minutes you can restart computer.4.In the folder C:\CFY double click the file "setup"Change the installation folder in "C: CFY"Press “Next” and follow installation instructionsPress “Understood”The calibration is Carried out (at first start)The "TQ V3" is ready5.Start your flight simulatorThe "TQ V3" connects to your flight simulator 6.Start your AddOn SoftwareNone or “TQ V3” connects to proSim737 or SimAvionics or PM 7.Sign the Trim button on theYoke (Soon automatically)•Open FSUIPC, select“Buttons + Switches”•Press the Nose up trim switch on your yoke •Check the …Select for FS control“ box •Select “Offset Word Set” from the list•Set the first offset to x9093 and the parameter to 2The Control sent whenthe button is released:•Sele ct “Offset Word Set” from the list•Set the first offset to x9093 and the parameter to 0•Press “OK” to save these changes•Open FSUIPC, select “Buttons + Switches”•Check the “Select for FS control“ box•Select “Offset Word Set” f rom the list•Set the first offset to x9093 and the parameter to 1The Control sent when the button is released:•Select “Offset Word Set” from the list•Set the first offset to x9093 and the parameter to 0Press “OK” to save these changesAll automatically created joystick assignmntin FS deleteAdvanced settings:FS2004 without AddOn => no adjustments necessary / FSUIPC must be installedFS FSX without AddOn => no adjustments necessary / FSUIPC must be installedFS P3D without AddOn => no adjustments necessary / FSUIPC must be installedFS XPlane without AddOn => no adjustments necessary / XPUIPC must be installedPM => no adjustments necessary / FSUIPC must be installed IFly => see item 11 / FSUIPC must be installedSim-Avionics => see item 12 / FSUIPC or XPUIPC (XPlane) must be installed PMDG NGX => see item 13 / FSUIPC must be installedProSim737 => see item 14 / FSUIPC must be installed11.For IFlyIFly to FSUIPC installed.12. For Sim-AvionicsSim-Avionics Setup withCockpit For You ThrottleAn FSUIPC connection is require, so the CFY controller software should either be run on the FS computer, or run on a remote computer with WideClient running.Sim-Avionics Server Configuration1) FSUIPC_IO.INISet Multi Function OffsetMULTI_FUNCTION=53FERemove 5418 offset from PARKING_BRAKE=5418[FSUIPC_INPUTS]PARKING_BRAKE=ENGINE_L_FUEL_CONTROL_SWITCH=5452ENGINE_R_FUEL_CONTROL_SWITCH=5453Add Autothrottle output offsets[FSUIPC_OUTPUTS]COMMANDED_THROTTLE_L_POSITION=53E0COMMANDED_THROTTLE_R_POSITION=53E2THRUST_REF_MODE=53E42) Control Panel TabEnable FSUIPC Outputs ON3) Flight Controls 1 TabParking Brake External OFFFlaps External OFFGear External ONElevator Trim via FSUIPC OFFToe brakes release Parking Brake OFFEnable Simple Braking OFF4) Flight Controls 2 TabMain Throttles FDS Pro Throttle/Sys Controller Axis/SIOCReversers SIOC / Offsets 52DA and 52DCCFY FS FSUIPC oftwareConfigConfigurationuration1) FSUIPC > Axis AssignmentAdd "Parking Brake" to Brake AxisDetect Brake Axis“Control sent when range entered” = Parking BrakeUp OFFDn ONFrom = 95% of brake pedalTo = 100% of brake pedal2) FSUIPC > ButtonsTrim Up Offset Word Set x90931Repeat ONOffset Word Set x9093Trim Down Offset Word Set x90932Repeat ONOffset Word Set x9093 013. For PMDG_NGXCurrent FSUIPC4 version! As of today: 4,949 FSUIPC4 Current SimConnect version!Configuring the PMDG iniopen Windows Explorer• openComputer , DriveFSX,• open folder "PMDG"• open folder "PMDG 737 NGX"( w here F SX i s i nstaled ) ,•open" 737N GX_Options.ini"•Writing at the end of the text followingthis:[SDK]EnableDataBroadcast=1Please check carefullyThe text mustbe written exactlyIn small andcapital letters Be sureThe text must be written exactlyIn small and capital letters Ensure•Save and close the file14. For ProSim737Setting in ProSim737 Config / DriversGeneric COM port/TCP diver => Enabled“Sit back relax and enjoy your flight.“This is it. By now your 737 throttle quadrant should be up and running. In case you have any further questions or you are experiencing difficulties, please do not hesitate to contact us via email or phone.Torsten MüllerBerlin, Germany 2017。
CODESYSControlV3_FirstSteps
•
CODESYS Control RTE: o o o o Open the MS Visual Studio 6.0 (with higher versions an import of the workspace is required, some settings need to be adapted manually). Open the workspace CmpDriver from the \Platforms\3SRTE3\CmpDriver_Toolkit folder. Copy the file targetdefines.h from the \Platforms\3SRTE3\3SRTE3\Sys folder to \Templates\SysTargetOEM. Compile the project SysTargetOEM. Install the driver using the registry file from \Platforms\3SRTE3\CmpDriver_Toolkit\SysTarget_Overwrite\Registration on the target computer. Copy the .sys file to the \system32\drivers folder of the target computer. Add the SysTargetOEM component to the cfg file of the RTE (not the SysTargetOEM). Make sure the OverloadableFunctions=1 option is set in the ComponentManager section.
Getting the Binaries
CoDeSys
CoDeSysCoDeSys是全球最著名的PLC内核软件研发⼚家德国的3S(SMART,SOFTWARE,SOLUTIONS)公司出的⼀款与制造商⽆关的IEC 61131-1编程软件。
CoDeSys ⽀持完整版本的IEC61131标准的编程环境,⽀持标准的六种编程语⾔。
是⼀个标准的软件平台,被很多硬件⼚家⽀持,可编程超过150家OEM⽣产的⾃动装置。
CoDeSys提供了许多组合产品的扩充,诸如各种不同领域的总线配置程序、完全的⽬测化和运动控制系统。
CoDeSys是⼀种功能强⼤的PLC软件编程⼯具,它⽀持IEC61131-3标准IL 、ST、 FBD 、LD、 CFC、 SFC六种PLC编程语⾔,⽤户可以在同⼀项⽬中选择不同的语⾔编辑⼦程序,功能模块等。
CoDeSys是可编程逻辑控制PLC的完整开发环境(Controlled Developement System的缩写),在PLC程序员编程时,CoDeSys为强⼤的IEC语⾔提供了⼀个简单的⽅法,系统的编辑器和调试器的功能是建⽴在⾼级编程语⾔的基础上(如Visual C )。
现在国内PLC⽤户使⽤的版本多为CoDeSys V2.3,最新的版本是CoDeSys V3(⽬前最新版本为V3.5)。
V3 在软件架构上有了很⼤的改善,朝安全软件的⽅向发展,⽬前正在申请TUV关于EN 61508的SIL认证。
HOLLSYS(和利时G3 PLC),Kinco(深圳步科F1 PLC),ABB AC500系列,IFM,EPEC,Rexroth,Wago,Parker,Beckhoff,Festo,施耐德等PLC⼚家都是使⽤CoDeSys平台开发⾃⼰的编程软件的。
当然了,还有很多其他公司。
另外,CoDeSys也提供触摸屏功能(Visualization),但这不是他的强项,基本都是采⽤OPC ⼯控机的⽅案,ABB,倍福都有很好的⽅案,都是⾯向不差钱的客户。
3S竞争者CoDeSys的其他竞争对⼿还有KW、infoteam、ISAGRAF。
CODESYS V3 基础编程指南4.pdf
图9.X 路径3D配置在主程序中,声明了VISUStruct3Dcontrol及调用了PathGenerator的功能块,该功能块的作用是用于产生3D路径及跟踪轨迹,该轨迹可以存放2200个点。
这两个变量都与该工具的属性有相应关系。
(2)程序编写FUNCTION_BLOCK VisuStruct3DTrackVAR_INPUTpData: POINTER TO ARRAY[0..0] OF VisuStruct3DPathPoint;udiNumberOfPointsInArray: UDINT;udiFirstPoint: UDINT;udiNumberOfPointsToDraw: UDINT;pProjection: POINTER TO Projection;END_VARpData 指向一个VisuStruct3DPathPoint 元素数组。
这个数字必须至少含有udiNumberOfPointsInArray 个元素。
数组必须包含在应用中并且数据指针必须通过应用进行设置。
一个点的说明TYPE VisuStruct3DPathPoint :STRUCTv: Vector3;udiSourceElementID: UDINT;dwAddInfo: DWORD;END_STRUCTEND_TYPE(3)变量映射如图9.x所示,在属性中的“变量”中可以设置拨码开关的映射变量。
图9.X 变量映射程序最终的运行效果如图9.x所示。
图9.X 路径3D示意图示例程序可以在Sample\第九章\ActiveX\下进行查看。
9.3.6报警管理报警管理工具主要包括报警表格和报警条。
报警管理工具视图如图9.x所示。
图9.X 报警管理工具视图1.报警表格用户可以自定义可视化报警,但必须在CoDesys报警配置中预先进行定义。
在可视化编辑器中,用户可以通过在工具箱中添加“”,将其拖拽至画面编辑区域;故需要完成报警显示需要有两部分的设置,第一,需要在“Application”中设置报警配置,第二,需要在可视化编辑器中进行设置。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
OEM 3S 3S
4) 5)
OEM OEM
2.2
Ready-to-start embedded system
3S supports a number of evaluation board/toolchain combinations with basic runtime adaptations. Examples of such systems are Infineon TriCore with Infineon TriBoard TC1798, or ARM with TI TMS570 MCU Development Kit, or Renesas SH2A with Renesas Starterkit RSK-SH7216. For all these boards, specific toolchain versions are supported. A list of those combinations is available on request. 3S maintains and tests these systems with new releases of CODESYS. The runtime toolkit contains: Contents of Runtime Toolkit a) b) c) d) Sample device description file for that platform CODESYS Control runtime system headers and m4 files Tools to create own runtime system header files 3s.dat license file for licensed fieldbus stacks and other libraries
3S maintains and tests these systems with new releases of CODESYS and/or new releases of the operating system. The runtime toolkit contains: Contents of Runtime Toolkit a) b) c) d) e) f) Sample device description file for that platform CODESYS Control runtime system headers and m4 files Tools to create own runtime system header files 3s.dat license file for licensed fieldbus stacks and other libraries Sample runtime configuration file (*.cfg) Runtime adaptation (with multi tasking scheduler): • Processor specifics • Timer • Memory • Debug Outputs
Template: templ_tecdoc_en_V1.0.docx
Overview Runtime adaptation work packages Standard System Ready-to-start embedded system Embedded system with other processor/OS/toolchain combination Platform specifics Build Linux VxWorks CANopen Linux Windows CE VxWorks QNX RTE EtherCAT Linux, QNX Windows CE VxWorks RTE Target Visualization Linux, QNX Windows CE VxWorks RTE Web visualization Linux, QNX Windows CE VxWorks RTE Glossary
© 3S-Smart Software Solutions GmbH
CODESYS Inspiring Automation Solutions
4/10 Runtime
CODESYS Control Overview
adaptation work packages
Contents of Runtime Toolkit • • • • • • • • • • • Flash/File system, directories Exception handling Interrupt handling Serial interface for communication Socket interface for communication and Modbus CANmini driver to support CANopen and other CAN-based protocols (see below) PCI and Shared memory to support Hilscher fieldbus cards Ethernet driver to support EtherCAT (see below) Event handling Semaphore handling Task handling
CODESYS Control Overview
Guidelines for runtime adaptation
Version: 2.0 Template: templ_tecdoc_en_V1.0.docx Dateiname: CODESYSControlV3_Overview.docx
© 3S-Smart Software So following chapters, runtime toolkit contents, prerequisites and step to build a system are listed. As the OEM has to do maintenance for its product and support for its customers for a longer period of time, it is recommended that the OEM assigns an engineer as specialist for these tasks. 2.1 Standard System
Examples of such systems are Windows 7 on an Intel Pentium, or VxWorks on a PowerPC, or Linux on an ARM processor.
Template: templ_tecdoc_en_V1.0.docx
Supported operating systems are Linux, VxWorks, Windows 7, Windows CE/Windows Embedded Compact and QNX. The CODESYS Control runtime system for Windows 7 is available in two different versions: CODESYS Control RTE: with hard real time extension made by 3S Some hardware requirements must be observed, see RTE manual. CODESYS Control WinV3: without real time capabilities: No special hardware requirements, so it can run on every Windows / x86 platform.
2
Runtime adaptation work packages
Depending on the different types of adaptation, different preparation and adaptation work has to be done. Basically, there are 3 different starting points for a runtime adaptation: Using standard processors and operating systems like Linux, VxWorks, Windows Ready-to-start embedded system with use of supported evaluation board Embedded system with other processor/OS/toolchain combination
Steps to build your system: Responsible 1) 2) 3)
Template: templ_tecdoc_en_V1.0.docx
Task Inform 3S about processor, OS and version Compile and deliver runtime toolkit to OEM Workshop with OEM. OEM learns about • how to work with CODESYS (basics) • how to adapt device description file • how to adapt runtime configuration file • how to build additional components, libraries and IO drivers Create additional components, libraries and IO drivers Test