ningshuxia
2025-04-16 a67da735b33be01b24845ce03ae7551cf55ddbbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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;
        }
 
 
    }
}