Files
energy_storage/src/app/Application.h

108 lines
2.3 KiB
C
Raw Normal View History

2025-05-19 09:54:33 +08:00
#pragma once
#include <thread>
#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;
};
2025-05-19 09:54:33 +08:00
class Application
{
public:
static Application& instance()
{
static Application app;
return app;
}
void init();
void initDevice();
2025-05-19 09:54:33 +08:00
bool isQuit() { return isQuit_; }
Operator& getOperator() { return op_; }
void runThreadMain();
void runThreadDevice();
2025-05-19 09:54:33 +08:00
private:
bool isQuit_ = false;
// 登录的管理员信息
Operator op_;
};