namespace IStation.Service
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class ScheduleConfigHelper
|
{
|
|
/// <summary>
|
/// 生成
|
/// </summary>
|
/// <returns></returns>
|
public static Model.ChScheduleConfig Create()
|
{
|
var station = new IStation.Service.Station().Get();
|
var chConfig = new IStation.Model.ChScheduleConfig();
|
chConfig.Station1 = GetStation1(station.S1);
|
chConfig.Station2 = GetStation2(station.S2);
|
return chConfig;
|
}
|
|
private static IStation.Model.ScheduleConfig GetStation1(List<Model.Pump> pumps)
|
{
|
var model = new IStation.Model.ScheduleConfig();
|
model.MustOpenFlagList = new List<int>();
|
model.MustCloseFlagList = new List<int>();
|
model.ForbiddenFlagCombineList = new List<List<int>>()
|
{
|
new List<int>(){16,17,18}
|
};
|
model.AssociativeFlagCombineList = new List<List<int>>();
|
model.SameSectionFlagCombineList = new List<List<int>>()
|
{
|
new List<int>(){11,13,15,17},
|
new List<int>(){12,14,16,18},
|
};
|
model.WaterSupplyLimitList = new List<IStation.Model.WaterSupplyLimit>();
|
model.FrequencyLimitList = new List<IStation.Model.FrequencyLimit>();
|
foreach (var pump in pumps)
|
{
|
var flag = pump.Flag;
|
if (flag == 15 || flag == 16)
|
continue;
|
model.FrequencyLimitList.Add(new IStation.Model.FrequencyLimit()
|
{
|
Flag = pump.Flag,
|
Min = 28,
|
Max = 50
|
});
|
}
|
return model;
|
}
|
|
|
private static IStation.Model.ScheduleConfig GetStation2(List<Model.Pump> pumps)
|
{
|
var model = new IStation.Model.ScheduleConfig();
|
model.MustOpenFlagList = new List<int>();
|
model.MustCloseFlagList = new List<int>()
|
{
|
21
|
};
|
model.ForbiddenFlagCombineList = new List<List<int>>()
|
{
|
new(){22,24,25},
|
};
|
model.AssociativeFlagCombineList = new List<List<int>>();
|
model.SameSectionFlagCombineList = new List<List<int>>()
|
{
|
new(){21,22,23,24},
|
new(){25,26,27},
|
};
|
model.WaterSupplyLimitList = new List<IStation.Model.WaterSupplyLimit>();
|
model.FrequencyLimitList = new List<IStation.Model.FrequencyLimit>();
|
foreach (var pump in pumps)
|
{
|
var flag = pump.Flag;
|
if (flag == 27)
|
{
|
model.FrequencyLimitList.Add(new IStation.Model.FrequencyLimit()
|
{
|
Flag = pump.Flag,
|
Min = (450 / pump.Nr * 50),
|
Max = 680 / pump.Nr * 50,
|
});
|
}
|
else
|
{
|
model.FrequencyLimitList.Add(new IStation.Model.FrequencyLimit()
|
{
|
Flag = pump.Flag,
|
Min = 280 / pump.Nr * 50,
|
Max = 480 / pump.Nr * 50,
|
});
|
}
|
model.FrequencyLimitList.ForEach(x =>
|
{
|
x.Min = Math.Round(x.Min, 1);
|
x.Max = Math.Round(x.Max, 1);
|
});
|
}
|
return model;
|
}
|
|
|
}
|
}
|