# PLC DB 配置
db_variables = [
# DB3 (上位机交互数据块)
{
'db': 3, # 数据块编号
'vars': [
# Int类型变量
{'name': 'Servo_Alarm', 'offset': 2, 'type': 'Int'}, # 伺服报警代码(0=正常)
{'name': 'PLC_Error_Code', 'offset': 4, 'type': 'Int'}, # PLC错误代码(0=正常)
{'name': 'Actual_ActVelocity_X1', 'offset': 30, 'type': 'Int'}, # Left_X1运行速度
{'name': 'Actual_ActVelocity_Y1', 'offset': 32, 'type': 'Int'}, # Left_Y1运行速度
{'name': 'Actual_ActVelocity_Z1', 'offset': 34, 'type': 'Int'}, # Left_Z1运行速度
{'name': 'Actual_ActVelocity_X2', 'offset': 36, 'type': 'Int'}, # Right_X2运行速度
{'name': 'Actual_ActVelocity_Y2', 'offset': 38, 'type': 'Int'}, # Right_Y2运行速度
{'name': 'Actual_ActVelocity_Z2', 'offset': 40, 'type': 'Int'}, # Right_Z2运行速度
# Bool类型变量(注意位位置)
# 字节0的位变量
{'name': 'Auto/Manual_Mode', 'offset': 0, 'type': 'Bool', 'bit': 0}, # 切换为手动调试模式
{'name': 'Axis_X_Ready', 'offset': 0, 'type': 'Bool', 'bit': 1}, # X轴伺服准备就绪
{'name': 'Axis_Y_Ready', 'offset': 0, 'type': 'Bool', 'bit': 2}, # Y轴伺服准备就绪
{'name': 'Axis_Z_Ready', 'offset': 0, 'type': 'Bool', 'bit': 3}, # Z轴伺服准备就绪
{'name': 'Axis_X_InPosition', 'offset': 0, 'type': 'Bool', 'bit': 4}, # X轴到达目标位置
{'name': 'Axis_Y_InPosition', 'offset': 0, 'type': 'Bool', 'bit': 5}, # Y轴到达目标位置
{'name': 'Axis_Z_InPosition', 'offset': 0, 'type': 'Bool', 'bit': 6}, # Z轴到达目标位
{'name': 'Emergency_Active', 'offset': 0, 'type': 'Bool', 'bit': 7}, # 急停状态激活(需复位)
# 字节1的位变量
{'name': 'Safety_Door_Open', 'offset': 1, 'type': 'Bool', 'bit': 0}, # 安全门未关闭(触发停机)
# 字节42的位变量(左工位控制)
{'name': 'Left start', 'offset': 58, 'type': 'Bool', 'bit': 0}, # 左启动
{'name': 'X1_ executes_ the_ movement', 'offset': 42, 'type': 'Bool', 'bit': 0}, # 左X执行
{'name': 'Y1_ executes_ the_ movement', 'offset': 42, 'type': 'Bool', 'bit': 1}, # # 左z执行
{'name': 'Z1_ executes_ the_ movement', 'offset': 42, 'type': 'Bool', 'bit': 2}, # # 左y执行
# {'name': 'Left reset', 'offset': 42, 'type': 'Bool', 'bit': 1}, # 左复位
# {'name': 'Left replay', 'offset': 42, 'type': 'Bool', 'bit': 2}, # 左重打
# {'name': 'Left screw detection', 'offset': 42, 'type': 'Bool', 'bit': 3}, # 左螺钉检测
# {'name': 'The cylinder attached to the left is in situ', 'offset': 42, 'type': 'Bool', 'bit': 4}, # 左所附气缸原位
# {'name': 'Left lock payment begins', 'offset': 42, 'type': 'Bool', 'bit': 5}, # 左锁付开始
# {'name': 'Left lock in the middle', 'offset': 42, 'type': 'Bool', 'bit': 6}, # 左锁付中
# {'name': 'Left lock pay OK', 'offset': 42, 'type': 'Bool', 'bit': 7}, # 左锁付OK
#
# # 字节43的位变量(左工位状态)
# {'name': 'The left lock is attached to the NG', 'offset': 43, 'type': 'Bool', 'bit': 0}, # 左锁附NG
# {'name': 'Left camera triggers', 'offset': 43, 'type': 'Bool', 'bit': 1}, # 左相机触发
# {'name': 'Left positioning calibration', 'offset': 43, 'type': 'Bool', 'bit': 2}, # 左定位校准
# {'name': 'Left camera detection is OK', 'offset': 43, 'type': 'Bool', 'bit': 3}, # 左相机检测OK
# {'name': 'The left camera detects NG', 'offset': 43, 'type': 'Bool', 'bit': 4}, # 左相机检测NG
# {'name': 'Left cylinder 1 single control', 'offset': 43, 'type': 'Bool', 'bit': 5}, # 左气缸1单控
# {'name': 'Left cylinder 2 single control', 'offset': 43, 'type': 'Bool', 'bit': 6}, # 左气缸2单控
# {'name': 'Left cylinder 3 single control_1', 'offset': 43, 'type': 'Bool', 'bit': 7}, # 左气缸3单控
#
# # 字节44的位变量(左工位气缸信号)
# {'name': 'Left cylinder4 single control_2', 'offset': 44, 'type': 'Bool', 'bit': 0}, # 左气缸4单控
# {'name': 'Left cylinder signal 1', 'offset': 44, 'type': 'Bool', 'bit': 1}, # 左气缸信号1
# {'name': 'Left cylinder signal 2', 'offset': 44, 'type': 'Bool', 'bit': 2}, # 左气缸信号2
# {'name': 'Left cylinder signal 3', 'offset': 44, 'type': 'Bool', 'bit': 3}, # 左气缸信号3
# {'name': 'Left cylinder signal 4', 'offset': 44, 'type': 'Bool', 'bit': 4}, # 左气缸信号4
# {'name': 'Left cylinder signal 5', 'offset': 44, 'type': 'Bool', 'bit': 5}, # 左气缸信号5
# {'name': 'Left cylinder signal 6', 'offset': 44, 'type': 'Bool', 'bit': 6}, # 左气缸信号6
# {'name': 'Left cylinder signal 7', 'offset': 44, 'type': 'Bool', 'bit': 7}, # 左气缸信号7
# 字节45的位变量(右工位控制)
{'name': 'Left cylinder signal 8', 'offset': 45, 'type': 'Bool', 'bit': 0}, # 左气缸信号8
{'name': 'Start right', 'offset': 45, 'type': 'Bool', 'bit': 1}, # 右启动
{'name': 'Right reset', 'offset': 45, 'type': 'Bool', 'bit': 2}, # 右复位
{'name': 'Right replay', 'offset': 45, 'type': 'Bool', 'bit': 3}, # 右重打
{'name': 'Right screw detection', 'offset': 45, 'type': 'Bool', 'bit': 4}, # 右螺钉检测
{'name': 'The right attached cylinder is in situ', 'offset': 45, 'type': 'Bool', 'bit': 5}, # 右所附气缸原位
{'name': 'Right lock payment starts', 'offset': 45, 'type': 'Bool', 'bit': 6}, # 右锁付开始
{'name': 'The right lock is in the middle', 'offset': 45, 'type': 'Bool', 'bit': 7}, # 右锁付中
# 字节46的位变量(右工位状态)
{'name': 'Right lock pay OK', 'offset': 46, 'type': 'Bool', 'bit': 0}, # 右锁付OK
{'name': 'The right lock is attached to the NG', 'offset': 46, 'type': 'Bool', 'bit': 1}, # 右锁附NG
{'name': 'Right camera triggers', 'offset': 46, 'type': 'Bool', 'bit': 2}, # 右相机触发
{'name': 'Right positioning calibration', 'offset': 46, 'type': 'Bool', 'bit': 3}, # 右定位校准
{'name': 'Right camera detection OK', 'offset': 46, 'type': 'Bool', 'bit': 4}, # 右相机检测OK
{'name': 'The right camera detects NG', 'offset': 46, 'type': 'Bool', 'bit': 5}, # 右相机检测NG
{'name': 'Right cylinder 1 single control', 'offset': 46, 'type': 'Bool', 'bit': 6}, # 右气缸1单控
{'name': 'Right cylinder 2 single control', 'offset': 46, 'type': 'Bool', 'bit': 7}, # 右气缸2单控
# 字节47的位变量(右工位气缸信号)
{'name': 'Right cylinder 3 single control_1', 'offset': 47, 'type': 'Bool', 'bit': 0}, # 右气缸3单控
{'name': 'Right cylinder 2 single controlRight cylinder 4 single control', 'offset': 47, 'type': 'Bool',
'bit': 1}, # 右气缸4单控
{'name': 'Right cylinder signal 1', 'offset': 47, 'type': 'Bool', 'bit': 2}, # 右气缸信号1
{'name': 'Right cylinder signal 2', 'offset': 47, 'type': 'Bool', 'bit': 3}, # 右气缸信号2
{'name': 'Right cylinder signal 3', 'offset': 47, 'type': 'Bool', 'bit': 4}, # 右气缸信号3
{'name': 'Right cylinder signal 4', 'offset': 47, 'type': 'Bool', 'bit': 5}, # 右气缸信号4
{'name': 'Right cylinder signal 5', 'offset': 47, 'type': 'Bool', 'bit': 6}, # 右气缸信号5
{'name': 'Right cylinder signal 6', 'offset': 47, 'type': 'Bool', 'bit': 7}, # 右气缸信号6
# 字节48的位变量
{'name': 'Right cylinder signal 7', 'offset': 48, 'type': 'Bool', 'bit': 0}, # 右气缸信号7
{'name': 'Right cylinder signal 8', 'offset': 48, 'type': 'Bool', 'bit': 1}, # 右气缸信号8
# Float类型变量(对应PLC中的Real类型)
{'name': 'Actual_Pos_X1', 'offset': 6, 'type': 'Float'}, # X1轴运行数据
{'name': 'Actual_Pos_Y1', 'offset': 10, 'type': 'Float'}, # Y1轴运行数据
{'name': 'Actual_Pos_Z1', 'offset': 14, 'type': 'Float'}, # Z1轴运行数据
{'name': 'Actual_Pos_X_2', 'offset': 18, 'type': 'Float'}, # X2轴运行数据
{'name': 'Actual_Pos_Y_2', 'offset': 22, 'type': 'Float'}, # Y2轴运行数据
{'name': 'Actual_Pos_Z_2', 'offset': 26, 'type': 'Float'}, # Z2轴运行数据
{'name': 'Emergency stop', 'offset': 30, 'type': 'Float'}, # 急停状态
{'name': 'Servo zeroing is complete', 'offset': 34, 'type': 'Float'}, # 伺服归零完成
{'name': 'Servo zeroing', 'offset': 38, 'type': 'Float'}, # 伺服归零中
]
}
]
name type offset
Auto/Manual_Mode Bool 0 FALSE FALSE TRUE TRUE TRUE FALSE 切换为手动调试模式
Axis_X_Ready Bool 0.1 FALSE FALSE TRUE TRUE TRUE FALSE X轴伺服准备就绪
Axis_Y_Ready Bool 0.2 FALSE FALSE TRUE TRUE TRUE FALSE Y轴伺服准备就绪
Axis_Z_Ready Bool 0.3 FALSE FALSE TRUE TRUE TRUE FALSE Z轴伺服准备就绪
Axis_X_InPosition Bool 0.4 FALSE FALSE TRUE TRUE TRUE FALSE X轴到达目标位置
Axis_Y_InPosition Bool 0.5 FALSE FALSE TRUE TRUE TRUE FALSE Y轴到达目标位置
Axis_Z_InPosition Bool 0.6 FALSE FALSE TRUE TRUE TRUE FALSE Z轴到达目标位
Emergency_Active Bool 0.7 FALSE FALSE TRUE TRUE TRUE FALSE 急停状态激活(需复位)
Safety_Door_Open Bool 1 FALSE FALSE TRUE TRUE TRUE FALSE 安全门未关闭(触发停机)
Servo_Alarm Int 2 0 FALSE TRUE TRUE TRUE FALSE 伺服报警代码(0=正常)
PLC_Error_Code Int 4 0 FALSE TRUE TRUE TRUE FALSE PLC错误代码(0=正常)
Actual_Pos_X1 Real 6 0 FALSE TRUE TRUE TRUE FALSE X1运行数据
Actual_Pos_Y1 Real 10 0 FALSE TRUE TRUE TRUE FALSE Y1运行数据
Actual_Pos_Z1 Real 14 0 FALSE TRUE TRUE TRUE FALSE Z1运行数据
Actual_Pos_X_2 Real 18 0 FALSE TRUE TRUE TRUE FALSE X2运行数据
Actual_Pos_Y_2 Real 22 0 FALSE TRUE TRUE TRUE FALSE Y2运行数据
Actual_Pos_Z_2 Real 26 0 FALSE TRUE TRUE TRUE FALSE Z2运行数据
Actual_ActVelocity_X1 Int 30 0 FALSE TRUE TRUE TRUE FALSE X1运行速度
Actual_ActVelocity_Y1 Int 32 0 FALSE TRUE TRUE TRUE FALSE Y1运行速度
Actual_ActVelocity_Z1 Int 34 0 FALSE TRUE TRUE TRUE FALSE Z1运行速度
Actual_ActVelocity_X2 Int 36 0 FALSE TRUE TRUE TRUE FALSE X2运行速度
Actual_ActVelocity_Y2 Int 38 0 FALSE TRUE TRUE TRUE FALSE Y2运行速度
Actual_ActVelocity_Z2 Int 40 0 FALSE TRUE TRUE TRUE FALSE Z2运行速度
X1_ executes_ the_ movement Bool 42 FALSE FALSE TRUE TRUE TRUE FALSE X1执行运动
Y1_ executes_ the_ movement Bool 42.1 FALSE FALSE TRUE TRUE TRUE FALSE Y1执行运动
Z1_ executes_ the_ movement Bool 42.2 FALSE FALSE TRUE TRUE TRUE FALSE Z1执行运动
X2_ executes_ the_ movement Bool 42.3 FALSE FALSE TRUE TRUE TRUE FALSE X2执行运动
Y2_ executes_ the_ movement Bool 42.4 FALSE FALSE TRUE TRUE TRUE FALSE Y2执行运动
Z2_ executes_ the_ movement Bool 42.5 FALSE FALSE TRUE TRUE TRUE FALSE Z2执行运动
X1_completed Bool 42.6 FALSE FALSE TRUE TRUE TRUE FALSE X1执行完毕
Y1_completed Bool 42.7 FALSE FALSE TRUE TRUE TRUE FALSE Y1执行完毕
Z1_completed Bool 43 FALSE FALSE TRUE TRUE TRUE FALSE Z1执行完毕
X2_completed Bool 43.1 FALSE FALSE TRUE TRUE TRUE FALSE X2执行完毕
Y2_completed Bool 43.2 FALSE FALSE TRUE TRUE TRUE FALSE Y2执行完毕
Z2_completed Bool 43.3 FALSE FALSE TRUE TRUE TRUE FALSE Z2执行完毕
X1_axis_error Bool 43.4 FALSE FALSE TRUE TRUE TRUE FALSE X1轴报错
Y1_axis_error Bool 43.5 FALSE FALSE TRUE TRUE TRUE FALSE Y1轴报错
Z1_axis_error Bool 43.6 FALSE FALSE TRUE TRUE TRUE FALSE Z1轴报错
X2_axis_error Bool 43.7 FALSE FALSE TRUE TRUE TRUE FALSE X2轴报错
Y2_axis_error Bool 44 FALSE FALSE TRUE TRUE TRUE FALSE Y2轴报错
Z2_axis_error Bool 44.1 FALSE FALSE TRUE TRUE TRUE FALSE Z2轴报错
把config.py文件更新成上表
最新发布