mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 10:49:25 +08:00
修改EMS运行状态标识判断方式
This commit is contained in:
@@ -236,13 +236,26 @@ void Device::setParam(std::string k, int v)
|
||||
}
|
||||
mapParams[k] = valStr;
|
||||
|
||||
if (type == 3 ) // 电表
|
||||
if (type == int(EDeviceType::E_METER)) // 电表
|
||||
{
|
||||
running = 1;
|
||||
}
|
||||
else if (type == int(EDeviceType::EMS)) // 101 EMS
|
||||
{
|
||||
running = 1;
|
||||
// EMS 没有总的故障状态标识,需要对多有的故障状态位进行判断
|
||||
err = (mapParams["0x2001"] != "0") || (mapParams["0x2002"] != "0") ||
|
||||
(mapParams["0x2006"] != "0") || (mapParams["0x2007"] != "0") ||
|
||||
(mapParams["0x200B"] != "0") || (mapParams["0x200C"] != "0") ||
|
||||
(mapParams["0x200E"] != "0") || (mapParams["0x200F"] != "0") ||
|
||||
(mapParams["0x2010"] != "0") || (mapParams["0x2011"] != "0") ||
|
||||
(mapParams["0x2013"] != "0") || (mapParams["0x2014"] != "0") ||
|
||||
(mapParams["0x2018"] != "0") || (mapParams["0x2019"] != "0") ||
|
||||
(mapParams["0x201A"] != "0") || (mapParams["0x201B"] != "0") ||
|
||||
(mapParams["0x201C"] != "0") || (mapParams["0x201D"] != "0") ||
|
||||
(mapParams["0x201E"] != "0") || (mapParams["0x201F"] != "0") ||
|
||||
(mapParams["0x2020"] != "0") || (mapParams["0x2021"] != "0") ||
|
||||
(mapParams["0x2022"] != "0");
|
||||
}
|
||||
else if (type == int(EDeviceType::PCS)) // 102 PCS
|
||||
{
|
||||
|
||||
@@ -42,8 +42,6 @@ public:
|
||||
void setBCUUnit(std::string k, int pos, int v, int count);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
int stationId = {0};
|
||||
int deviceId = {0};
|
||||
int type = {0};
|
||||
@@ -66,7 +64,7 @@ public:
|
||||
// 通讯entity
|
||||
std::shared_ptr<CommEntity> commEntity;
|
||||
|
||||
int64_t tsDataDate {};
|
||||
|
||||
//std::map<int, float> mapCacheVoltage;
|
||||
//std::map<int, float> mapCacheCurrent;
|
||||
//std::map<int, float> mapCachePower;
|
||||
|
||||
@@ -426,6 +426,12 @@ void Station::readBMSData(int deviceNo, string addr, int val)
|
||||
if (addr == "0x0003") { this->storage.voltage = val * 0.1; } // ["电压", "0x0003", "0.0", " V", "0.1"],
|
||||
else if (addr == "0x0005") { this->storage.current = val * 0.1; } // ["电流", "0x0005", "0.0", " A", "0.1"] ,
|
||||
else if (addr == "0x000F") { this->storage.power = val; } // ["堆功率", "0x000F", "0.0", " kW"] ,
|
||||
else if (addr == "0x004A") // 0-待机 1-充电 2-放电
|
||||
{
|
||||
if (val == 0) this->storage.status = 1;
|
||||
else if (val == 1) this->storage.status = 2;
|
||||
else if (val == 2) this->storage.status = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// 充电桩
|
||||
@@ -576,6 +582,8 @@ void Station::readGatewayMode(int deviceNo, int mode, string p1, string p2, stri
|
||||
}
|
||||
}
|
||||
|
||||
/// "CDZ": 1, //充电桩 1:在线,0:离线
|
||||
/// "EMU": 1, //储能 1:在线,0:离线
|
||||
void Station::readGatewayStatus(int deviceNo, int cdzStatus, int emuStatus, int tamStatus)
|
||||
{
|
||||
auto device = this->getDeviceByType(int(EDeviceType::GATEWAY), Utils::toStr(deviceNo));
|
||||
@@ -627,7 +635,7 @@ void Station::readGatewayStatus(int deviceNo, int cdzStatus, int emuStatus, int
|
||||
}
|
||||
}
|
||||
|
||||
static void DeviceReadJsonArray(std::shared_ptr<Device> device, njson& json, string key)
|
||||
static bool DeviceReadJsonArray(std::shared_ptr<Device> device, njson& json, string key)
|
||||
{
|
||||
if (json.contains(key))
|
||||
{
|
||||
@@ -636,7 +644,9 @@ static void DeviceReadJsonArray(std::shared_ptr<Device> device, njson& json, str
|
||||
{
|
||||
device->setParam(key + std::to_string(i+1), vecd[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Station::readTDData(int deviceNo, string str)
|
||||
@@ -659,8 +669,14 @@ void Station::readTDData(int deviceNo, string str)
|
||||
DeviceReadJsonArray(device, json, "P");
|
||||
DeviceReadJsonArray(device, json, "Ep"); // 正向总、尖、峰、平、谷电能
|
||||
DeviceReadJsonArray(device, json, "En"); // 反向总、尖、峰、平、谷电能
|
||||
DeviceReadJsonArray(device, json, "EpTo"); // 当日正向总、尖、峰、平、谷电能
|
||||
DeviceReadJsonArray(device, json, "EnTo"); // 当日反向总、尖、峰、平、谷电能
|
||||
if (!DeviceReadJsonArray(device, json, "EpTo")) // 当日正向总、尖、峰、平、谷电能
|
||||
{
|
||||
for (int i = 0; i<5; i++) { device->setParam("EpTo" + std::to_string(i+1), 0); }
|
||||
}
|
||||
if (!DeviceReadJsonArray(device, json, "EnTo")) // 当日反向总、尖、峰、平、谷电能
|
||||
{
|
||||
for (int i = 0; i<5; i++) { device->setParam("EnTo" + std::to_string(i+1), 0); }
|
||||
}
|
||||
}
|
||||
|
||||
static std::string MapValueToJson(int npos, std::map<int, float>& mapV)
|
||||
|
||||
@@ -1344,7 +1344,7 @@ static string GetStationStatusStr(int status)
|
||||
{
|
||||
if (status == 1) return "空闲";
|
||||
else if (status == 2) return "充电";
|
||||
else if (status == 2) return "放电";
|
||||
else if (status == 3) return "放电";
|
||||
else if (status == 9) return "故障";
|
||||
else return "离线";
|
||||
}
|
||||
@@ -1845,9 +1845,9 @@ Errcode HttpEntity::queryEnvironment(const httplib::Request& req, njson& json, s
|
||||
nodearray.push_back({{"pos", "警铃是否使用"}, {"status", unit.usedAlarm == 0 ? "否" : "是"}});
|
||||
nodearray.push_back({{"pos", "警铃状态"}, {"status", mapStatusDef[unit.statusAlarm]}}); // 0:无效 1:掉线 2:正常 3:启动
|
||||
nodearray.push_back({{"pos", "瓶头阀是否使用"}, {"status", unit.usedValve == 0 ? "否" : "是"}});
|
||||
nodearray.push_back({{"pos", "瓶头阀状态"}, {"status", mapStatusDef[unit.statusAlarm]}}); // 0:无效 1:掉线 2:正常 3:启动
|
||||
nodearray.push_back({{"pos", "瓶头阀状态"}, {"status", mapStatusDef[unit.statusValve]}}); // 0:无效 1:掉线 2:正常 3:启动
|
||||
nodearray.push_back({{"pos", "手报是否使用"}, {"status", unit.usedMCP == 0 ? "否" : "是"}});
|
||||
nodearray.push_back({{"pos", "手报状态"}, {"status", mapStatusDef[unit.statusAlarm]}}); // 0:无效 1:掉线 2:正常 3:启动
|
||||
nodearray.push_back({{"pos", "手报状态"}, {"status", mapStatusDef[unit.statusMCP]}}); // 0:无效 1:掉线 2:正常 3:启动
|
||||
break;
|
||||
}
|
||||
jsondata["fire40"] = nodearray;
|
||||
|
||||
@@ -97,9 +97,9 @@ export default {
|
||||
this.markers = res.data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
iconMap: (item.err === "1")
|
||||
? require('../../assets/home/homeIcon.png')
|
||||
: require('../../assets/home/homeIcon1.png')
|
||||
iconMap: (item.err === "0")
|
||||
? require('../../assets/home/homeIcon1.png')
|
||||
: require('../../assets/home/homeIcon.png')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -85,7 +85,7 @@ export default {
|
||||
item.value = newVal[item.key] || (item.d ? 0 : '')
|
||||
if (item.value === '离线' || item.value === '故障') item.color = '#f08080'
|
||||
else if (item.value === '空闲') item.color = '#f0f0a0'
|
||||
else if (item.value === '充电' || item.value === '放电' || item.value === '发电') item.color = '#f0f0a0'
|
||||
else if (item.value === '充电' || item.value === '放电' || item.value === '发电') item.color = '#a0f0a0'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user