mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改预制舱参数尖峰平谷的定义值,修改2放2充指令参数缺少的问题
This commit is contained in:
@@ -26,8 +26,9 @@
|
|||||||
"Cooling_YX": {"deviceType":14, "polling":1, "enabled": 1},
|
"Cooling_YX": {"deviceType":14, "polling":1, "enabled": 1},
|
||||||
"Gateway_YX": {"deviceType":15, "polling":1, "enabled": 1},
|
"Gateway_YX": {"deviceType":15, "polling":1, "enabled": 1},
|
||||||
"Gateway_YC": {"deviceType":15, "polling":1, "enabled": 1},
|
"Gateway_YC": {"deviceType":15, "polling":1, "enabled": 1},
|
||||||
"Gateway_YT": {"deviceType":15, "polling":0, "enabled": 1},
|
"Gateway_YT": {"deviceType":15, "polling":0, "enabled": 1},
|
||||||
"Charger_YC": {"deviceType":106, "polling":0, "enabled": 1}
|
"Charger_YC": {"deviceType":106, "polling":0, "enabled": 1},
|
||||||
|
"TD_YC": {"deviceType":4, "polling":0, "enabled": 1}
|
||||||
},
|
},
|
||||||
"view": {"latitude":0,"longitude":0,"altitude":0},
|
"view": {"latitude":0,"longitude":0,"altitude":0},
|
||||||
"video": {
|
"video": {
|
||||||
|
|||||||
@@ -899,5 +899,14 @@
|
|||||||
{"key": "27", "datatype": "uint16", "alert": 0, "name":"枪2:输出功率", "remark": ""},
|
{"key": "27", "datatype": "uint16", "alert": 0, "name":"枪2:输出功率", "remark": ""},
|
||||||
{"key": "28", "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": ""},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,14 +58,14 @@
|
|||||||
"addrYC":[
|
"addrYC":[
|
||||||
["电网状态", "0x1007", "--", ""],
|
["电网状态", "0x1007", "--", ""],
|
||||||
["启停状态", "0x1006", "--", ""],
|
["启停状态", "0x1006", "--", ""],
|
||||||
["手动/自动状态", "0x103D", "--", ""],
|
|
||||||
["A相电压", "0x0013", "0.0", " V", "1"],
|
["A相电压", "0x0013", "0.0", " V", "1"],
|
||||||
["A相电流", "0x001C", "0.0", " A"],
|
["A相电流", "0x001C", "0.0", " A"],
|
||||||
["B相电压", "0x0014", "0.0", " V", "1"],
|
["B相电压", "0x0014", "0.0", " V", "1"],
|
||||||
["B相电流", "0x001D", "0.0", " A"],
|
["B相电流", "0x001D", "0.0", " A"],
|
||||||
["C相电压", "0x0015", "0.0", " V", "1"],
|
["C相电压", "0x0015", "0.0", " V", "1"],
|
||||||
["C相电流", "0x001E", "0.0", " A"],
|
["C相电流", "0x001E", "0.0", " A"],
|
||||||
["总有功功率", "0x0028", "0.0", " kW"]
|
["总有功功率", "0x0028", "0.0", " kW"],
|
||||||
|
["手动/自动状态", "0x103D", "--", ""]
|
||||||
],
|
],
|
||||||
"addrCurve": ["0x0013", "0x001C", "0x0028"],
|
"addrCurve": ["0x0013", "0x001C", "0x0028"],
|
||||||
"valstr": {
|
"valstr": {
|
||||||
@@ -191,5 +191,30 @@
|
|||||||
["功率限值", "18", "0.0", " kW", "0.1"]
|
["功率限值", "18", "0.0", " kW", "0.1"]
|
||||||
],
|
],
|
||||||
"addrCurve": ["15", "16", "17"]
|
"addrCurve": ["15", "16", "17"]
|
||||||
|
},
|
||||||
|
"TD": {
|
||||||
|
"deviceType":4,
|
||||||
|
"addrYC":[
|
||||||
|
["A相电压", "U1", "0", " V", "1"],
|
||||||
|
["A相电流", "I1", "0", " A", "1"],
|
||||||
|
["B相电压", "U2", "0", " V", "1"],
|
||||||
|
["B相电流", "I2", "0", " A", "1"],
|
||||||
|
["C相电压", "U3", "0", " V", "1"],
|
||||||
|
["C相电流", "I3", "0", " A", "1"],
|
||||||
|
["总功率", "P1", "0", " kW", "1"],
|
||||||
|
["A相功率", "P2", "0", " kW", "1"],
|
||||||
|
["B相功率", "P3", "0", " kW", "1"],
|
||||||
|
["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"]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
import re
|
|
||||||
import json
|
|
||||||
|
|
||||||
def parse_datatype(text):
|
|
||||||
datatypes = ["int16", "uint16", "int32", "uint32", "int64", "uint64"]
|
|
||||||
for index, datatype in enumerate(datatypes):
|
|
||||||
left, separator, right = text.partition(datatype)
|
|
||||||
if len(separator) != 0:
|
|
||||||
return datatype, left + right
|
|
||||||
return "", text
|
|
||||||
|
|
||||||
|
|
||||||
def parse_from_file(filename):
|
|
||||||
data = ""
|
|
||||||
with open(filename, "r", encoding='utf-8') as f: # 打开文件
|
|
||||||
linedata = ""
|
|
||||||
for line in f: # 行遍历
|
|
||||||
line = line.strip()
|
|
||||||
#linedata = f.readline() # 读取文件的一行
|
|
||||||
flag = bool(re.search(r'0x[0-9A-Fa-f]{4}', line))
|
|
||||||
linedata += line.strip()
|
|
||||||
if flag:
|
|
||||||
# print(linedata)
|
|
||||||
# left, separator, right = linedata.partition("0x")
|
|
||||||
parts = re.split(r'(0x[0-9A-Fa-f]{4})', linedata)
|
|
||||||
linedata = ""
|
|
||||||
|
|
||||||
key = parts[1]
|
|
||||||
datatype, remark = parse_datatype(parts[0].strip())
|
|
||||||
remark = remark.replace("\t", " ").replace("\"", "")
|
|
||||||
|
|
||||||
item = {}
|
|
||||||
item["key"] = key
|
|
||||||
item["datatype"] = datatype
|
|
||||||
item["remark"] = remark
|
|
||||||
|
|
||||||
if len(data) > 0:
|
|
||||||
data += ",\n"
|
|
||||||
data += ("\t\t\t" + json.dumps(item, ensure_ascii=False))
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
addritems = {}
|
|
||||||
addritems["EMS_YT"] = ["EMS遥调.txt", 1]
|
|
||||||
addritems["BCU_YX"] = ["BCU电池簇遥信.txt", 1]
|
|
||||||
addritems["BCU_YC"] = ["BCU电池簇遥测.txt", 1]
|
|
||||||
addritems["BMS_YC"] = ["BMS电池堆遥测.txt", 1]
|
|
||||||
addritems["EMS_YX"] = ["EMS遥信.txt", 1]
|
|
||||||
addritems["EMS_YC"] = ["EMS遥测.txt", 1]
|
|
||||||
addritems["EMS_YT"] = ["EMS遥调.txt", 1]
|
|
||||||
addritems["PCS_YX"] = ["PCS遥信.txt", 1]
|
|
||||||
addritems["PCS_YC"] = ["PCS遥测.txt", 1]
|
|
||||||
addritems["PCU_YX"] = ["PCU遥信.txt", 1]
|
|
||||||
addritems["PCU_YC"] = ["PCU遥测.txt", 1]
|
|
||||||
addritems["MEM_YC"] = ["多功能电表遥测.txt", 1]
|
|
||||||
addritems["TH_YC"] = ["温湿度状态遥测.txt", 1]
|
|
||||||
addritems["Fire40_YX"] = ["消防4.0遥信.txt", 1]
|
|
||||||
addritems["Cooling_YX"] = ["冷机遥信.txt", 1]
|
|
||||||
addritems["Cooling_YC"] = ["冷机遥测.txt", 1]
|
|
||||||
|
|
||||||
|
|
||||||
with open('registeraddr.json', 'w', encoding='utf-8') as f:
|
|
||||||
f.write("{")
|
|
||||||
index = 0
|
|
||||||
for key in addritems:
|
|
||||||
filename = addritems[key][0]
|
|
||||||
count = addritems[key][1]
|
|
||||||
print("parse: ", key, filename)
|
|
||||||
data = parse_from_file(filename)
|
|
||||||
if len(data) > 0:
|
|
||||||
data = "\n" + data + "\n\t"
|
|
||||||
if index != 0:
|
|
||||||
f.write(",")
|
|
||||||
f.write("\n\t\"" + key + "\": {\n\t\t\"count\":" + str(count) + ",\n\t\t\"addr\":[" + data + "\t]\n\t}")
|
|
||||||
index+=1
|
|
||||||
f.write("\n}")
|
|
||||||
|
|
||||||
@@ -155,17 +155,19 @@ void SysPolicy::getGatewayJsonPeriods(njson& json)
|
|||||||
if (vecPeriods1.size()>0)
|
if (vecPeriods1.size()>0)
|
||||||
{
|
{
|
||||||
map<string, vector<int>> mapT;
|
map<string, vector<int>> mapT;
|
||||||
for (auto& item: vecPeriods1[0])
|
for (int i = 0; i<vecPeriods1.size(); ++i)
|
||||||
{
|
{
|
||||||
int h = 0; int m = 0;
|
for (auto& item: vecPeriods1[i])
|
||||||
PeriodsTimeStrToInt(item.first, h, m);
|
{
|
||||||
int p = 0;
|
int h = 0; int m = 0;
|
||||||
PeriodsStrToInt(item.second, p);
|
PeriodsTimeStrToInt(item.first, h, m);
|
||||||
char str[5] = {};
|
int p = 0;
|
||||||
sprintf(str, "%02d:%02d", h, m);
|
PeriodsStrToInt(item.second, p);
|
||||||
mapT[str] = {h, m, p};
|
char str[5] = {};
|
||||||
|
sprintf(str, "%02d:%02d", h, m);
|
||||||
|
mapT[str] = {h, m, p};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
njson jsonArray = njson::array();
|
njson jsonArray = njson::array();
|
||||||
for (auto& item: mapT)
|
for (auto& item: mapT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -238,11 +238,11 @@ string Station::getGatewayMode()
|
|||||||
|
|
||||||
static map<int, string> mapPeriodType =
|
static map<int, string> mapPeriodType =
|
||||||
{
|
{
|
||||||
{1, "谷"}, {2, "平"}, {3, "峰"}, {4, "尖"}
|
{0, "无"}, { 1, "尖" }, {2, "峰"}, {3, "平"}, {4, "谷"}, {5, "深谷"},
|
||||||
};
|
};
|
||||||
static map<int, string> mapPeriodOper =
|
static map<int, string> mapPeriodOper =
|
||||||
{
|
{
|
||||||
{0, "停"}, {1, "充"}, {2, "充"}, {3, "放"}, {4, "放"}
|
{0, "停"}, {1, "放"}, {2, "放"}, {3, "充"}, {4, "充"}, {5, "充"}
|
||||||
};
|
};
|
||||||
|
|
||||||
string Station::getGatewayParam()
|
string Station::getGatewayParam()
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ Errcode DAO::queryDeviceList(PageInfo& pageInfo, vector<Fields>& result)
|
|||||||
}
|
}
|
||||||
Errcode DAO::queryDeviceListByStation(PageInfo& pageInfo, string stationId, vector<Fields>& result)
|
Errcode DAO::queryDeviceListByStation(PageInfo& pageInfo, string stationId, vector<Fields>& result)
|
||||||
{
|
{
|
||||||
std::string sqlFrom = "FROM device d LEFT JOIN station s ON d.station_id =s.station_id WHERE d.station_id='" + stationId + "' ORDER BY station_id, sort_no";
|
std::string sqlFrom = "FROM device d LEFT JOIN station s ON d.station_id =s.station_id WHERE d.station_id='" + stationId + "' ORDER BY d.station_id, d.sort_no";
|
||||||
return QueryPagination("d.*, s.name station_name", sqlFrom, pageInfo, result);
|
return QueryPagination("d.*, s.name station_name", sqlFrom, pageInfo, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user