Skip to content

Commit

Permalink
更新sample脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
newbienewbie committed Jan 16, 2021
1 parent 13db7c8 commit 4a3c218
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 4 deletions.
15 changes: 15 additions & 0 deletions docs/sample scripts/0. 上料请求.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22


# 1号线上料——原料参数
s7_server_svc.WriteString(INFO_DB_NUMBER, 2780, "1908WC16V299F6+YSTC1100139+L2/L3:1757;L1/N:1762;")
s7_server_svc.WriteReal(INFO_DB_NUMBER, 3036, 3545.2)
s7_server_svc.WriteReal(INFO_DB_NUMBER, 3040, 68.3)
s7_server_svc.WriteReal(INFO_DB_NUMBER, 3044, 4.8)

# 1号线上料——发送请求
s7_server_svc.WriteBit(INTEROP_DB_NUMBER,6,0, True)
8 changes: 8 additions & 0 deletions docs/sample scripts/0.1 上料请求-结束.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22

# 1号线上料——发送结束信号
s7_server_svc.WriteBit(INTEROP_DB_NUMBER,6,0, False)
40 changes: 40 additions & 0 deletions docs/sample scripts/1. 贴标请求.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22


# 读取上料工位的缓存
# 原料码
raw_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER, 2780)
# 锯切段数
cutting_num = s7_server_svc.ReadByte(INFO_DB_NUMBER, 3048)
# 原料码去向
gotoline = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,0)
# 尺寸判断结果
size_checking = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,1)
# 理论尺寸
len_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3050)
width_in_thoery = s7_server_svc.ReadReal(INFO_DB_NUMBER,3054)
depth_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3058)
cutting_code = s7_server_svc.ReadString(INFO_DB_NUMBER,3062)

# 半成品码条码
banchengpin1_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3318)
banchengpin2_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3602)
banchengpin3_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3886)
banchengpin4_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4170)
banchengpin5_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4454)


# 写入一号线的贴标工位
s7_server_svc.WriteString(INFO_DB_NUMBER, 6696, raw_barcode)
s7_server_svc.WriteString(INFO_DB_NUMBER, 7234, banchengpin1_barcode)
s7_server_svc.WriteString(INFO_DB_NUMBER, 7518, banchengpin2_barcode)
s7_server_svc.WriteString(INFO_DB_NUMBER, 7802, banchengpin3_barcode)
s7_server_svc.WriteString(INFO_DB_NUMBER, 8086, banchengpin4_barcode)
s7_server_svc.WriteString(INFO_DB_NUMBER, 8370, banchengpin5_barcode)
# 1号线上料——发送交互请求
s7_server_svc.WriteString(INTEROP_DB_NUMBER, 8, banchengpin1_barcode)
s7_server_svc.WriteBit(INTEROP_DB_NUMBER, 6, 1, True)
8 changes: 8 additions & 0 deletions docs/sample scripts/1.1 贴标请求-结束.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22

# 1号线上料——发送交互请求
s7_server_svc.WriteBit(INTEROP_DB_NUMBER, 6, 1, False)
36 changes: 36 additions & 0 deletions docs/sample scripts/5.拍弯工位A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22


# 读取上料工位的缓存
# 原料码
raw_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER, 2780)
# 锯切段数
cutting_num = s7_server_svc.ReadByte(INFO_DB_NUMBER, 3048)
# 原料码去向
gotoline = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,0)
# 尺寸判断结果
size_checking = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,1)
# 理论尺寸
len_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3050)
width_in_thoery = s7_server_svc.ReadReal(INFO_DB_NUMBER,3054)
depth_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3058)
cutting_code = s7_server_svc.ReadString(INFO_DB_NUMBER,3062)

# 半成品码条码
banchengpin1_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3318)
banchengpin2_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3602)
banchengpin3_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3886)
banchengpin4_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4170)
banchengpin5_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4454)




# 写入一号线的拍弯工位
s7_server_svc.WriteString(INFO_DB_NUMBER, 24512, raw_barcode)
# 这个工位只有1个半成品码,这里假设是显示半成品码1
s7_server_svc.WriteString(INFO_DB_NUMBER, 25050, banchengpin1_barcode)
36 changes: 36 additions & 0 deletions docs/sample scripts/6.拍弯工位B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22


# 读取上料工位的缓存
# 原料码
raw_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER, 2780)
# 锯切段数
cutting_num = s7_server_svc.ReadByte(INFO_DB_NUMBER, 3048)
# 原料码去向
gotoline = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,0)
# 尺寸判断结果
size_checking = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,1)
# 理论尺寸
len_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3050)
width_in_thoery = s7_server_svc.ReadReal(INFO_DB_NUMBER,3054)
depth_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3058)
cutting_code = s7_server_svc.ReadString(INFO_DB_NUMBER,3062)

# 半成品码条码
banchengpin1_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3318)
banchengpin2_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3602)
banchengpin3_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3886)
banchengpin4_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4170)
banchengpin5_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4454)




# 写入一号线的拍弯工位
s7_server_svc.WriteString(INFO_DB_NUMBER, 26156, raw_barcode)
# 这个工位只有1个半成品码,这里假设是显示半成品码2
s7_server_svc.WriteString(INFO_DB_NUMBER, 26694, banchengpin2_barcode)
38 changes: 38 additions & 0 deletions docs/sample scripts/7. 轮廓测长.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: UTF-8 -*-

# define constants
INFO_DB_NUMBER = 6
INTEROP_DB_NUMBER = 22


# 读取上料工位的缓存
# 原料码
raw_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER, 2780)
# 锯切段数
cutting_num = s7_server_svc.ReadByte(INFO_DB_NUMBER, 3048)
# 原料码去向
gotoline = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,0)
# 尺寸判断结果
size_checking = s7_server_svc.ReadBit(INFO_DB_NUMBER,3049,1)
# 理论尺寸
len_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3050)
width_in_thoery = s7_server_svc.ReadReal(INFO_DB_NUMBER,3054)
depth_in_theory = s7_server_svc.ReadReal(INFO_DB_NUMBER,3058)
cutting_code = s7_server_svc.ReadString(INFO_DB_NUMBER,3062)

# 半成品码条码
banchengpin1_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3318)
banchengpin2_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3602)
banchengpin3_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,3886)
banchengpin4_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4170)
banchengpin5_barcode = s7_server_svc.ReadString(INFO_DB_NUMBER,4454)




# 写入一号线的测长工位的原料码
s7_server_svc.WriteString(INFO_DB_NUMBER, 27800, raw_barcode)
# 写入一号线的测长工位的半成品码,这里假设是显示半成品码2
s7_server_svc.WriteString(INFO_DB_NUMBER, 28338, banchengpin2_barcode)
# 发请求信号, 通知上位机去1200-1 PLC那请求测长数据
s7_server_svc.WriteBit(INTEROP_DB_NUMBER, 6, 2, True)
4 changes: 0 additions & 4 deletions docs/sample scripts/UpdateServer.py

This file was deleted.

0 comments on commit 4a3c218

Please sign in to comment.