From 8c68e2a4b0de1e708b06b2107b5219e5213b9578 Mon Sep 17 00:00:00 2001 From: lixiaoyuan Date: Fri, 6 Feb 2026 14:29:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=B0=E5=8C=BA=E7=94=B5?= =?UTF-8?q?=E8=A1=A8=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/config-online/regaddrs.json | 9 ---- .../assets/config-online/regaddrsShow.json | 46 ++++++++++------- bin/Release/assets/config/regaddrs.json | 2 + bin/Release/assets/config/regaddrsShow.json | 50 +++++++++++-------- src/app/Station.cpp | 6 ++- src/protocol/HttpEntity.cpp | 14 +++++- web/src/views/monitor.vue | 12 ++--- 7 files changed, 82 insertions(+), 57 deletions(-) diff --git a/bin/Release/assets/config-online/regaddrs.json b/bin/Release/assets/config-online/regaddrs.json index 152d71e..513eb9e 100644 --- a/bin/Release/assets/config-online/regaddrs.json +++ b/bin/Release/assets/config-online/regaddrs.json @@ -899,14 +899,5 @@ {"key": "27", "datatype": "uint16", "alert": 0, "name":"枪2:输出功率", "remark": ""}, {"key": "28", "datatype": "uint16", "alert": 0, "name":"枪2:功率限值", "remark": ""} ] - }, - "TD_YC": { - "addr": [ - {"key": "U", "datatype": "array", "alert": 0, "name":"A,B,C相电压", "remark": ""}, - {"key": "I", "datatype": "array", "alert": 0, "name":"A,B,C相电流", "remark": ""}, - {"key": "P", "datatype": "array", "alert": 0, "name":"总,A,B,C相功率", "remark": ""}, - {"key": "Ep", "datatype": "array", "alert": 0, "name":"正向总、尖、峰、平、谷电能", "remark": ""}, - {"key": "En", "datatype": "array", "alert": 0, "name":"反向总、尖、峰、平、谷电能", "remark": ""}, - ] } } \ No newline at end of file diff --git a/bin/Release/assets/config-online/regaddrsShow.json b/bin/Release/assets/config-online/regaddrsShow.json index 80443bc..4285783 100644 --- a/bin/Release/assets/config-online/regaddrsShow.json +++ b/bin/Release/assets/config-online/regaddrsShow.json @@ -88,7 +88,7 @@ ["单体最大温度", "0x0029", "0.0", " ℃", "0.1"], ["单体最小温度", "0x002C", "0.0", " ℃", "0.1"] ], - "addrCurve": ["0x0003", "0x0005", ""], + "addrCurve": ["0x0003", "0x0005", "0x000F"], "valstr": { "0x004A": {"0":"待机","1":"充电","2":"放电"} } @@ -128,25 +128,25 @@ ["日收益", "0x0037", "0", " 元"], ["总收益", "0x0055", "0", " 元"], ["日正向尖电能", "0x0039", "0", " kWh"], - ["日正向峰电能", "0x003B", "0", " kWh"], - ["日正向平电能", "0x003D", "0", " kWh"], - ["日正向谷电能", "0x003F", "0", " kWh"], - ["日正向总电能", "0x0041", "0", " kWh"], ["日反向尖电能", "0x0043", "0", " kWh"], + ["日正向峰电能", "0x003B", "0", " kWh"], ["日反向峰电能", "0x0045", "0", " kWh"], + ["日正向平电能", "0x003D", "0", " kWh"], ["日反向平电能", "0x0047", "0", " kWh"], + ["日正向谷电能", "0x003F", "0", " kWh"], ["日反向谷电能", "0x0049", "0", " kWh"], + ["日正向总电能", "0x0041", "0", " kWh"], ["日反向总电能", "0x004B", "0", " kWh"], ["总正向尖电能", "0x0057", "0", " kWh"], - ["总正向峰电能", "0x0059", "0", " kWh"], - ["总正向平电能", "0x005B", "0", " kWh"], - ["总正向谷电能", "0x005D", "0", " kWh"], - ["总正向总电能", "0x005F", "0", " kWh"], ["总反向尖电能", "0x0061", "0", " kWh"], + ["总正向峰电能", "0x0059", "0", " kWh"], ["总反向峰电能", "0x0063", "0", " kWh"], + ["总正向平电能", "0x005B", "0", " kWh"], ["总反向平电能", "0x0065", "0", " kWh"], + ["总正向谷电能", "0x005D", "0", " kWh"], ["总反向谷电能", "0x0067", "0", " kWh"], - ["总反向总电能", "0x0069", "0", " kWh"], + ["总正向总电能", "0x005F", "0", " kWh"], + ["总反向总电能", "0x0069", "0", " kWh"], ["A相电压", "0x000B", "0.0", " V"], ["A相电流", "0x0011", "0.0", " A"], ["B相电压", "0x000D", "0.0", " V"], @@ -207,14 +207,24 @@ ["C相功率", "P4", "0", " kW", "1"], ["正向总电能", "Ep1", "0", " kWh", "1"], ["反向总电能", "En1", "0", " kWh", "1"], - ["正向尖总电能", "Ep2", "0", " kWh", "1"], - ["反向尖总电能", "En2", "0", " kWh", "1"], - ["正向峰总电能", "Ep3", "0", " kWh", "1"], - ["反向峰总电能", "En3", "0", " kWh", "1"], - ["正向平总电能", "Ep4", "0", " kWh", "1"], - ["反向平总电能", "En4", "0", " kWh", "1"], - ["正向谷总电能", "Ep5", "0", " kWh", "1"], - ["反向谷总电能", "En5", "0", " kWh", "1"] + ["正向尖电能", "Ep2", "0", " kWh", "1"], + ["反向尖电能", "En2", "0", " kWh", "1"], + ["正向峰电能", "Ep3", "0", " kWh", "1"], + ["反向峰电能", "En3", "0", " kWh", "1"], + ["正向平电能", "Ep4", "0", " kWh", "1"], + ["反向平电能", "En4", "0", " kWh", "1"], + ["正向谷电能", "Ep5", "0", " kWh", "1"], + ["反向谷电能", "En5", "0", " kWh", "1"], + ["日正向总电能", "EpTo1", "0", " kWh", "1"], + ["日反向总电能", "EnTo1", "0", " kWh", "1"], + ["日正向尖电能", "EpTo2", "0", " kWh", "1"], + ["日反向尖电能", "EnTo2", "0", " kWh", "1"], + ["日正向峰电能", "EpTo3", "0", " kWh", "1"], + ["日反向峰电能", "EnTo3", "0", " kWh", "1"], + ["日正向平电能", "EpTo4", "0", " kWh", "1"], + ["日反向平电能", "EnTo4", "0", " kWh", "1"], + ["日正向谷电能", "EpTo5", "0", " kWh", "1"], + ["日反向谷电能", "EnTo5", "0", " kWh", "1"] ] } } \ No newline at end of file diff --git a/bin/Release/assets/config/regaddrs.json b/bin/Release/assets/config/regaddrs.json index 152d71e..4896a12 100644 --- a/bin/Release/assets/config/regaddrs.json +++ b/bin/Release/assets/config/regaddrs.json @@ -907,6 +907,8 @@ {"key": "P", "datatype": "array", "alert": 0, "name":"总,A,B,C相功率", "remark": ""}, {"key": "Ep", "datatype": "array", "alert": 0, "name":"正向总、尖、峰、平、谷电能", "remark": ""}, {"key": "En", "datatype": "array", "alert": 0, "name":"反向总、尖、峰、平、谷电能", "remark": ""}, + {"key": "EpTo", "datatype": "array", "alert": 0, "name":"当日正向总、尖、峰、平、谷电能", "remark": ""}, + {"key": "EnTo", "datatype": "array", "alert": 0, "name":"当日反向总、尖、峰、平、谷电能", "remark": ""} ] } } \ No newline at end of file diff --git a/bin/Release/assets/config/regaddrsShow.json b/bin/Release/assets/config/regaddrsShow.json index 558c1fe..5d967e5 100644 --- a/bin/Release/assets/config/regaddrsShow.json +++ b/bin/Release/assets/config/regaddrsShow.json @@ -58,14 +58,14 @@ "addrYC":[ ["电网状态", "0x1007", "--", ""], ["启停状态", "0x1006", "--", ""], - ["手动/自动状态", "0x103D", "--", ""], ["A相电压", "0x0013", "0.0", " V", "1"], ["A相电流", "0x001C", "0.0", " A"], ["B相电压", "0x0014", "0.0", " V", "1"], ["B相电流", "0x001D", "0.0", " A"], ["C相电压", "0x0015", "0.0", " V", "1"], ["C相电流", "0x001E", "0.0", " A"], - ["总有功功率", "0x0028", "0.0", " kW"] + ["总有功功率", "0x0028", "0.0", " kW"], + ["手动/自动状态", "0x103D", "--", ""] ], "addrCurve": ["0x0013", "0x001C", "0x0028"], "valstr": { @@ -88,7 +88,7 @@ ["单体最大温度", "0x0029", "0.0", " ℃", "0.1"], ["单体最小温度", "0x002C", "0.0", " ℃", "0.1"] ], - "addrCurve": ["0x0003", "0x0005", ""], + "addrCurve": ["0x0003", "0x0005", "0x000F"], "valstr": { "0x004A": {"0":"待机","1":"充电","2":"放电"} } @@ -128,25 +128,25 @@ ["日收益", "0x0037", "0", " 元"], ["总收益", "0x0055", "0", " 元"], ["日正向尖电能", "0x0039", "0", " kWh"], - ["日正向峰电能", "0x003B", "0", " kWh"], - ["日正向平电能", "0x003D", "0", " kWh"], - ["日正向谷电能", "0x003F", "0", " kWh"], - ["日正向总电能", "0x0041", "0", " kWh"], ["日反向尖电能", "0x0043", "0", " kWh"], + ["日正向峰电能", "0x003B", "0", " kWh"], ["日反向峰电能", "0x0045", "0", " kWh"], + ["日正向平电能", "0x003D", "0", " kWh"], ["日反向平电能", "0x0047", "0", " kWh"], + ["日正向谷电能", "0x003F", "0", " kWh"], ["日反向谷电能", "0x0049", "0", " kWh"], + ["日正向总电能", "0x0041", "0", " kWh"], ["日反向总电能", "0x004B", "0", " kWh"], ["总正向尖电能", "0x0057", "0", " kWh"], - ["总正向峰电能", "0x0059", "0", " kWh"], - ["总正向平电能", "0x005B", "0", " kWh"], - ["总正向谷电能", "0x005D", "0", " kWh"], - ["总正向总电能", "0x005F", "0", " kWh"], ["总反向尖电能", "0x0061", "0", " kWh"], + ["总正向峰电能", "0x0059", "0", " kWh"], ["总反向峰电能", "0x0063", "0", " kWh"], + ["总正向平电能", "0x005B", "0", " kWh"], ["总反向平电能", "0x0065", "0", " kWh"], + ["总正向谷电能", "0x005D", "0", " kWh"], ["总反向谷电能", "0x0067", "0", " kWh"], - ["总反向总电能", "0x0069", "0", " kWh"], + ["总正向总电能", "0x005F", "0", " kWh"], + ["总反向总电能", "0x0069", "0", " kWh"], ["A相电压", "0x000B", "0.0", " V"], ["A相电流", "0x0011", "0.0", " A"], ["B相电压", "0x000D", "0.0", " V"], @@ -207,14 +207,24 @@ ["C相功率", "P4", "0", " kW", "1"], ["正向总电能", "Ep1", "0", " kWh", "1"], ["反向总电能", "En1", "0", " kWh", "1"], - ["正向尖总电能", "Ep2", "0", " kWh", "1"], - ["反向尖总电能", "En2", "0", " kWh", "1"], - ["正向峰总电能", "Ep3", "0", " kWh", "1"], - ["反向峰总电能", "En3", "0", " kWh", "1"], - ["正向平总电能", "Ep4", "0", " kWh", "1"], - ["反向平总电能", "En4", "0", " kWh", "1"], - ["正向谷总电能", "Ep5", "0", " kWh", "1"], - ["反向谷总电能", "En5", "0", " kWh", "1"] + ["正向尖电能", "Ep2", "0", " kWh", "1"], + ["反向尖电能", "En2", "0", " kWh", "1"], + ["正向峰电能", "Ep3", "0", " kWh", "1"], + ["反向峰电能", "En3", "0", " kWh", "1"], + ["正向平电能", "Ep4", "0", " kWh", "1"], + ["反向平电能", "En4", "0", " kWh", "1"], + ["正向谷电能", "Ep5", "0", " kWh", "1"], + ["反向谷电能", "En5", "0", " kWh", "1"], + ["日正向总电能", "EpTo1", "0", " kWh", "1"], + ["日反向总电能", "EnTo1", "0", " kWh", "1"], + ["日正向尖电能", "EpTo2", "0", " kWh", "1"], + ["日反向尖电能", "EnTo2", "0", " kWh", "1"], + ["日正向峰电能", "EpTo3", "0", " kWh", "1"], + ["日反向峰电能", "EnTo3", "0", " kWh", "1"], + ["日正向平电能", "EpTo4", "0", " kWh", "1"], + ["日反向平电能", "EnTo4", "0", " kWh", "1"], + ["日正向谷电能", "EpTo5", "0", " kWh", "1"], + ["日反向谷电能", "EnTo5", "0", " kWh", "1"] ] } } \ No newline at end of file diff --git a/src/app/Station.cpp b/src/app/Station.cpp index 21a7526..39b2f9f 100644 --- a/src/app/Station.cpp +++ b/src/app/Station.cpp @@ -625,8 +625,10 @@ void Station::readTDData(int deviceNo, string str) DeviceReadJsonArray(device, json, "U"); DeviceReadJsonArray(device, json, "I"); DeviceReadJsonArray(device, json, "P"); - DeviceReadJsonArray(device, json, "Ep"); - DeviceReadJsonArray(device, json, "En"); + DeviceReadJsonArray(device, json, "Ep"); // 正向总、尖、峰、平、谷电能 + DeviceReadJsonArray(device, json, "En"); // 反向总、尖、峰、平、谷电能 + DeviceReadJsonArray(device, json, "EpTo"); // 当日正向总、尖、峰、平、谷电能 + DeviceReadJsonArray(device, json, "EnTo"); // 当日反向总、尖、峰、平、谷电能 } static std::string MapValueToJson(int npos, std::map& mapV) diff --git a/src/protocol/HttpEntity.cpp b/src/protocol/HttpEntity.cpp index 046e575..aa5779d 100644 --- a/src/protocol/HttpEntity.cpp +++ b/src/protocol/HttpEntity.cpp @@ -896,7 +896,7 @@ Errcode HttpEntity::queryStationTodayU(const httplib::Request& req, njson& json, int n = Utils::timeDaySeconds() / 600; if (catogray == "1") { - auto device = station->getDeviceByType(int(EDeviceType::E_METER), "2"); + auto device = station->getDeviceByType(int(EDeviceType::BMS), "1"); // 使用 BMS 的数据 if (device) { jsondata["U"] = VectorToJsonArray(device->cacheU, n); jsondata["I"] = VectorToJsonArray(device->cacheI, n); @@ -1602,7 +1602,7 @@ Errcode HttpEntity::queryStatCharts(const httplib::Request& req, njson& json, st njson jsondata; - std::string sql = R"(SELECT hd.*, d.`type` device_type, ddt.category FROM history_day hd + std::string sql = R"(SELECT hd.*, d.`type` device_type, d.code, ddt.category FROM history_day hd LEFT JOIN device d ON d.device_id = hd.device_id LEFT JOIN def_device_type ddt ON d.`type` = ddt.device_type_id WHERE dt=')" + dt + "' AND d.station_id='" + stationId + "' AND ddt.category='" + category + "';"; @@ -1621,6 +1621,16 @@ Errcode HttpEntity::queryStatCharts(const httplib::Request& req, njson& json, st { int datetype = fields.get("datatype"); // 1: 电压,2:电流,3:功率 std::string val = fields.value("value"); // JSON 数组(double) + int deviceType = fields.get("device_type"); + int deviceCode = fields.get("code"); + if (category == "1") + { + if (!(deviceType == int(EDeviceType::BMS))) // 储能BMS(储能设备以BMS电池的数据作为总数据来展示) + { + continue; + } + } + njson jsonval; if (JSON::parse(val, jsonval)) { diff --git a/web/src/views/monitor.vue b/web/src/views/monitor.vue index 23086d4..b3f56e4 100644 --- a/web/src/views/monitor.vue +++ b/web/src/views/monitor.vue @@ -260,7 +260,7 @@ export default { inputType:'number' }, { - label: '安全输入功率(0-400)', + label: '安全输入功率(0-700)', value: '', key: 'power_safe', type: 'input', @@ -268,7 +268,7 @@ export default { inputType:'number' }, { - label: '储能最大放电功率(0-150)', + label: '储能最大放电功率(0-250)', value: '', key: 'power_discharge', type: 'input', @@ -276,7 +276,7 @@ export default { inputType:'number' }, { - label: '储能最大充电功率(0-150)', + label: '储能最大充电功率(0-250)', value: '', key: 'power_charge', type: 'input', @@ -334,7 +334,7 @@ export default { message: '请输入安全输入功率' }, { - pattern: /^(400|[1-3][0-9]{2}|[1-9][0-9]|[0-9])$/, message: '请输入0-400的整数', + pattern: /^(700|[1-6][0-9]{2}|[1-9][0-9]|[0-9])$/, message: '请输入0-700的整数', } ], power_discharge: [ @@ -343,7 +343,7 @@ export default { required: true, message: '请输入储能最大放电功率' }, - { pattern: /^(150|1[0-4][0-9]|[1-9][0-9]|[0-9])$/, message: '请输入0-150的整数' } + { pattern: /^(250|1[0-9][0-9]|2[0-4][0-9]|[1-9][0-9]|[0-9])$/, message: '请输入0-250的整数' } ], power_charge: [ { @@ -351,7 +351,7 @@ export default { required: true, message: '请输入储能最大充电功率' }, - { pattern: /^(150|1[0-4][0-9]|[1-9][0-9]|[0-9])$/, message: '请输入0-150的整数' } + { pattern: /^(250|1[0-9][0-9]|2[0-4][0-9]|[1-9][0-9]|[0-9])$/, message: '请输入0-250的整数' } ], backflow: [ {