mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
实现系统总览、统计分析的图标数据接口
This commit is contained in:
@@ -438,6 +438,7 @@ int MyWebHandler::updateDevice(const QString& deviceId, QVariantMap params)
|
||||
JSgetReqParam("model", params, fields);
|
||||
JSgetReqParam("factory", params, fields);
|
||||
JSgetReqParam("is_open", params, fields);
|
||||
JSgetReqParam("attrs", params, fields);
|
||||
if (fields.size() == 0)
|
||||
{
|
||||
return 0;
|
||||
@@ -783,16 +784,70 @@ QVariantList MyWebHandler::getStatisticDay(const QString& startDate, int nday)
|
||||
{
|
||||
QVariantMap row;
|
||||
row["dt"] = "";
|
||||
row["elect_gen_solar"] = float(i);
|
||||
row["elect_in_solar"] = float(i);
|
||||
row["income_solar"] = float(i);
|
||||
|
||||
// 光伏:发电量、入网电量、发电时长、故障次数
|
||||
row["elect_gen"] = float(i);
|
||||
row["elect_in"] = float(i);
|
||||
row["elect_gen_t"] = float(i);
|
||||
row["income_elect"] = float(i); // 发电收益
|
||||
row["num_fault_solar"] = float(i);
|
||||
|
||||
// 储能:储能电量、放电电量、储能时长、放电时长、故障次数
|
||||
row["elect_store"] = float(i);
|
||||
row["elect_discharge"] = float(i);
|
||||
row["elect_load"] = float(i);
|
||||
row["elect_charge"] = float(i);
|
||||
row["num_charge"] = float(i);
|
||||
row["elect_store_t"] = float(i);
|
||||
row["elect_discharge_t"] = float(i);
|
||||
row["num_fault_store"] = float(i);
|
||||
|
||||
// 充电:充电电量、充电收益、充电次数、充电时长、故障次数
|
||||
row["elect_charge"] = float(i);
|
||||
row["elect_charge_t"] = float(i);
|
||||
row["income_charge"] = float(i);
|
||||
row["num_charge"] = float(i);
|
||||
row["num_fault_charge"] = float(i);
|
||||
|
||||
// 负载:
|
||||
row["elect_load"] = float(i);
|
||||
row["num_fault_load"] = float(i);
|
||||
|
||||
result << row;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static QVariantList RandCurveDataDay(int a, int b)
|
||||
{
|
||||
QVariantList d;
|
||||
int64_t t0 = Utils::timeNowDate();
|
||||
int step = 600;
|
||||
int N = 86400 / step;
|
||||
int y = a;
|
||||
for (int i = 0; i <= N; ++i) {
|
||||
int t = t0 + i * step * 1000;
|
||||
y = std::floor((y + Utils::random(0, 20) - 10) * 100) / 100;
|
||||
QVariantMap item;
|
||||
item["name"] = t;
|
||||
item["value"] = QVariantList {t, y};
|
||||
d << item;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
// 获取一天的发电功率
|
||||
QVariantList MyWebHandler::getStatisticPowerDay()
|
||||
{
|
||||
static auto tempData = RandCurveDataDay(500, 600);
|
||||
return tempData;
|
||||
}
|
||||
|
||||
// 获取一天的辐照度
|
||||
QVariantList MyWebHandler::getStatisticIrradianceDay()
|
||||
{
|
||||
static auto tempData = RandCurveDataDay(500, 600);
|
||||
return tempData;
|
||||
}
|
||||
|
||||
QVariantList MyWebHandler::getCurveDataDay(int a, int b)
|
||||
{
|
||||
return RandCurveDataDay(a, b);
|
||||
}
|
||||
Reference in New Issue
Block a user