使用 Sinamics S120 驱动脚本配置扩展报文

为了传输故障代码、电流、温度等信息。通常需要使用扩展报文的方式来发送这些信息。在驱动数量较少的情况下,可以进行手动配置。
如果驱动数量很多,可以使用脚本script的方式来配置扩展报文。

驱动编号

注意下图中的Drive Number,表示驱动在 CU(control unit)中的编号, 脚本中需要使用这个编号

以下脚本,给报文增加如下内容
receive word 10, r80 电机扭矩
receive word 11, r2131 驱动故障代码
receive word 12, r2132 电机扭矩
receive word 13, r80 电机扭矩
receive word 14, r68 电机电流
receive word 15, r35 电机温度

使用以下脚本时,需要

  • 将设备名称替换为你项目中的CU名称
  • 将驱动名称替换为你项目中的驱动
  • 检查Drive Number是否正确
' Script_1

'r80 torque actual value
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,10)     =  "80 : 0 : 2"  ' receive word 10
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,10)        =  "80 : 0 : 3"  ' receive word 10
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,10)    =  "80 : 0 : 4"  ' receive word 10
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,10)      =  "80 : 0 : 5"  ' receive word 10

'r2131 fault number
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,11)     =  "2131 : 0 : 2"  ' receive word 11
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,11)        =  "2131 : 0 : 3"  ' receive word 11
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,11)    =  "2131 : 0 : 4"  ' receive word 11
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,11)      =  "2131 : 0 : 5"  ' receive word 11


'r2132 alarm number
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,12)     =  "2132 : 0 : 2"  ' receive word 12
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,12)        =  "2132 : 0 : 3"  ' receive word 12
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,12)    =  "2132 : 0 : 4"  ' receive word 12
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,12)      =  "2132 : 0 : 5"  ' receive word 12


'r80 torque actual value
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,13)     =  "80 : 0 : 2"  ' receive word 13
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,13)        =  "80 : 0 : 3"  ' receive word 13
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,13)    =  "80 : 0 : 4"  ' receive word 13
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,13)      =  "80 : 0 : 5"  ' receive word 13

'r68 current
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,14)     =  "68 : 0 : 2"  ' receive word 14
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,14)        =  "68 : 0 : 3"  ' receive word 14
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,14)    =  "68 : 0 : 4"  ' receive word 14
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,14)      =  "68 : 0 : 5"  ' receive word 14

'r35 motor temperature
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_IC_4").Parameters(2051,15)     =  "35 : 0 : 2"  ' receive word 15
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_PC_4").Parameters(2051,15)        =  "35 : 0 : 3"  ' receive word 15
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_Infeed_IN").Parameters(2051,15)    =  "35 : 0 : 4"  ' receive word 15
PROJ.Devices("S120xCU320x2xPN4").TOs("DRV_UNWinder").Parameters(2051,15)      =  "35 : 0 : 5"  ' receive word 15

posted on 2019-03-23 11:17  lion_zheng  阅读(1044)  评论(1编辑  收藏  举报

导航