{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 环境设置\n", "1. 输出电压设置58V\n", "2. 输入源设置光伏模式, Vmppt=42V, Power=650W\n", "3. 初始化设备;" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import time\n", "from pathlib import Path\n", "from device.LaminaAdapter import LaminaAdapter\n", "from device.LaminaAdapter import GeneratePackage_SLCP001_p4a0, GeneratePackage_SLCP101_p460, GeneratePackage_DLSY001_p460\n", "from device.LaminaAdapter import GeneratePackage_SLCP102_p460\n", "from device.tools.ByteConv import trans_list_to_str, trans_str_to_list" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "mode_config = {\n", " \"Log\": {'com_name': None, \n", " # 'addr_645': [0x01, 0x00, 0x00, 0x00, 0x00, 0x40], \n", " },\n", " \"Debug\": {'com_name': 'COM3', 'baudrate': 115200, 'parity': 'N', 'bytesize': 8, 'stopbits': 1,\n", " # 'addr_645': [0x01, 0x02, 0x03, 0x04, 0x05, 0x06], \n", " 'frame_print': True, \n", " 'time_out': 0.5, 'retry': 1, 'retry_sub': 10},\n", " \"HPLC\": {'com_name': 'COM9', 'baudrate': 9600, 'parity': 'E', 'bytesize': 8, 'stopbits': 1,\n", " 'addr_645': trans_str_to_list(\"02 01 00 00 24 20\"), \n", " 'frame_print': True, \n", " 'time_out': 3, 'time_gap': 0.1, 'retry': 3, 'retry_sub': 10},\n", "}\n", "\n", "dev_lamina = LaminaAdapter(type_dev=\"SLCP101\", **mode_config['Debug'])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def test_communication(time_out=2):\n", " \"\"\" 通信成功率测试 \"\"\"\n", " time_start = time.time()\n", " param_saved = dev_lamina.flag_print, dev_lamina.retry, dev_lamina.time_out\n", " dev_lamina.flag_print = False\n", " dev_lamina.retry = 1\n", " try:\n", " while True:\n", " dev_lamina.frame_read(0x0C, 0x20)\n", " print(f\"Time Stamp: {time.ctime()}\")\n", " print(f\"Success Frame: {dev_lamina.log['read']}\")\n", " print(f\"Failed Frame: {dev_lamina.log['send'] - dev_lamina.log['read']}\")\n", " print(f\"Max Series Failed Frame: {dev_lamina.log['keep-fail']}\")\n", " time.sleep(time_out)\n", " finally:\n", " time_end = time.time()\n", " print(\"Test Result: \")\n", " print(f\"Time Start: {time.strftime(r'%Y-%m-%d %H:%M:%S', time.localtime(time_start))}, \\tTime End: {time.strftime(r'%Y-%m-%d %H:%M:%S', time.localtime(time_end))}\")\n", " print(f\"Time Elapsed: {time_end - time_start}\")\n", " print(f\"Success Rate: {dev_lamina.log['read'] / dev_lamina.log['send'] * 100}%\")\n", " dev_lamina.flag_print, dev_lamina.retry, dev_lamina.time_out = param_saved" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 01 00 00 20 45 EE 4B 16\n", "Read Frame: 68 01 02 03 04 05 06 68 9F 45 01 03 40 48 46 45 43 30 30 5F 31 34 32 31 31 37 30 31 5F 30 37 5F 30 33 56 30 2E 00 31 00 00 00 00 00 00 48 46 45 43 30 30 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BF A8 EE 16\n", "Parse Result:\n", "0x0100: FHCE001_241107_1700_V3.01\u0000\u0000\u0000\u0000\u0000\u0000\u0000 版本(ODM)\n", "0x0110: FHCE001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 型号 \n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x0100, 0x20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 设备升级" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 单次升级" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Package generated successfully.\n", "File name: lamina_adapter.hex\n", "File Info:\n", "\t header_length=184, bin_length=127750[0x1f306]\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "File Transmitting: 100%|██████████| 592/592 [00:27<00:00, 21.20it/s]\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# 工程-即时转换\n", "if dev_lamina.device == 'SLCP001':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V1\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'SLCP101':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V2.03\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'SLCP102':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V3.01\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'DLSY001':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackOptimizer\\software\\lamina_optimizer\\lamina_optimizer\\Debug\\lamina_optimizer.hex\")\n", "else:\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "if not file_hex.exists():\n", " raise Exception(\"工程编译目标文件不存在.\")\n", "\n", "dev_lamina.frame_update(file_hex, makefile=True)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 连续升级" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 工程-即时转换\n", "if dev_lamina.device == 'SLCP001':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V1\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'SLCP101':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V2.03\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'SLCP102':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\release\\device_V3.01\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "elif dev_lamina.device == 'DLSY001':\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackOptimizer\\software\\lamina_optimizer\\lamina_optimizer\\Debug\\lamina_optimizer.hex\")\n", "else:\n", " file_hex = Path(r\"D:\\WorkingProject\\LightStackAdapter\\software\\lamina_adapter\\lamina_adapter\\Debug\\lamina_adapter.hex\")\n", "if not file_hex.exists():\n", " raise Exception(\"工程编译目标文件不存在.\")\n", "print(dev_lamina.device)\n", "print(file_hex)\n", "\n", "# 设置升级配置\n", "version = \"SLCP101_241030_2000_V2.03\"\n", "addr = [0x24, 0x09, 0x12, 0x00, 0x00, 0x00]\n", "dev_lamina.flag_print = False" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "while True:\n", " \"\"\" 自动检测升级流程 \"\"\"\n", " ret = False\n", " while not (ret and ('Regs' in dev_lamina.output.keys()) and \n", " (version == dev_lamina.output['Regs'][0x0100][1].strip('\\000'))):\n", " # dev_lamina.frame_read(0x82, 3)\n", " ret = dev_lamina.frame_read(0x0100, 0x20)\n", " time.sleep(1)\n", "\n", " dev_lamina.frame_update(file_hex, makefile=True)\n", "\n", " time.sleep(3)\n", "\n", " ret = dev_lamina.frame_read(0x0100, 0x20)\n", "\n", " if ret and (version == dev_lamina.output['Regs'][0x0100][1]):\n", " dev_lamina.frame_write_one(0x52, 0x01)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 参数还原" ] }, { "cell_type": "code", "execution_count": 166, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 52 00 01 E9 DB 11 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 08 01 06 00 52 00 01 E9 DB 91 16\n", "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 53 00 01 B8 1B 21 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 08 01 06 00 53 00 01 B8 1B A1 16\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 166, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_write_one(0x52, 0x01)\n", "time.sleep(4.5)\n", "dev_lamina.frame_write_one(0x53, 0x01)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 读取设备状态" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 60 00 60 45 FC F8 16\n", "Read Frame: 68 01 02 03 04 05 06 68 9F C5 01 03 C0 00 00 00 79 02 62 00 5A 02 6C 00 64 02 1C 01 CC 02 3A 01 A4 02 44 02 94 02 58 01 B8 09 60 07 D0 00 0A 08 98 02 3A 02 35 02 21 04 1A 03 B6 03 52 01 5E 02 30 AE 60 00 0A 03 E8 00 00 EB 10 00 09 EB 10 00 09 05 06 03 04 01 02 09 C4 FE 0C 00 64 00 00 00 64 00 0D 03 96 00 96 C3 50 00 00 00 C8 00 00 00 FA 00 00 00 14 00 00 00 02 00 00 03 E8 00 00 03 E8 00 00 03 E8 00 00 03 E8 00 00 03 E8 00 00 00 00 00 00 00 00 03 E8 37 E2 2D BE 02 23 00 00 0C AD 03 FF FF FF FF FF FF FF FF FF FF FF 4C 53 50 43 30 31 5F 32 34 32 31 31 37 30 31 5F 30 37 5F 30 33 56 30 2E 00 31 00 00 00 00 00 00 99 46 20 16\n", "Parse Result:\n", "0x0060: 0x0000 光伏通道使能 \n", "0x0061: 12.1 最小启动输入电压 \n", "0x0062: 61.0 最大启动输入电压 \n", "0x0063: 9.0 最小停止输入电压 \n", "0x0064: 62.0 最大停止输入电压 \n", "0x0065: 10.0 最小MPPT电压 \n", "0x0066: 54.0 最大MPPT电压 \n", "0x0067: 46.0 最小启动输出电压 \n", "0x0068: 57.0 最大启动输出电压 \n", "0x0069: 42.0 最小停止输出电压 \n", "0x006A: 58.0 最大停止输出电压 \n", "0x006B: 66.0 输入过压保护值 \n", "0x006C: 60.0 输出过压保护值 \n", "0x006D: 44.0 输出欠压保护值 \n", "0x006E: 24.0 电感过流保护值 \n", "0x006F: 20.0 输入过流保护值 \n", "0x0070: 0.1 最小电感电流限值 \n", "0x0071: 22.0 最大电感电流限值 \n", "0x0072: 57.0 浮充电压阈值 \n", "0x0073: 56.5 三点法中间阈值 \n", "0x0074: 54.5 恒压充电电压 \n", "0x0075: 105.0 过温故障值 \n", "0x0076: 95.0 过温告警值 \n", "0x0077: 85.0 温度恢复值 \n", "0x0078: 35.0 最低满载电压 \n", "0x0079: 56.0 最高满载电压 \n", "0x007A: 700.0 输入过载保护值 \n", "0x007C: 1.0 最小功率限值 \n", "0x007E: 650.0 最大功率限值 \n", "0x0080: 650.0 最大功率限值存储值 \n", "0x0082: 06 05 04 03 02 01 载波通信地址 \n", "0x0085: 25.0 电压环out_max \n", "0x0086: -5.0 电压环out_min \n", "0x0087: 1.0 电流环out_max \n", "0x0088: 0.0 电流环out_min \n", "0x0089: 1.0 MPPT扰动系数k_d_vin \n", "0x008A: 0.013 dmin \n", "0x008B: 0.918 dmax \n", "0x008C: 15.0 扫描电压偏移scanvolt_offset\n", "0x008D: 0.5 电压环Kp \n", "0x008F: 0.002 电压环Ki \n", "0x0091: 0.0025 电流环Kp \n", "0x0093: 0.0002 电流环Ki \n", "0x0095: 0x0002 日志级别 \n", "0x0096: 0x0000 日志输出方式 \n", "0x0097: 1.0 采样校准volt_in_a \n", "0x0098: 0.0 采样校准volt_in_b \n", "0x0099: 1.0 采样校准volt_out_a \n", "0x009A: 0.0 采样校准volt_out_b \n", "0x009B: 1.0 采样校准curr_in_a \n", "0x009C: 0.0 采样校准curr_in_b \n", "0x009D: 1.0 采样校准curr_induc_a \n", "0x009E: 0.0 采样校准curr_induc_b \n", "0x009F: 1.0 采样校准volt_12V_a \n", "0x00A0: 0.0 采样校准volt_12V_b \n", "0x00A1: 0.0 温度补偿temp1_b \n", "0x00A2: 0.0 温度补偿temp2_b \n", "0x00A3: 0 系统工作模式 \n", "0x00A4: 10.0 电感电流给定值curr_set \n", "0x00A5: 143.06 抖动频率上限 \n", "0x00A6: 117.1 抖动频率下限 \n", "0x00A7: 54.7 电池电压判断限值 \n", "0x00A8: 0x0000 MPPT追踪模式 \n", "0x00A9: 3.245 ADC参考电压 \n", "0x00AA: 0x03FF 保留 \n", "0x00AB: 0xFFFF 保留 \n", "0x00AC: 0xFFFF 保留 \n", "0x00AD: 0xFFFF 保留 \n", "0x00AE: 0xFFFF 保留 \n", "0x00AF: 0xFFFF 保留 \n", "0x00B0: SLCP102_241107_1700_V3.01\u0000\u0000\u0000\u0000\u0000\u0000\u0000 版本 \n", "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Read Frame: 68 01 02 03 04 05 06 68 9F 2D 01 03 28 20 30 00 00 00 00 00 04 00 00 00 73 00 05 00 40 00 10 00 05 00 5E 01 27 00 00 00 00 01 27 00 00 02 1C AE 60 00 0A 02 35 5B E2 56 16\n", "Parse Result:\n", "0x000E: 0x2030 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0004 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 11.5 输入电压 \n", "0x0014: 0.05 电感电流 \n", "0x0015: 6.4 12V电压 \n", "0x0016: 1.6 输出电压 \n", "0x0017: 0.05 输入电流 \n", "0x0018: 9.4 温度1 \n", "0x0019: 29.5 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 29.5 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x60, 0x60)\n", "time.sleep(0.5)\n", "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "code", "execution_count": 164, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.0 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.0 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:44:58 2024\n", "Success Frame: 4\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.0 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.0 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:00 2024\n", "Success Frame: 5\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.0 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.0 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:02 2024\n", "Success Frame: 6\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.0 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.0 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:04 2024\n", "Success Frame: 7\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.0 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.0 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:06 2024\n", "Success Frame: 8\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 20.9 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:08 2024\n", "Success Frame: 9\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:10 2024\n", "Success Frame: 10\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:12 2024\n", "Success Frame: 11\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:14 2024\n", "Success Frame: 12\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:16 2024\n", "Success Frame: 13\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:18 2024\n", "Success Frame: 14\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.1 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.1 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:20 2024\n", "Success Frame: 15\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:22 2024\n", "Success Frame: 16\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:24 2024\n", "Success Frame: 17\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0000 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 5.6 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:26 2024\n", "Success Frame: 18\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0001 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 41.2 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 57.2 输出电压 \n", "0x0017: 0.01 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:28 2024\n", "Success Frame: 19\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0002 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 58.5 输入电压 \n", "0x0014: 4.55 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.0 输出电压 \n", "0x0017: 4.53 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 265.005 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:30 2024\n", "Success Frame: 20\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.78 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.26 输入电流 \n", "0x0018: 21.0 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 553.014 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:32 2024\n", "Success Frame: 21\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.79 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.27 输入电流 \n", "0x0018: 21.1 温度1 \n", "0x0019: 22.2 温度2 \n", "0x001A: 553.553 输入功率 \n", "0x001C: 22.2 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:34 2024\n", "Success Frame: 22\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.79 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.27 输入电流 \n", "0x0018: 21.2 温度1 \n", "0x0019: 22.3 温度2 \n", "0x001A: 553.553 输入功率 \n", "0x001C: 22.3 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:37 2024\n", "Success Frame: 23\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.8 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.28 输入电流 \n", "0x0018: 21.3 温度1 \n", "0x0019: 22.3 温度2 \n", "0x001A: 554.092 输入功率 \n", "0x001C: 22.3 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:39 2024\n", "Success Frame: 24\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.8 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.28 输入电流 \n", "0x0018: 21.5 温度1 \n", "0x0019: 22.3 温度2 \n", "0x001A: 554.092 输入功率 \n", "0x001C: 22.3 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:41 2024\n", "Success Frame: 25\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Parse Result:\n", "0x000C: 0xFFFF 未知数据 \n", "0x000D: 0xFFFF 未知数据 \n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 53.9 输入电压 \n", "0x0014: 10.81 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.3 输出电压 \n", "0x0017: 10.29 输入电流 \n", "0x0018: 21.6 温度1 \n", "0x0019: 22.4 温度2 \n", "0x001A: 554.631 输入功率 \n", "0x001C: 22.4 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n", "Time Stamp: Mon Dec 16 15:45:43 2024\n", "Success Frame: 26\n", "Failed Frame: 0\n", "Max Series Failed Frame: 0\n", "Test Result: \n", "Time Start: 2024-12-16 15:44:58, \tTime End: 2024-12-16 15:45:45\n", "Time Elapsed: 47.00012421607971\n", "Success Rate: 100.0%\n" ] }, { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[164], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mtest_communication\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "Cell \u001b[1;32mIn[163], line 14\u001b[0m, in \u001b[0;36mtest_communication\u001b[1;34m(time_out)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFailed Frame: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdev_lamina\u001b[38;5;241m.\u001b[39mlog[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msend\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;250m \u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;250m \u001b[39mdev_lamina\u001b[38;5;241m.\u001b[39mlog[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mread\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 13\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMax Series Failed Frame: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdev_lamina\u001b[38;5;241m.\u001b[39mlog[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mkeep-fail\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m---> 14\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(time_out)\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m 16\u001b[0m time_end \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mtime()\n", "\u001b[1;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "test_communication()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 解除限功率限制\n", "1. 设置输出限功率阈值电压为60V\n", "2. 输出电压停机阈值上升至58.5V\n", "3. 输出电压启机阈值上升至58V" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 21 02 58 D9 5A A8 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 08 01 06 00 21 02 58 D9 5A 28 16\n", "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 6A 02 49 69 40 58 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 08 01 06 00 6A 02 49 69 40 D8 16\n", "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 68 02 44 09 45 F6 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 08 01 06 00 68 02 44 09 45 76 16\n" ] } ], "source": [ "# 解除限功率限制\n", "dev_lamina.frame_write_one(0x21, 600)\n", "time.sleep(0.5)\n", "# 接触输出电压停机限制\n", "dev_lamina.frame_write_one(0x6A, 585)\n", "time.sleep(0.5)\n", "# 修改输出电压启机限制\n", "dev_lamina.frame_write_one(0x68, 580)\n", "time.sleep(0.5)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Error Info: No frame data\n" ] }, { "data": { "text/plain": [ "False" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "code", "execution_count": 104, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 2D 01 03 28 00 00 00 00 00 03 00 03 00 00 01 B1 06 A1 00 6F 02 49 05 D2 01 05 00 D5 D8 32 00 09 01 05 00 01 02 1C AE 60 00 0A 02 58 76 3F EE 16\n", "Parse Result:\n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 43.3 输入电压 \n", "0x0014: 16.97 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.5 输出电压 \n", "0x0017: 14.9 输入电流 \n", "0x0018: 26.1 温度1 \n", "0x0019: 21.3 温度2 \n", "0x001A: 645.17 输入功率 \n", "0x001C: 26.1 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 60.0 输出限功率电压阈值\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "code", "execution_count": 156, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 2D 01 03 28 00 00 00 00 00 03 00 03 00 00 01 A7 06 D7 00 6F 02 49 05 FD 01 27 00 E6 E5 0B 00 09 01 27 00 01 02 1C AE 60 00 0A 02 58 4F 90 AA 16\n", "Parse Result:\n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 42.3 输入电压 \n", "0x0014: 17.51 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.5 输出电压 \n", "0x0017: 15.33 输入电流 \n", "0x0018: 29.5 温度1 \n", "0x0019: 23.0 温度2 \n", "0x001A: 648.459 输入功率 \n", "0x001C: 29.5 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 60.0 输出限功率电压阈值\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 156, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "code", "execution_count": 157, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Read Frame: 68 16 95 11 16 06 24 68 9F 2D 01 03 28 00 00 00 00 00 03 00 03 00 00 01 A7 06 D8 00 6F 02 49 05 FD 01 2B 00 E8 E5 0B 00 09 01 2B 00 01 02 1C AE 60 00 0A 02 58 07 E9 C6 16\n", "Parse Result:\n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0003 MPPT工作状态 \n", "0x0011: 0x0003 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 42.3 输入电压 \n", "0x0014: 17.52 电感电流 \n", "0x0015: 11.1 12V电压 \n", "0x0016: 58.5 输出电压 \n", "0x0017: 15.33 输入电流 \n", "0x0018: 29.9 温度1 \n", "0x0019: 23.2 温度2 \n", "0x001A: 648.459 输入功率 \n", "0x001C: 29.9 设备温度 \n", "0x001D: 0x0001 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 60.0 输出限功率电压阈值\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 157, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 运行效果\n", "1. 设备以650W功率正常运行\n", "2. 输出电压采样结果上升至58.5V" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 50 00 00 89 DB AE 16\n", "Read Frame: 68 88 88 88 88 89 22 68 9F 08 01 06 00 50 00 00 89 DB FD 16\n", "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 00 0E 00 20 25 D1 1B 16\n", "Read Frame: 68 88 88 88 88 89 22 68 9F 2D 01 03 28 00 00 00 00 00 01 00 00 00 00 02 0D 00 00 00 72 02 17 00 00 01 1A 01 00 00 00 00 00 01 1A 00 00 02 1C AE 60 00 0A 02 35 06 1D F5 16\n", "Parse Result:\n", "0x000E: 0x0000 故障字1 \n", "0x000F: 0x0000 故障字2 \n", "0x0010: 0x0001 MPPT工作状态 \n", "0x0011: 0x0000 系统工作状态 \n", "0x0012: 0x0000 系统工作模式 \n", "0x0013: 52.5 输入电压 \n", "0x0014: 0.0 电感电流 \n", "0x0015: 11.4 12V电压 \n", "0x0016: 53.5 输出电压 \n", "0x0017: 0.0 输入电流 \n", "0x0018: 28.2 温度1 \n", "0x0019: 25.6 温度2 \n", "0x001A: 0.0 输入功率 \n", "0x001C: 28.2 设备温度 \n", "0x001D: 0x0000 开关机状态 \n", "0x001E: 54.0 电池电压 \n", "0x001F: 700.0 并机功率限值 \n", "0x0021: 56.5 输出限功率电压阈值\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_write_one(0x50, 0)\n", "time.sleep(1.5)\n", "dev_lamina.frame_read(0x0E, 0x20)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 01 A0 00 60 44 3C 78 16\n", "Read Frame: 68 88 88 88 88 89 22 68 9F C5 01 03 C0 02 A2 01 00 01 09 14 50 6F 77 65 72 20 66 61 73 74 20 72 65 6C 65 61 73 65 2E 00 00 00 00 00 00 5C 9B 01 00 01 08 0D 53 79 73 20 70 72 65 72 52 75 6E 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 92 9A 01 00 01 07 0D 53 79 73 20 73 74 61 72 74 75 70 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 92 01 00 02 06 08 41 00 00 00 00 0E 02 19 02 00 00 00 00 58 1B 00 00 46 61 75 6C 74 20 52 65 0E 0A 01 00 02 05 08 21 01 00 00 00 5C 02 58 02 00 00 00 00 58 1B 01 00 46 61 75 6C 74 20 54 72 0E 0A 01 00 01 04 0D 53 79 73 20 73 74 61 72 74 75 70 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 D9 6B 77 16\n", "Parse Result:\n", "0x01A0: Event: 1\n", "\ttime: 107010\n", "\tnumber: 9\n", "\tData: Power fast release.\n", " 事件记录1\n", "0x01B0: Event: 1\n", "\ttime: 105308\n", "\tnumber: 8\n", "\tData: Sys prerRun.\n", " 事件记录2\n", "0x01C0: Event: 1\n", "\ttime: 105106\n", "\tnumber: 7\n", "\tData: Sys startup.\n", " 事件记录3\n", "0x01D0: Event: 2\n", "\ttime: 103104\n", "\tnumber: 6\n", "\tData: Fault Re\n", "\t\tstatus: 41\n", "\t\tflag_fault: 0\n", "\t\tflag_alarm: 0\n", "\t\tvolt_in: 52.6\n", "\t\tvolt_out: 53.7\n", "\t\tcurr_in: 0.0\n", "\t\tcurr_induc: 0.0\n", "\t\tcbox_power_limit: 700.0\n", "\t\tflag_control: 0\n", " 事件记录4\n", "0x01E0: Event: 2\n", "\ttime: 68110\n", "\tnumber: 5\n", "\tData: Fault Tr\n", "\t\tstatus: 21\n", "\t\tflag_fault: 1\n", "\t\tflag_alarm: 0\n", "\t\tvolt_in: 60.4\n", "\t\tvolt_out: 60.0\n", "\t\tcurr_in: 0.0\n", "\t\tcurr_induc: 0.0\n", "\t\tcbox_power_limit: 700.0\n", "\t\tflag_control: 1\n", " 事件记录5\n", "0x01F0: Event: 1\n", "\ttime: 68110\n", "\tnumber: 4\n", "\tData: Sys startup.\n", " 事件记录6\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_read(0x1A0, 0x60)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 06 00 6F 09 56 3F B9 C0 16\n", "Read Frame: 68 88 88 88 88 89 22 68 9F 08 01 06 00 6F 09 56 3F B9 0F 16\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_write_one(0x6F, 2390)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 08 01 03 01 00 00 20 45 EE 4B 16\n", "Error Info: No frame data\n" ] }, { "data": { "text/plain": [ "False" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.close_connection()\n", "time.sleep(0.5)\n", "dev_lamina.open_connection()\n", "dev_lamina.frame_read(0x100, 0x20)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Send Frame: 68 AA AA AA AA AA AA 68 1F 0F 01 10 00 82 00 03 06 05 06 03 04 01 02 09 23 D7 16\n", "Read Frame: 68 01 02 03 04 05 06 68 9F 08 01 10 00 82 00 03 20 20 62 16\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dev_lamina.frame_write_str()" ] } ], "metadata": { "kernelspec": { "display_name": "test", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 2 }