#pragma once #include #include "common/Logger.h" #include "Operator.h" struct AppData { ///////////////////////////////////////////// /// === 系统 === int64_t sysActivationTime {}; ///////////////////////////////////////////// /// === 数据库 === struct { std::string host; int port; std::string user; std::string passwd; } db; ///////////////////////////////////////////// /// === 系统统计 === // 累计发电量,单位:kWh double electGenTatal {}; // 累计入网电量,单位:kWh double electInTotal {}; // 累计收益,单位:元 double incomeTotal {}; // 碳减排量, 单位:吨 double ccers {}; ///////////////////////////////////////////// /// === 环境 === // 光照度 double illuminance {}; // 辐照度 double irradiance {}; // 风速 double windspeed {}; // 温度 double temperature {}; // 湿度 double humidity {}; ///////////////////////////////////////////// /// === 日统计 === struct { // 发电量 double electGen {}; // 入网电量 double electIn {}; // 发电收益金额 double incomeElect {}; // 储能电量 double electStorage {}; // 储能次数 int numStore {}; // 放电电量 double electDischarge {}; // 放电次数 int numDischarge {}; // 用电电量 double electLoad {}; // 充电电量 double electCharge {}; // 充电次数 int numCharge {}; // 充电收益 double incomeCharge {}; // 故障次数 int numFault {}; // 故障次数:光伏设备 int numFaultSolar {}; // 故障次数:储能设备 int numFaultStorage {}; // 故障次数:负荷设备 int numFaultLoad {}; } statDay; }; class Application { public: static Application& instance() { static Application app; return app; } void init(); void initDevice(); bool isQuit() { return isQuit_; } Operator& getOperator() { return op_; } void runThreadMain(); void runThreadDevice(); private: bool isQuit_ = false; // 登录的管理员信息 Operator op_; };