Files
YuPu-OrpaonEMS/OrpaonEMS.App/Models/NightChargEleModel.cs
2025-02-28 22:23:13 +08:00

170 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using OrpaonEMS.App.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.App.Models
{
/// <summary>
/// 判断是不是夜晚充的电量
/// 判断模型
/// </summary>
public class NightChargEleModel
{
public NightChargEleModel(ConfigDataService configDataService)
{
MasterCheck = DischargInfo.NoComplete;
SlaveCheck = DischargInfo.NoComplete;
ConfigDataService = configDataService;
}
/// <summary>
/// 是否开始校验
/// </summary>
public bool IsStartCheck { get; set; }
/// <summary>
/// 夜间充的电 主储能箱是否放完
/// </summary>
public DischargInfo MasterCheck { get; set; }
/// <summary>
/// 夜间充的电 从储能箱是否放完
/// </summary>
public DischargInfo SlaveCheck { get; set; }
private double _MasterSoc;
/// <summary>
/// 主储能柜的SOC
/// 在新的一天中根据SOC达到阈值决定是否夜间的电放完
/// </summary>
public double MasterSoc
{
get
{
return _MasterSoc;
}
set
{
if (IsStartCheck)
{
if (_MasterSoc != value && value <= ConfigDataService.energyStorageRunConfig.BMSSocDownSignLimitValue)
{
MasterCheck = DischargInfo.DischargComplete;
_MasterSoc = value;
}
}
else
{
_MasterSoc = value;
}
}
}
private double _SlaveSoc;
/// <summary>
/// 从储能柜的SOC
/// 在新的一天中根据SOC达到阈值决定是否夜间的电放完
/// </summary>
public double SlaveSoc
{
get
{
return _SlaveSoc;
}
set
{
if (IsStartCheck)
{
if (_SlaveSoc != value && value <= ConfigDataService.energyStorageRunConfig.BMSSocDownSignLimitValue)
{
SlaveCheck = DischargInfo.DischargComplete;
_SlaveSoc = value;
}
}
else
{
_SlaveSoc = value;
}
}
}
/// <summary>
/// 配置数据
/// </summary>
public ConfigDataService ConfigDataService { get; }
///// <summary>
///// 获取状态
///// </summary>
///// <returns></returns>
//public bool GetCheckState()
//{
// return MasterCheck && SlaveCheck;
//}
/// <summary>
/// 设置一天的初始状态
/// </summary>
public void SetDayInitState(double Mastersoc, double Slavesoc)
{
//比如从夜间切换到白天算是一天的开始判断此时的SOC是否被充满如果是充满的话则是属于夜间低谷的电量需要标记
IsStartCheck = true;
if (Mastersoc >= ConfigDataService.energyStorageRunConfig.BMSSocUpSignLimitValue * 0.8)
{
MasterCheck = DischargInfo.NoComplete;
}
else
{
MasterCheck = DischargInfo.DischargComplete;
}
//理论是从储能充电60%
if (Slavesoc >= 50)
{
SlaveCheck = DischargInfo.NoComplete;
}
else
{
SlaveCheck = DischargInfo.DischargComplete;
}
}
/// <summary>
/// 设置白天结束的状态
/// </summary>
public void SetDayEndState()
{
IsStartCheck = false;
}
}
/// <summary>
/// 放电信息
/// </summary>
public enum DischargInfo
{
/// <summary>
/// 放电放完了
/// </summary>
DischargComplete = 1,
/// <summary>
/// 没有完成
/// </summary>
NoComplete = 2
}
}