实现削峰套利策略的编辑页面

This commit is contained in:
lixiaoyuan
2025-08-26 18:36:25 +08:00
parent 7fe51ea362
commit 8f6c83147b
37 changed files with 1506 additions and 729 deletions

View File

@@ -8,6 +8,7 @@
class Station;
class Device;
class MyPolicy;
using VecPairSS = std::vector<std::pair<std::string, std::string>>;
@@ -25,27 +26,32 @@ struct Role
bool isOpen {false};
};
class ElectPeriod
{
public:
double priceSuperPeak {};
double pricePeak {};
double priceShoulder {};
double priceOffPeak {};
std::vector<std::vector<std::string>> vecPeriods;
void parse(std::string jsonstr);
std::string dump();
};
class AppData
{
public:
void init();
void initFromDB();
std::shared_ptr<Station> getStation(int stationId);
std::shared_ptr<Station> getStationByName(std::string name);
std::shared_ptr<Device> getDevice(int stationId, int deviceId);
///////////////////////////////////////////////////////////////////////////////////////////////
// 获取角色名称列表
std::vector<std::string> getRoleNames();
// 获取场站名称列表
std::vector<std::string> getStationNames();
// 获取设备类型
std::vector<std::string> getDeviceTypes();
std::shared_ptr<Device> getDevice(int stationId, int deviceId);
// 获取设备类型定义
std::unordered_map<int, std::shared_ptr<DeviceType>>& getDeviceTypeDef();
@@ -55,6 +61,25 @@ public:
void initUser();
///////////////////////////////////////////////////////////////////////////////////////////////
// 获取角色名称列表
std::vector<std::string> getRoleNames();
// 获取场站名称列表
std::vector<std::string> getStationNames();
// 获取设备类型
std::vector<std::string> getDeviceTypeNames();
// 获取工作模式
std::vector<std::string> getWorkModes();
// 获取策略类型定义
std::vector<std::string> getPolicyTypeNames();
// 获取策略名称
std::vector<std::string> getPolicyNames();
std::vector<std::string> getElectPreiodVals(int month);
std::string getElectPreiodVal(int month, int hour);
public:
///////////////////////////////////////////////////////////////////////////////////////////////
// === 系统 ===
@@ -77,18 +102,33 @@ public:
VecPairSS deviceType;
VecPairSS workMode;
} mapping;
///////////////////////////////////////////////////////////////////////////////////////////////
// === 场站信息 ===
double electPriceSuperPeak {};
double electPricePeak {};
double electPriceShoulder {};
double electPriceOffPeak {};
// 场站信息
std::unordered_map<int, std::shared_ptr<Station>> mapStation;
///////////////////////////////////////////////////////////////////////////////////////////////
// === 角色定义 ===
// 角色信息
std::unordered_map<int, std::shared_ptr<Role>> mapRole;
///////////////////////////////////////////////////////////////////////////////////////////////
// === 设备类型定义 ===
// 设备类型定义
std::unordered_map<int, std::shared_ptr<DeviceType>> mapDeviceType;
// 工作模式定义
std::unordered_map<int, std::string> mapWorkMode;
// 策略类型定义
std::unordered_map<int, std::string> mapPolicyType;
// 策略信息
std::unordered_map<int, std::shared_ptr<MyPolicy>> mapPolicy;
// 电力峰谷分段 (12个月每个月按小时分成24个时段)
std::vector<std::vector<std::string>> vecElectPeriods;
};