1.新增服务端UI界面,显示服务基础信息。2.修改设备显示配置。3.监控页面储能系统显示储能模式,模式设置新增'手动'

This commit is contained in:
lixiaoyuan
2025-09-25 19:20:25 +08:00
parent d7888c2be4
commit 8aba56f47d
39 changed files with 2954 additions and 408 deletions

View File

@@ -187,22 +187,9 @@ void Device::getCachePower(std::vector<std::string>& vec)
}
}
int64_t GetCurrentTimePos(int step)
void Device::setCache(int datatype, std::vector<float>& vd)
{
auto tp = chrono::system_clock::now();
int64_t tTime = chrono::time_point_cast<chrono::seconds>(tp).time_since_epoch().count();
std::time_t t = chrono::system_clock::to_time_t(tp);
std::tm* tmlocal = localtime(&t);
tmlocal->tm_hour = 0;
tmlocal->tm_min = 0;
tmlocal->tm_sec = 0;
int64_t tDate = chrono::time_point_cast<chrono::seconds>(chrono::system_clock::from_time_t(mktime(tmlocal))).time_since_epoch().count();
return (tTime - tDate) / step;
}
void Device::setCache(int datatype, std::vector<double>& vec)
{
std::map<int, double>* mapptr = NULL;
std::map<int, float>* mapptr = NULL;
if (datatype == 1) { mapptr = &mapCacheVoltage; }
else if (datatype == 2) { mapptr = &mapCacheCurrent; }
else if (datatype == 3) { mapptr = &mapCachePower; }
@@ -211,12 +198,12 @@ void Device::setCache(int datatype, std::vector<double>& vec)
{
const int step = 600;
const int N = 86400/step;
int n = GetCurrentTimePos(step);
int64_t tsSeconds = Utils::timeDaySeconds();
int npos = tsSeconds / step;
for (int i = 0; i<N; ++i)
{
if (i < vec.size()) { (*mapptr)[i] = vec[i]; }
else if (i <= n) { (*mapptr)[i] = 0; }
if (i < vd.size()) { (*mapptr)[i] = vd[i]; }
else if (i <= npos) { (*mapptr)[i] = 0; }
}
}
}
@@ -402,10 +389,10 @@ void Device::getRuntimeParams(std::vector<std::pair<std::string, std::string>>&
if (v == "0") v = "并网";
else if (v == "1") v = "离网";
}
if (item.addr == "0x1008") // 模块状态 R uint16 1开机0机 0x1008
if (item.addr == "0x1006") // 启停状态 R uint16 1开机0机 0x1008
{
if (v == "0") v = "开机";
else if (v == "1") v = "";
if (v == "1") v = "开机";
else if (v == "0") v = "";
}
}
else if (type == int(EDeviceType::PCS))
@@ -466,7 +453,7 @@ void Device::setBCUUnit(std::string k, int pos, int v, int count)
if (k == "0x0056") { bcuUnit[0] = float(v) * 0.1f; }
else if (k == "0x043E") { bcuUnit[1] = float(v) * 0.1f; }
else if (k == "0x0826") { bcuUnit[2] = float(v) * 0.001f; }
else if (k == "0x0C0E") { bcuUnit[3] = float(v); } // * 0.01f
else if (k == "0x0C0E") { bcuUnit[3] = float(v) * 0.01f; } // * 0.01f
else if (k == "0x0FF6") { bcuUnit[4] = float(v); }
}
}