更改了周五和周六晚上不充电
关闭后进程不关闭的操作 Mqtt的发布,关闭这个功能
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OrpaonEMS.App.Services
|
||||
{
|
||||
///////
|
||||
/////怎么认定为晚上,光伏发电功率低于一个阈值时可认为是晚上
|
||||
public YuePuRunModelService(ILogService logService, ConfigDataService configDataService,
|
||||
public YuePuRunModelService(ILogService logService, ConfigDataService configDataService,
|
||||
IEventAggregator eventAggregator)
|
||||
{
|
||||
ConfigDataService = configDataService;
|
||||
@@ -140,7 +140,7 @@ namespace OrpaonEMS.App.Services
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -514,7 +514,6 @@ namespace OrpaonEMS.App.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
if (WaitTokenSource.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
@@ -532,6 +531,7 @@ namespace OrpaonEMS.App.Services
|
||||
SlaveClient.ServerCmd.CoolOnOffCmd = false;
|
||||
MasterClient.ServerCmd.CoolOnOffCmd = false;
|
||||
|
||||
Thread.Sleep(30000);
|
||||
|
||||
//WaitEnvActionResult
|
||||
|
||||
@@ -695,48 +695,47 @@ namespace OrpaonEMS.App.Services
|
||||
// OpenSolar();
|
||||
//}
|
||||
|
||||
//if (!IsSpecialWeekDay())
|
||||
//{
|
||||
|
||||
//展示用
|
||||
ManageRealPw = EsEleMeter4.AvePw - EsEleMeter1.AvePw;
|
||||
TaxRealPw = SolarEleMeter5.AvePw - SolarEleMeter3.AvePw;//光伏和市电供应给税务大楼的负载
|
||||
|
||||
//循环执行方法
|
||||
//从储能箱充满为止
|
||||
if (SlaveClient.ClientInfo!.SOC < 90)
|
||||
if (!IsInWeekendTime())
|
||||
{
|
||||
//主储能箱充电
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = SlaveClient.ClientInfo!.MaxDisChargPw * ConfigDataService.energyStorageRunConfig.MaxBatDisChargRatio;
|
||||
//展示用
|
||||
ManageRealPw = EsEleMeter4.AvePw - EsEleMeter1.AvePw;
|
||||
TaxRealPw = SolarEleMeter5.AvePw - SolarEleMeter3.AvePw;//光伏和市电供应给税务大楼的负载
|
||||
|
||||
//循环执行方法
|
||||
//从储能箱充满为止
|
||||
if (SlaveClient.ClientInfo!.SOC < 90)
|
||||
{
|
||||
//主储能箱充电
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = SlaveClient.ClientInfo!.MaxDisChargPw * ConfigDataService.energyStorageRunConfig.MaxBatDisChargRatio;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//从储能箱充电
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = 0;
|
||||
}
|
||||
|
||||
//主储能箱不运行
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = 0;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//从储能箱充电
|
||||
//周五或者周六
|
||||
//主从都不充电
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = 0;
|
||||
//MasterControlMsg = "【主储能】周五周六晚上不充电,【主储能】不动作";
|
||||
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = 0;
|
||||
//SlaveControlMsg = "【从储能】周五周六晚上不充电,【从储能】不动作";
|
||||
}
|
||||
|
||||
//主储能箱不运行
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = 0;
|
||||
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// //周五或者周六
|
||||
// //主从都不充电
|
||||
// MasterClient.ServerCmd.CmdType = "Charg";
|
||||
// MasterClient.ServerCmd.CmdPw = 0;
|
||||
// MasterControlMsg = "【主储能】周五周六晚上不充电,【主储能】不动作";
|
||||
|
||||
// SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
// SlaveClient.ServerCmd.CmdPw = 0;
|
||||
// SlaveControlMsg = "【从储能】周五周六晚上不充电,【从储能】不动作";
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -805,48 +804,46 @@ namespace OrpaonEMS.App.Services
|
||||
// OpenSolar();
|
||||
//}
|
||||
|
||||
//if (!IsSpecialWeekDay())
|
||||
//{
|
||||
|
||||
//展示用
|
||||
ManageRealPw = EsEleMeter4.AvePw - EsEleMeter1.AvePw;
|
||||
TaxRealPw = SolarEleMeter5.AvePw - SolarEleMeter3.AvePw;//光伏和市电供应给税务大楼的负载
|
||||
|
||||
//循环执行方法
|
||||
//主储能箱充满为止
|
||||
if (MasterClient.ClientInfo!.SOC < ConfigDataService.energyStorageRunConfig.BMSSocUpSignLimitValue)
|
||||
if (!IsInWeekendTime())
|
||||
{
|
||||
//主储能箱充电
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = MasterClient.ClientInfo!.MaxDisChargPw * ConfigDataService.energyStorageRunConfig.MaxBatDisChargRatio;
|
||||
//展示用
|
||||
ManageRealPw = EsEleMeter4.AvePw - EsEleMeter1.AvePw;
|
||||
TaxRealPw = SolarEleMeter5.AvePw - SolarEleMeter3.AvePw;//光伏和市电供应给税务大楼的负载
|
||||
|
||||
//循环执行方法
|
||||
//主储能箱充满为止
|
||||
if (MasterClient.ClientInfo!.SOC < ConfigDataService.energyStorageRunConfig.BMSSocUpSignLimitValue)
|
||||
{
|
||||
//主储能箱充电
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = MasterClient.ClientInfo!.MaxDisChargPw * ConfigDataService.energyStorageRunConfig.MaxBatDisChargRatio;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//主储能箱充电
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = 0;
|
||||
}
|
||||
|
||||
//从储能箱不运行
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//主储能箱充电
|
||||
//周五或者周六
|
||||
//主从都不充电
|
||||
MasterClient.ServerCmd.CmdType = "Charg";
|
||||
MasterClient.ServerCmd.CmdPw = 0;
|
||||
//MasterControlMsg = "【主储能】周五周六晚上不充电,【主储能】不动作";
|
||||
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = 0;
|
||||
//SlaveControlMsg = "【从储能】周五周六晚上不充电,【从储能】不动作";
|
||||
}
|
||||
|
||||
//从储能箱不运行
|
||||
SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
SlaveClient.ServerCmd.CmdPw = 0;
|
||||
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// //周五或者周六
|
||||
// //主从都不充电
|
||||
// MasterClient.ServerCmd.CmdType = "Charg";
|
||||
// MasterClient.ServerCmd.CmdPw = 0;
|
||||
// MasterControlMsg = "【主储能】周五周六晚上不充电,【主储能】不动作";
|
||||
|
||||
// SlaveClient.ServerCmd.CmdType = "Charg";
|
||||
// SlaveClient.ServerCmd.CmdPw = 0;
|
||||
// SlaveControlMsg = "【从储能】周五周六晚上不充电,【从储能】不动作";
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -3275,13 +3272,43 @@ namespace OrpaonEMS.App.Services
|
||||
return (DateTime.Now.DayOfWeek == DayOfWeek.Friday && IsPm()) || (DateTime.Now.DayOfWeek == DayOfWeek.Saturday && IsPm());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是周五还是周六
|
||||
/// 在晚上判断是周五晚上还是周六晚上,腾出储能给光伏充电用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsInWeekendTime()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DayOfWeek currentDay = now.DayOfWeek;
|
||||
TimeSpan currentTime = now.TimeOfDay;
|
||||
|
||||
// 周五情况:时间 >= 23:00
|
||||
if (currentDay == DayOfWeek.Friday && currentTime.Hours >= 23)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 周六情况:全天有效
|
||||
else if (currentDay == DayOfWeek.Saturday)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 周日情况:时间 < 07:00
|
||||
else if (currentDay == DayOfWeek.Sunday && currentTime.Hours < 7)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否时下午
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool IsPm()
|
||||
{
|
||||
return DateTime.Now.Hour > 18;
|
||||
return DateTime.Now.Hour >= 23;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user