From ae7234b6e5e7af23b29af9763dd64b96eae55916 Mon Sep 17 00:00:00 2001 From: aarizona Date: Wed, 21 Aug 2024 20:17:56 +0300 Subject: [PATCH] remove build --- .gitignore | 5 + .vscode/PythonImportHelper-v2-Completion.json | 416 ------------------ __pycache__/client.cpython-310.pyc | Bin 1687 -> 0 bytes __pycache__/func.cpython-310.pyc | Bin 3167 -> 0 bytes __pycache__/socket.cpython-310.pyc | Bin 306 -> 0 bytes client.py | 20 +- data/data.txt | 2 + func.py | 3 +- 8 files changed, 13 insertions(+), 433 deletions(-) create mode 100644 .gitignore delete mode 100644 .vscode/PythonImportHelper-v2-Completion.json delete mode 100644 __pycache__/client.cpython-310.pyc delete mode 100644 __pycache__/func.cpython-310.pyc delete mode 100644 __pycache__/socket.cpython-310.pyc create mode 100644 data/data.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c47f6ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +__pycache__/ +.venv/ +.vscode/ +build/ +dist/ \ No newline at end of file diff --git a/.vscode/PythonImportHelper-v2-Completion.json b/.vscode/PythonImportHelper-v2-Completion.json deleted file mode 100644 index 2224e64..0000000 --- a/.vscode/PythonImportHelper-v2-Completion.json +++ /dev/null @@ -1,416 +0,0 @@ -[ - { - "label": "*", - "importPath": "func", - "description": "func", - "isExtraImport": true, - "detail": "func", - "documentation": {} - }, - { - "label": "*", - "importPath": "func", - "description": "func", - "isExtraImport": true, - "detail": "func", - "documentation": {} - }, - { - "label": "*", - "importPath": "func", - "description": "func", - "isExtraImport": true, - "detail": "func", - "documentation": {} - }, - { - "label": "ModbusTcpClient", - "importPath": "pymodbus.client", - "description": "pymodbus.client", - "isExtraImport": true, - "detail": "pymodbus.client", - "documentation": {} - }, - { - "label": "ModbusTcpClient", - "importPath": "pymodbus.client", - "description": "pymodbus.client", - "isExtraImport": true, - "detail": "pymodbus.client", - "documentation": {} - }, - { - "label": "ModbusTcpClient", - "importPath": "pymodbus.client", - "description": "pymodbus.client", - "isExtraImport": true, - "detail": "pymodbus.client", - "documentation": {} - }, - { - "label": "time", - "kind": 6, - "isExtraImport": true, - "importPath": "time", - "description": "time", - "detail": "time", - "documentation": {} - }, - { - "label": "glob", - "kind": 6, - "isExtraImport": true, - "importPath": "glob", - "description": "glob", - "detail": "glob", - "documentation": {} - }, - { - "label": "socket", - "kind": 6, - "isExtraImport": true, - "importPath": "socket", - "description": "socket", - "detail": "socket", - "documentation": {} - }, - { - "label": "json", - "kind": 6, - "isExtraImport": true, - "importPath": "json", - "description": "json", - "detail": "json", - "documentation": {} - }, - { - "label": "pprint", - "importPath": "pprint", - "description": "pprint", - "isExtraImport": true, - "detail": "pprint", - "documentation": {} - }, - { - "label": "Endian", - "importPath": "pymodbus.constants", - "description": "pymodbus.constants", - "isExtraImport": true, - "detail": "pymodbus.constants", - "documentation": {} - }, - { - "label": "BinaryPayloadDecoder", - "importPath": "pymodbus.payload", - "description": "pymodbus.payload", - "isExtraImport": true, - "detail": "pymodbus.payload", - "documentation": {} - }, - { - "label": "multiply_1000", - "kind": 2, - "importPath": "client", - "description": "client", - "peekOfCode": "def multiply_1000(n):\n return int(n * 1000)\nGOTO_Y = 5\ntry:\n total = 0\n state = None\n step = 0\n counter = 0\n paths = data\n paths = [", - "detail": "client", - "documentation": {} - }, - { - "label": "client", - "kind": 5, - "importPath": "client", - "description": "client", - "peekOfCode": "client = ModbusTcpClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\n# максимальное количество coils = 286\n# bulb(2)\n# get_coordinates()\n# get_or_set_speed(10)\nall_files = glob.glob(\"data/*.NC.result\")", - "detail": "client", - "documentation": {} - }, - { - "label": "all_files", - "kind": 5, - "importPath": "client", - "description": "client", - "peekOfCode": "all_files = glob.glob(\"data/*.NC.result\")\nfile = all_files[0]\ndata = []\nwith open(file, \"r\") as fp:\n lines = fp.readlines()\n for l in lines:\n r = l.strip().split(\",\")\n r[1] = int(float(r[1]) * 1000)\n r[2] = int(float(r[2]) * 1000)\n r[3] = int(float(r[3]) * 1000)", - "detail": "client", - "documentation": {} - }, - { - "label": "file", - "kind": 5, - "importPath": "client", - "description": "client", - "peekOfCode": "file = all_files[0]\ndata = []\nwith open(file, \"r\") as fp:\n lines = fp.readlines()\n for l in lines:\n r = l.strip().split(\",\")\n r[1] = int(float(r[1]) * 1000)\n r[2] = int(float(r[2]) * 1000)\n r[3] = int(float(r[3]) * 1000)\n data.append(r)", - "detail": "client", - "documentation": {} - }, - { - "label": "data", - "kind": 5, - "importPath": "client", - "description": "client", - "peekOfCode": "data = []\nwith open(file, \"r\") as fp:\n lines = fp.readlines()\n for l in lines:\n r = l.strip().split(\",\")\n r[1] = int(float(r[1]) * 1000)\n r[2] = int(float(r[2]) * 1000)\n r[3] = int(float(r[3]) * 1000)\n data.append(r)\n# print(data)", - "detail": "client", - "documentation": {} - }, - { - "label": "GOTO_Y", - "kind": 5, - "importPath": "client", - "description": "client", - "peekOfCode": "GOTO_Y = 5\ntry:\n total = 0\n state = None\n step = 0\n counter = 0\n paths = data\n paths = [\n (\"line\", 0, 0, 277.8, 0, 5, 0),\n # (\"line\", 30, 30, 0, 0, 0, 0),", - "detail": "client", - "documentation": {} - }, - { - "label": "s", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "s = socket.socket()\nhost = MODBUS_SERVER_HOST\nport = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "host", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "host = MODBUS_SERVER_HOST\nport = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "port", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "port = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}\nrequest_data = {", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "request_data", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}\nrequest_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"AddRCC\",\n \"emptyList\": \"1\",\n \"packID\": \"0\",", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "request_data", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"AddRCC\",\n \"emptyList\": \"1\",\n \"packID\": \"0\",\n \"instructions\": [{\"oneshot\": \"0\", \"action\": \"51\", \"isUse\": \"0\", \"speed\": \"1234\"}],\n}\nrequest_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"command\",", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "request_data", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"command\",\n \"packID\": \"0\",\n \"cmdReply\": [\"AddRCC\", \"r1\"],\n}\ns.send(str.encode(json.dumps(request_data)))\nresponse_data = s.recv(1024)\nresponse = json.loads(response_data)\npprint(response)", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "response_data", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "response_data = s.recv(1024)\nresponse = json.loads(response_data)\npprint(response)", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "response", - "kind": 5, - "importPath": "client_socket", - "description": "client_socket", - "peekOfCode": "response = json.loads(response_data)\npprint(response)", - "detail": "client_socket", - "documentation": {} - }, - { - "label": "two_byte_convert", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def two_byte_convert(result):\n # print(result)\n v0 = result.registers[0]\n value = (v0 << 16) + result.registers[1]\n if result.registers[0] > (65535 * 0.5):\n value = value - (1 << 32)\n return value\ndef bulb(addr, new_state, client):\n try:\n coils = client.read_coils(addr, 1, MODBUS_SLAVE_ID)", - "detail": "func", - "documentation": {} - }, - { - "label": "bulb", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def bulb(addr, new_state, client):\n try:\n coils = client.read_coils(addr, 1, MODBUS_SLAVE_ID)\n # print(\"читаем начальное состояние\", coils.bits)\n if not coils.bits[0] == new_state:\n result = client.write_coil(addr, new_state, coils.slave_id)\n # print(result)\n # print(\n # \"читаем после попытки\",\n # client.read_coils(0, len(coils.bits), coils.slave_id).bits,", - "detail": "func", - "documentation": {} - }, - { - "label": "get_coordinates", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def get_coordinates(client):\n try:\n data = [\n (\"j1\", 2268),\n (\"j2\", 2270),\n (\"j3\", 2272),\n (\"j4\", 2274),\n (\"j5\", 2276),\n (\"j6\", 2278),\n (\"x\", 2332),", - "detail": "func", - "documentation": {} - }, - { - "label": "collect_coordinates", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def collect_coordinates(client):\n # собираем предварительные данные\n x = two_byte_convert(client.read_holding_registers(2332, 2, MODBUS_SLAVE_ID))\n y = two_byte_convert(client.read_holding_registers(2334, 2, MODBUS_SLAVE_ID))\n z = two_byte_convert(client.read_holding_registers(2336, 2, MODBUS_SLAVE_ID))\n u = two_byte_convert(client.read_holding_registers(2338, 2, MODBUS_SLAVE_ID))\n v = two_byte_convert(client.read_holding_registers(2340, 2, MODBUS_SLAVE_ID))\n w = two_byte_convert(client.read_holding_registers(2342, 2, MODBUS_SLAVE_ID))\n print(\n f\"Предварительные данные X {x * 0.001}, Y {y * 0.001}, Z {z*0.001}, U {u*0.001}, V {v*0.001}, W {w*0.001}\"", - "detail": "func", - "documentation": {} - }, - { - "label": "get_or_set_speed", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def get_or_set_speed(number, client):\n result = client.read_holding_registers(20200, 1, MODBUS_SLAVE_ID)\n print(\"сейчас скорость\", result.registers[0] * 0.1)\n if number and number > 0 and number <= 1000:\n client.write_register(20200, number * 10, MODBUS_SLAVE_ID)\n result = client.read_holding_registers(20200, 1, MODBUS_SLAVE_ID)\n print(\"установлена скорость\", result.registers[0] * 0.1)\ndef set_user_register(n, values, client):\n client.write_registers(indent + s + k * n, values, MODBUS_SLAVE_ID)\ndef to_double(integr):", - "detail": "func", - "documentation": {} - }, - { - "label": "set_user_register", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def set_user_register(n, values, client):\n client.write_registers(indent + s + k * n, values, MODBUS_SLAVE_ID)\ndef to_double(integr):\n print(integr)\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):", - "detail": "func", - "documentation": {} - }, - { - "label": "to_double", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def to_double(integr):\n print(integr)\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)", - "detail": "func", - "documentation": {} - }, - { - "label": "set_user_reg_800", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)\ndef stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)", - "detail": "func", - "documentation": {} - }, - { - "label": "start_in_auto", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)\ndef stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)", - "detail": "func", - "documentation": {} - }, - { - "label": "stop_immediately", - "kind": 2, - "importPath": "func", - "description": "func", - "peekOfCode": "def stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)", - "detail": "func", - "documentation": {} - }, - { - "label": "MODBUS_SERVER_HOST", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "MODBUS_SERVER_HOST = \"192.168.70.55\" # IP-адрес Modbus-сервера\nMODBUS_SERVER_PORT = 502\nMODBUS_SLAVE_ID = 11\nindent = 21100\ns = 800\nk = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time", - "detail": "func", - "documentation": {} - }, - { - "label": "MODBUS_SERVER_PORT", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "MODBUS_SERVER_PORT = 502\nMODBUS_SLAVE_ID = 11\nindent = 21100\ns = 800\nk = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time\nimport glob", - "detail": "func", - "documentation": {} - }, - { - "label": "MODBUS_SLAVE_ID", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "MODBUS_SLAVE_ID = 11\nindent = 21100\ns = 800\nk = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time\nimport glob\ndef two_byte_convert(result):", - "detail": "func", - "documentation": {} - }, - { - "label": "indent", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "indent = 21100\ns = 800\nk = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time\nimport glob\ndef two_byte_convert(result):\n # print(result)", - "detail": "func", - "documentation": {} - }, - { - "label": "s", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "s = 800\nk = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time\nimport glob\ndef two_byte_convert(result):\n # print(result)\n v0 = result.registers[0]", - "detail": "func", - "documentation": {} - }, - { - "label": "k", - "kind": 5, - "importPath": "func", - "description": "func", - "peekOfCode": "k = 2\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nimport time\nimport glob\ndef two_byte_convert(result):\n # print(result)\n v0 = result.registers[0]\n value = (v0 << 16) + result.registers[1]", - "detail": "func", - "documentation": {} - }, - { - "label": "get_value", - "kind": 2, - "importPath": "prepare", - "description": "prepare", - "peekOfCode": "def get_value(c, s):\n [x] = [item.replace(s, '') for item in c if item.startswith(s)] or [0]\n return float(x)\nwith open(file, 'r') as fp:\n lines = fp.readlines()\n # print(lines)\n prev_x = None\n prev_y = None\n prev_z = None\n result = []", - "detail": "prepare", - "documentation": {} - }, - { - "label": "all_files", - "kind": 5, - "importPath": "prepare", - "description": "prepare", - "peekOfCode": "all_files = glob.glob(\"data/*.NC\")\nfile = all_files[0]\ndef get_value(c, s):\n [x] = [item.replace(s, '') for item in c if item.startswith(s)] or [0]\n return float(x)\nwith open(file, 'r') as fp:\n lines = fp.readlines()\n # print(lines)\n prev_x = None\n prev_y = None", - "detail": "prepare", - "documentation": {} - }, - { - "label": "file", - "kind": 5, - "importPath": "prepare", - "description": "prepare", - "peekOfCode": "file = all_files[0]\ndef get_value(c, s):\n [x] = [item.replace(s, '') for item in c if item.startswith(s)] or [0]\n return float(x)\nwith open(file, 'r') as fp:\n lines = fp.readlines()\n # print(lines)\n prev_x = None\n prev_y = None\n prev_z = None", - "detail": "prepare", - "documentation": {} - }, - { - "label": "client", - "kind": 5, - "importPath": "test", - "description": "test", - "peekOfCode": "client = ModbusTcpClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\n# максимальное количество coils = 286\nbulb(5,True, client)\n# get_coordinates()\nget_or_set_speed(30, client)\nclient.close()", - "detail": "test", - "documentation": {} - } -] \ No newline at end of file diff --git a/__pycache__/client.cpython-310.pyc b/__pycache__/client.cpython-310.pyc deleted file mode 100644 index 134719e1a7c24f4c2b64b611a356cf0ae0e4b0be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1687 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 diff --git a/__pycache__/socket.cpython-310.pyc b/__pycache__/socket.cpython-310.pyc deleted file mode 100644 index 6073fb845f3c1335ca01883e5d1e70a7f06a5986..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 306 zcmYjKF;2rk5Zt|-6N5;KynqVH6kJ7z5JE(vfk<(nu!O8|ca{x~&$_cCLCZ(tl8592 zl-E-61uE9iu+q-%j7BqNJl+SI2fxcc=zjL(|8OD~w5|sQ3QI`(%Sv2=hAniEFg-}P z8YF>c+o9$<$XJI6dPF=_yu&wQ3S)?ZFG_*i2t6JbherSfP(ifkht9}n-FTk0mGtQR z^k#l_c^9YgY;iwZq}TI!>3MD(S!!b&Ka!@Zv}}A(+oB@XYPop_dqDZW@O>(Bv({o| zi&s;vL~YFz`JHeZmo{4FVr|r8+yAZ+fAuHzix1C8Z%ciSl;kD^A%rYs963(d6n_Ag CZBLN^ diff --git a/client.py b/client.py index 86830d5..bf9c663 100644 --- a/client.py +++ b/client.py @@ -17,16 +17,16 @@ client.connect() # get_coordinates() # get_or_set_speed(10) -all_files = glob.glob("data/*.NC.result") +all_files = glob.glob("data/data.txt") file = all_files[0] data = [] with open(file, "r") as fp: lines = fp.readlines() for l in lines: r = l.strip().split(",") - r[1] = int(float(r[1]) * 1000) - r[2] = int(float(r[2]) * 1000) - r[3] = int(float(r[3]) * 1000) + r[1] = float(r[1]) + r[2] = float(r[2]) + r[3] = float(r[3]) data.append(r) @@ -44,16 +44,6 @@ try: counter = 0 paths = data - paths = [ - ("line", 0, 0, 277.8, 0, 5, 0), - # ("line", 30, 30, 0, 0, 0, 0), - # ("line", 30, -30, 0, 0, 0, 0), - # ("line", 0, 0, 0, 0, 0, 5), - # ("line", -30, -30, 0, 0, 0, 0), - # ("line", -30, 30, 0, 0, 0, 0), - # ("line", 0, 0, 0, 0, -5, -5), - # ("line", 0, 0, 30, 0, 0, 0), - ] bulb(GOTO_Y, False, client) get_or_set_speed(10, client) @@ -93,7 +83,7 @@ try: if step >= len(paths): # counter += 1 # step = 0 - stop_immediately(client) + # stop_immediately(client) exit() current_step = paths[step] diff --git a/data/data.txt b/data/data.txt new file mode 100644 index 0000000..309bdc3 --- /dev/null +++ b/data/data.txt @@ -0,0 +1,2 @@ +line,0,0,277.8,0,0,0 +line,0,-50,50,0,0,0 \ No newline at end of file diff --git a/func.py b/func.py index f6c13d8..0d4099c 100644 --- a/func.py +++ b/func.py @@ -94,7 +94,6 @@ def set_user_register(n, values, client): def to_double(integr): - print(integr) return [(integr >> 16) & 0xFFFF, integr & 0xFFFF] @@ -110,4 +109,4 @@ def start_in_auto(client): def stop_immediately(client): - client.write_register(20001, 1, MODBUS_SLAVE_ID) \ No newline at end of file + client.write_register(20004, 1, MODBUS_SLAVE_ID) \ No newline at end of file