From 4a3c218d0c1dd44cf4357f1958e7c21338c86b13 Mon Sep 17 00:00:00 2001 From: newbienewbie Date: Sat, 16 Jan 2021 14:59:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0sample=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...12\346\226\231\350\257\267\346\261\202.py" | 15 +++++++ ...7\346\261\202-\347\273\223\346\235\237.py" | 8 ++++ ...64\346\240\207\350\257\267\346\261\202.py" | 40 +++++++++++++++++++ ...7\346\261\202-\347\273\223\346\235\237.py" | 8 ++++ ...5\345\274\257\345\267\245\344\275\215A.py" | 36 +++++++++++++++++ ...5\345\274\257\345\267\245\344\275\215B.py" | 36 +++++++++++++++++ ...56\345\273\223\346\265\213\351\225\277.py" | 38 ++++++++++++++++++ docs/sample scripts/UpdateServer.py | 4 -- 8 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 "docs/sample scripts/0. \344\270\212\346\226\231\350\257\267\346\261\202.py" create mode 100644 "docs/sample scripts/0.1 \344\270\212\346\226\231\350\257\267\346\261\202-\347\273\223\346\235\237.py" create mode 100644 "docs/sample scripts/1. \350\264\264\346\240\207\350\257\267\346\261\202.py" create mode 100644 "docs/sample scripts/1.1 \350\264\264\346\240\207\350\257\267\346\261\202-\347\273\223\346\235\237.py" create mode 100644 "docs/sample scripts/5.\346\213\215\345\274\257\345\267\245\344\275\215A.py" create mode 100644 "docs/sample scripts/6.\346\213\215\345\274\257\345\267\245\344\275\215B.py" create mode 100644 "docs/sample scripts/7. \350\275\256\345\273\223\346\265\213\351\225\277.py" delete mode 100644 docs/sample scripts/UpdateServer.py diff --git "a/docs/sample scripts/0. \344\270\212\346\226\231\350\257\267\346\261\202.py" "b/docs/sample scripts/0. \344\270\212\346\226\231\350\257\267\346\261\202.py" new file mode 100644 index 0000000..b8af9e6 --- /dev/null +++ "b/docs/sample scripts/0. \344\270\212\346\226\231\350\257\267\346\261\202.py" @@ -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) \ No newline at end of file diff --git "a/docs/sample scripts/0.1 \344\270\212\346\226\231\350\257\267\346\261\202-\347\273\223\346\235\237.py" "b/docs/sample scripts/0.1 \344\270\212\346\226\231\350\257\267\346\261\202-\347\273\223\346\235\237.py" new file mode 100644 index 0000000..58332fa --- /dev/null +++ "b/docs/sample scripts/0.1 \344\270\212\346\226\231\350\257\267\346\261\202-\347\273\223\346\235\237.py" @@ -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) \ No newline at end of file diff --git "a/docs/sample scripts/1. \350\264\264\346\240\207\350\257\267\346\261\202.py" "b/docs/sample scripts/1. \350\264\264\346\240\207\350\257\267\346\261\202.py" new file mode 100644 index 0000000..2f8f0bb --- /dev/null +++ "b/docs/sample scripts/1. \350\264\264\346\240\207\350\257\267\346\261\202.py" @@ -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) diff --git "a/docs/sample scripts/1.1 \350\264\264\346\240\207\350\257\267\346\261\202-\347\273\223\346\235\237.py" "b/docs/sample scripts/1.1 \350\264\264\346\240\207\350\257\267\346\261\202-\347\273\223\346\235\237.py" new file mode 100644 index 0000000..3ce138e --- /dev/null +++ "b/docs/sample scripts/1.1 \350\264\264\346\240\207\350\257\267\346\261\202-\347\273\223\346\235\237.py" @@ -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) diff --git "a/docs/sample scripts/5.\346\213\215\345\274\257\345\267\245\344\275\215A.py" "b/docs/sample scripts/5.\346\213\215\345\274\257\345\267\245\344\275\215A.py" new file mode 100644 index 0000000..14e8c0a --- /dev/null +++ "b/docs/sample scripts/5.\346\213\215\345\274\257\345\267\245\344\275\215A.py" @@ -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) diff --git "a/docs/sample scripts/6.\346\213\215\345\274\257\345\267\245\344\275\215B.py" "b/docs/sample scripts/6.\346\213\215\345\274\257\345\267\245\344\275\215B.py" new file mode 100644 index 0000000..929a034 --- /dev/null +++ "b/docs/sample scripts/6.\346\213\215\345\274\257\345\267\245\344\275\215B.py" @@ -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) diff --git "a/docs/sample scripts/7. \350\275\256\345\273\223\346\265\213\351\225\277.py" "b/docs/sample scripts/7. \350\275\256\345\273\223\346\265\213\351\225\277.py" new file mode 100644 index 0000000..c25b467 --- /dev/null +++ "b/docs/sample scripts/7. \350\275\256\345\273\223\346\265\213\351\225\277.py" @@ -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) diff --git a/docs/sample scripts/UpdateServer.py b/docs/sample scripts/UpdateServer.py deleted file mode 100644 index 0b0984a..0000000 --- a/docs/sample scripts/UpdateServer.py +++ /dev/null @@ -1,4 +0,0 @@ -s7_server_svc.WriteString(6, 2780, "1908WC16V299F6+YSTC1100139+L2/L3:1757;L1/N:1762;") -s7_server_svc.WriteReal(6, 3036, 3545.2) -s7_server_svc.WriteReal(6, 3040, 68.3) -s7_server_svc.WriteReal(6, 3040, 4.8) \ No newline at end of file