mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改场站策略解析及网关指令下发
This commit is contained in:
@@ -40,6 +40,9 @@ void Station::setFields(Fields& fields)
|
||||
this->workModeId = fields.get<int>(DMStation::WORK_MODE);
|
||||
this->code = fields.value(DMStation::CODE);
|
||||
this->status = fields.get<int>(DMStation::STATUS);
|
||||
this->operationDate = fields.value(DMStation::OPERATION_DATE);
|
||||
|
||||
this->policy.setFields(fields);
|
||||
}
|
||||
|
||||
void Station::addDevice(int deviceId, std::shared_ptr<Device> device)
|
||||
@@ -210,7 +213,19 @@ void Station::setGarewayWorkMode()
|
||||
json["ts"] = Utils::time();
|
||||
json["no"] = 1; // 设备编号
|
||||
json["40001"] = this->workModeId;
|
||||
|
||||
if (policy.type == 1)
|
||||
{
|
||||
json["40002"] = njson::array(); // 峰谷套利
|
||||
policy.getGatewayJsonPeriods(json["40002"]);
|
||||
}
|
||||
else if (policy.type == 5)
|
||||
{
|
||||
json["40021"] = njson::array(); // 自定时段
|
||||
policy.getGatewayJsonPeriods(json["40021"]);
|
||||
}
|
||||
|
||||
std::string text = json.dump();
|
||||
spdlog::info(text);
|
||||
mqttCli->publish("Gateway_YT", text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user