modbus_test/.vscode/PythonImportHelper-v2-Compl...

416 lines
19 KiB
JSON

[
{
"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": {}
}
]