using System.ComponentModel.DataAnnotations; using Yw.Untity; namespace IStation.Test.Init { /// /// /// public class Station1ScadaSchedule { public Station1ScadaSchedule() { } public Station1ScadaSchedule(Station1ScadaSchedule rhs) { this.Time = rhs.Time; this.R1 = rhs.R1; this.R2 = rhs.R2; this.R3 = rhs.R3; this.JD1P = rhs.JD1P; this.JD2P = rhs.JD2P; this.JD3P = rhs.JD3P; this.Pump11P = rhs.Pump11P; this.Pump12P = rhs.Pump12P; this.Pump13P = rhs.Pump13P; this.Pump14P = rhs.Pump14P; this.Pump15P = rhs.Pump15P; this.Pump16P = rhs.Pump16P; this.Pump17P = rhs.Pump17P; this.Pump18P = rhs.Pump18P; this.JD1F = rhs.JD1F; this.JD2F = rhs.JD2F; this.JD3F = rhs.JD3F; this.Pump11 = rhs.Pump11; this.Pump12 = rhs.Pump12; this.Pump13 = rhs.Pump13; this.Pump14 = rhs.Pump14; this.Pump15 = rhs.Pump15; this.Pump16 = rhs.Pump16; this.Pump17 = rhs.Pump17; this.Pump18 = rhs.Pump18; this.JD1PM = rhs.JD1PM; this.JD2PM = rhs.JD2PM; this.JD3PM = rhs.JD3PM; this.Pump11PM = rhs.Pump11PM; this.Pump12PM = rhs.Pump12PM; this.Pump13PM = rhs.Pump13PM; this.Pump14PM = rhs.Pump14PM; this.Pump15PM = rhs.Pump15PM; this.Pump16PM = rhs.Pump16PM; this.Pump17PM = rhs.Pump17PM; this.Pump18PM = rhs.Pump18PM; this.JD1FM = rhs.JD1FM; this.JD2FM = rhs.JD2FM; this.JD3FM = rhs.JD3FM; this.Pump11M = rhs.Pump11M; this.Pump12M = rhs.Pump12M; this.Pump13M = rhs.Pump13M; this.Pump14M = rhs.Pump14M; this.Pump15M = rhs.Pump15M; this.Pump16M = rhs.Pump16M; this.Pump17M = rhs.Pump17M; this.Pump18M = rhs.Pump18M; } #region Set public void Sum() { this.TotalFlow = Round(this.JD1F + this.JD2F + this.JD3F, 1) ?? 0; var p_list = new List() { this.JD1P, this.JD2P, this.JD3P }; this.TotalHead = Round(p_list.Max(), 4) ?? 0; var limited_speed_ratio = 0.1; var run_flags = new List(); var run_flag_hz_dict = new Dictionary(); if (this.Pump11 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag11); run_flag_hz_dict.Add(GlobalHelper.Flag11, this.Pump11.Value); } if (this.Pump12 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag12); run_flag_hz_dict.Add(GlobalHelper.Flag12, this.Pump12.Value); } if (this.Pump13 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag13); run_flag_hz_dict.Add(GlobalHelper.Flag13, this.Pump13.Value); } if (this.Pump14 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag14); run_flag_hz_dict.Add(GlobalHelper.Flag14, this.Pump14.Value); } if (this.Pump15 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag15); run_flag_hz_dict.Add(GlobalHelper.Flag15, this.Pump15.Value); } if (this.Pump16 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag16); run_flag_hz_dict.Add(GlobalHelper.Flag16, this.Pump16.Value); } if (this.Pump17 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag17); run_flag_hz_dict.Add(GlobalHelper.Flag17, this.Pump17.Value); } if (this.Pump18 > limited_speed_ratio) { run_flags.Add(GlobalHelper.Flag18); run_flag_hz_dict.Add(GlobalHelper.Flag18, this.Pump18.Value); } this.RunFlags = IntListHelper.ToString(run_flags); this.RunCount = run_flags.Count; } public void Set() { this.JD1PDiff = Diff(this.JD1PM, this.JD1P, 4); this.JD2PDiff = Diff(this.JD2PM, this.JD2P, 4); this.JD3PDiff = Diff(this.JD3PM, this.JD3P, 4); this.Pump11PDiff = DiffCheck(this.Pump11PM, this.Pump11P, this.Pump11, 4); this.Pump12PDiff = DiffCheck(this.Pump12PM, this.Pump12P, this.Pump12, 4); this.Pump13PDiff = DiffCheck(this.Pump13PM, this.Pump13P, this.Pump13, 4); this.Pump14PDiff = DiffCheck(this.Pump14PM, this.Pump14P, this.Pump14, 4); this.Pump15PDiff = DiffCheck(this.Pump15PM, this.Pump15P, this.Pump15, 4); this.Pump16PDiff = DiffCheck(this.Pump16PM, this.Pump16P, this.Pump16, 4); this.Pump17PDiff = DiffCheck(this.Pump17PM, this.Pump17P, this.Pump17, 4); this.Pump18PDiff = DiffCheck(this.Pump18PM, this.Pump18P, this.Pump18, 4); this.JD1FDiff = Diff(this.JD1FM, this.JD1F, 4); this.JD2FDiff = Diff(this.JD2FM, this.JD2F, 4); this.JD3FDiff = Diff(this.JD3FM, this.JD3F, 4); this.Pump11Diff = DiffCheckPump(this.Pump11M * 50, this.Pump11 * 50, this.Pump11, 2); this.Pump12Diff = DiffCheckPump(this.Pump12M * 50, this.Pump12 * 50, this.Pump12, 2); this.Pump13Diff = DiffCheckPump(this.Pump13M * 50, this.Pump13 * 50, this.Pump13, 2); this.Pump14Diff = DiffCheckPump(this.Pump14M * 50, this.Pump14 * 50, this.Pump14, 2); this.Pump15Diff = DiffCheckPump(this.Pump15M * 50, this.Pump15 * 50, this.Pump15, 2); this.Pump16Diff = DiffCheckPump(this.Pump16M * 50, this.Pump16 * 50, this.Pump16, 2); this.Pump17Diff = DiffCheckPump(this.Pump17M * 50, this.Pump17 * 50, this.Pump17, 2); this.Pump18Diff = DiffCheckPump(this.Pump18M * 50, this.Pump18 * 50, this.Pump18, 2); this.R1 = Round(this.R1, 4); this.R2 = Round(this.R2, 4); this.R3 = Round(this.R3, 4); this.JD1P = Round(this.JD1P, 4); this.JD2P = Round(this.JD2P, 4); this.JD3P = Round(this.JD3P, 4); this.Pump11P = RoundCheck(this.Pump11P, this.Pump11, 4); this.Pump12P = RoundCheck(this.Pump12P, this.Pump12, 4); this.Pump13P = RoundCheck(this.Pump13P, this.Pump13, 4); this.Pump14P = RoundCheck(this.Pump14P, this.Pump14, 4); this.Pump15P = RoundCheck(this.Pump15P, this.Pump15, 4); this.Pump16P = RoundCheck(this.Pump16P, this.Pump16, 4); this.Pump17P = RoundCheck(this.Pump17P, this.Pump17, 4); this.Pump18P = RoundCheck(this.Pump18P, this.Pump18, 4); this.JD1F = Round(this.JD1F, 4); this.JD2F = Round(this.JD2F, 4); this.JD3F = Round(this.JD3F, 4); this.Pump11 = Round(this.Pump11 * 50, 2, true); this.Pump12 = Round(this.Pump12 * 50, 2, true); this.Pump13 = Round(this.Pump13 * 50, 2, true); this.Pump14 = Round(this.Pump14 * 50, 2, true); this.Pump15 = Round(this.Pump15 * 50, 2, true); this.Pump16 = Round(this.Pump16 * 50, 2, true); this.Pump17 = Round(this.Pump17 * 50, 2, true); this.Pump18 = Round(this.Pump18 * 50, 2, true); this.JD1PM = Round(this.JD1PM, 4); this.JD2PM = Round(this.JD2PM, 4); this.JD3PM = Round(this.JD3PM, 4); this.Pump11PM = RoundCheck(this.Pump11PM, this.Pump11, 4); this.Pump12PM = RoundCheck(this.Pump12PM, this.Pump12, 4); this.Pump13PM = RoundCheck(this.Pump13PM, this.Pump13, 4); this.Pump14PM = RoundCheck(this.Pump14PM, this.Pump14, 4); this.Pump15PM = RoundCheck(this.Pump15PM, this.Pump15, 4); this.Pump16PM = RoundCheck(this.Pump16PM, this.Pump16, 4); this.Pump17PM = RoundCheck(this.Pump17PM, this.Pump17, 4); this.Pump18PM = RoundCheck(this.Pump18PM, this.Pump18, 4); this.JD1FM = Round(this.JD1FM, 4); this.JD2FM = Round(this.JD2FM, 4); this.JD3FM = Round(this.JD3FM, 4); this.Pump11M = RoundCheck(this.Pump11M * 50, this.Pump11M, 2, true); this.Pump12M = RoundCheck(this.Pump12M * 50, this.Pump12M, 2, true); this.Pump13M = RoundCheck(this.Pump13M * 50, this.Pump13M, 2, true); this.Pump14M = RoundCheck(this.Pump14M * 50, this.Pump14M, 2, true); this.Pump15M = RoundCheck(this.Pump15M * 50, this.Pump15M, 2, true); this.Pump16M = RoundCheck(this.Pump16M * 50, this.Pump16M, 2, true); this.Pump17M = RoundCheck(this.Pump17M * 50, this.Pump17M, 2, true); this.Pump18M = RoundCheck(this.Pump18M * 50, this.Pump18M, 2, true); this.TotalPower = (double)this.Round(this.TotalPower, 2); this.TotalPowerM = (double)this.Round(this.TotalPowerM, 2); var run_flags = IntListHelper.ToList(this.RunFlags); var run_flags_m = new List(); if (this.Pump11M > 0) run_flags_m.Add(11); if (this.Pump12M > 0) run_flags_m.Add(12); if (this.Pump13M > 0) run_flags_m.Add(13); if (this.Pump14M > 0) run_flags_m.Add(14); if (this.Pump15M > 0) run_flags_m.Add(15); if (this.Pump16M > 0) run_flags_m.Add(16); if (this.Pump17M > 0) run_flags_m.Add(17); if (this.Pump18M > 0) run_flags_m.Add(18); this.RunFlagsM = IntListHelper.ToString(run_flags_m); if (!string.IsNullOrEmpty(this.RunFlagsM)) { var start_flag_list = run_flags.Except(run_flags_m); var close_flag_list = run_flags_m.Except(run_flags); if (start_flag_list != null && start_flag_list.Any()) { this.RunFlagsDiff += $"close:{IntListHelper.ToString(start_flag_list)} "; } if (close_flag_list != null && close_flag_list.Any()) { this.RunFlagsDiff += $"open:{IntListHelper.ToString(close_flag_list)} "; } this.TotalPowerDiff = (double)Diff(this.TotalPowerM, this.TotalPower, 2); } else { this.RunFlagsDiff = "异常"; } } /// /// Round /// /// /// private double? Round(double? t, int digits, bool filter_zero = false) { if (t.HasValue && t.Value != 0) { t = Math.Round(t.Value, digits); } if (filter_zero && t == 0) { return null; } return t; } /// /// Round /// /// /// private double? RoundCheck(double? t, double? check, int digits, bool filter_zero = false) { if (check.HasValue && check.Value != 0) { if (t.HasValue && t.Value != 0) { t = Math.Round(t.Value, digits); } if (filter_zero && t == 0) { return null; } return t; } return null; } /// /// Diff /// /// /// /// private double? Diff(double? subtraction, double? minuend, int digits) { var t = subtraction - minuend; return Round(t, digits); } /// /// DiffCheck /// /// /// /// private double? DiffCheck(double? subtraction, double? minuend, double? check, int digits) { double? t = null; if (check.HasValue && check.Value != 0) { t = subtraction - minuend; } return Round(t, digits); } /// /// DiffCheck /// /// /// /// private double? DiffCheckPump(double? subtraction, double? minuend, double? check, int digits) { double? t = null; if ((check.HasValue && check.Value != 0) || (subtraction.HasValue && subtraction.Value != 0)) { t = subtraction - minuend; } return Round(t, digits); } #endregion #region To public Dictionary ToFlagRpmDict() { return new Dictionary { { GlobalHelper.Flag11, this.Pump11 ?? 0 * 590 }, { GlobalHelper.Flag12, this.Pump12 ?? 0 * 590 }, { GlobalHelper.Flag13, this.Pump13 ?? 0 * 590 }, { GlobalHelper.Flag14, this.Pump14 ?? 0 * 590 }, { GlobalHelper.Flag15, this.Pump15 ?? 0 * 590 }, { GlobalHelper.Flag16, this.Pump16 ?? 0 * 590 }, { GlobalHelper.Flag17, this.Pump17 ?? 0 * 590 }, { GlobalHelper.Flag18, this.Pump18 ?? 0 * 590 } }; } public Dictionary ToFlagInletWaterLevelDict() { return new Dictionary { { GlobalHelper.Flag11, this.R3 ?? 0 }, { GlobalHelper.Flag12, this.R3 ?? 0 }, { GlobalHelper.Flag13, this.R3 ?? 0 }, { GlobalHelper.Flag14, this.R2 ?? 0 }, { GlobalHelper.Flag15, this.R2 ?? 0 }, { GlobalHelper.Flag16, this.R1 ?? 0 }, { GlobalHelper.Flag17, this.R1 ?? 0 }, { GlobalHelper.Flag18, this.R1 ?? 0 } }; } public Dictionary ToFlagHeadDict() { return new Dictionary { { GlobalHelper.Flag11, this.Pump11P ?? 0 }, { GlobalHelper.Flag12, this.Pump12P ?? 0 }, { GlobalHelper.Flag13, this.Pump13P ?? 0 }, { GlobalHelper.Flag14, this.Pump14P ?? 0 }, { GlobalHelper.Flag15, this.Pump15P ?? 0 }, { GlobalHelper.Flag16, this.Pump16P ?? 0 }, { GlobalHelper.Flag17, this.Pump17P ?? 0 }, { GlobalHelper.Flag18, this.Pump18P ?? 0 } }; } public Dictionary ToModelPatternDict() { return new Dictionary() { {"R1", new float[]{(float)this.R1}}, {"R2", new float[]{(float)this.R2}}, {"R3", new float[]{(float)this.R3}}, {"SFJD1", new float[]{(float)this.JD1F}}, {"SFJD2", new float[]{(float)this.JD2F}}, {"SFJD3", new float[]{(float)this.JD3F}}, {"Pump11", new float[]{(float)this.Pump11}}, {"Pump12", new float[]{(float)this.Pump12}}, {"Pump13", new float[]{(float)this.Pump13}}, {"Pump14", new float[]{(float)this.Pump14}}, {"Pump15", new float[]{(float)this.Pump15}}, {"Pump16", new float[]{(float)this.Pump16}}, {"Pump17", new float[]{(float)this.Pump17}}, {"Pump18", new float[]{(float)this.Pump18}}, }; } public Dictionary ToModelPumpDict() { return new Dictionary() { {"SPPump11", this.Pump11 ??0 }, {"SPPump12", this.Pump12 ??0}, {"SPPump13", this.Pump13 ??0}, {"SPPump14", this.Pump14 ??0}, {"SPPump15", this.Pump15 ??0}, {"SPPump16", this.Pump16 ??0}, {"SPPump17", this.Pump17 ??0}, {"SPPump18", this.Pump18 ??0}, }; } public Dictionary ToModelScadaDict() { return new Dictionary() { { "SPJD1",this.JD1P??0}, { "SPJD2",this.JD2P??0}, { "SPJD3",this.JD3P??0}, { "SPPump11" ,this.Pump11P??0}, { "SPPump12" ,this.Pump12P??0}, { "SPPump13" ,this.Pump13P??0}, { "SPPump14" ,this.Pump14P??0}, { "SPPump15" ,this.Pump15P??0}, { "SPPump16" ,this.Pump16P??0}, { "SPPump17" ,this.Pump17P??0}, { "SPPump18" ,this.Pump18P??0}, { "SFJD1",this.JD1F??0}, { "SFJD2",this.JD2F??0}, { "SFJD3",this.JD3F??0}, }; } #endregion [Display(Name = "时间")] public DateTime Time { get; set; } #region Scada #region 统计 [Display(Name = "总流量")] public double TotalFlow { get; set; } [Display(Name = "总扬程")] public double TotalHead { get; set; } [Display(Name = "总功率")] public double TotalPower { get; set; } [Display(Name = "运行组合")] public string RunFlags { get; set; } [Display(Name = "运行数量")] public int RunCount { get; set; } #endregion #region 水位 [Display(Name = "新前池液位1")] public double? R1 { get; set; } [Display(Name = "老前池北侧液位2")] public double? R2 { get; set; } [Display(Name = "老前池南侧液位3")] public double? R3 { get; set; } #endregion #region 压力 [Display(Name = "压力嘉定1")] public double? JD1P { get; set; } [Display(Name = "压力嘉定2")] public double? JD2P { get; set; } [Display(Name = "压力嘉定3")] public double? JD3P { get; set; } [Display(Name = "压力11")] public double? Pump11P { get; set; } [Display(Name = "压力12")] public double? Pump12P { get; set; } [Display(Name = "压力13")] public double? Pump13P { get; set; } [Display(Name = "压力14")] public double? Pump14P { get; set; } [Display(Name = "压力15")] public double? Pump15P { get; set; } [Display(Name = "压力16")] public double? Pump16P { get; set; } [Display(Name = "压力17")] public double? Pump17P { get; set; } [Display(Name = "压力18")] public double? Pump18P { get; set; } #endregion #region 流量 [Display(Name = "流量嘉定1")] public double? JD1F { get; set; } [Display(Name = "流量嘉定2")] public double? JD2F { get; set; } [Display(Name = "流量嘉定3")] public double? JD3F { get; set; } #endregion #region 频率 [Display(Name = "频率11")] public double? Pump11 { get; set; } [Display(Name = "频率12")] public double? Pump12 { get; set; } [Display(Name = "频率13")] public double? Pump13 { get; set; } [Display(Name = "频率14")] public double? Pump14 { get; set; } [Display(Name = "频率15")] public double? Pump15 { get; set; } [Display(Name = "频率16")] public double? Pump16 { get; set; } [Display(Name = "频率17")] public double? Pump17 { get; set; } [Display(Name = "频率18")] public double? Pump18 { get; set; } #endregion #endregion #region Model #region 统计 [Display(Name = "总功率")] public double TotalPowerM { get; set; } [Display(Name = "运行组合")] public string RunFlagsM { get; set; } #endregion #region 压力 [Display(Name = "压力嘉定1")] public double? JD1PM { get; set; } [Display(Name = "压力嘉定2")] public double? JD2PM { get; set; } [Display(Name = "压力嘉定3")] public double? JD3PM { get; set; } [Display(Name = "压力11")] public double? Pump11PM { get; set; } [Display(Name = "压力12")] public double? Pump12PM { get; set; } [Display(Name = "压力13")] public double? Pump13PM { get; set; } [Display(Name = "压力14")] public double? Pump14PM { get; set; } [Display(Name = "压力15")] public double? Pump15PM { get; set; } [Display(Name = "压力16")] public double? Pump16PM { get; set; } [Display(Name = "压力17")] public double? Pump17PM { get; set; } [Display(Name = "压力18")] public double? Pump18PM { get; set; } #endregion #region 流量 [Display(Name = "流量嘉定1")] public double? JD1FM { get; set; } [Display(Name = "流量嘉定2")] public double? JD2FM { get; set; } [Display(Name = "流量嘉定3")] public double? JD3FM { get; set; } #endregion #region 频率 [Display(Name = "频率11")] public double? Pump11M { get; set; } [Display(Name = "频率12")] public double? Pump12M { get; set; } [Display(Name = "频率13")] public double? Pump13M { get; set; } [Display(Name = "频率14")] public double? Pump14M { get; set; } [Display(Name = "频率15")] public double? Pump15M { get; set; } [Display(Name = "频率16")] public double? Pump16M { get; set; } [Display(Name = "频率17")] public double? Pump17M { get; set; } [Display(Name = "频率18")] public double? Pump18M { get; set; } #endregion #endregion #region Diff #region 统计 [Display(Name = "总功率")] public double TotalPowerDiff { get; set; } [Display(Name = "运行组合")] public string RunFlagsDiff { get; set; } #endregion #region 压力 [Display(Name = "压力嘉定1")] public double? JD1PDiff { get; set; } [Display(Name = "压力嘉定2")] public double? JD2PDiff { get; set; } [Display(Name = "压力嘉定3")] public double? JD3PDiff { get; set; } [Display(Name = "压力11")] public double? Pump11PDiff { get; set; } [Display(Name = "压力12")] public double? Pump12PDiff { get; set; } [Display(Name = "压力13")] public double? Pump13PDiff { get; set; } [Display(Name = "压力14")] public double? Pump14PDiff { get; set; } [Display(Name = "压力15")] public double? Pump15PDiff { get; set; } [Display(Name = "压力16")] public double? Pump16PDiff { get; set; } [Display(Name = "压力17")] public double? Pump17PDiff { get; set; } [Display(Name = "压力18")] public double? Pump18PDiff { get; set; } #endregion #region 流量 [Display(Name = "流量嘉定1")] public double? JD1FDiff { get; set; } [Display(Name = "流量嘉定2")] public double? JD2FDiff { get; set; } [Display(Name = "流量嘉定3")] public double? JD3FDiff { get; set; } #endregion #region 频率 [Display(Name = "频率11")] public double? Pump11Diff { get; set; } [Display(Name = "频率12")] public double? Pump12Diff { get; set; } [Display(Name = "频率13")] public double? Pump13Diff { get; set; } [Display(Name = "频率14")] public double? Pump14Diff { get; set; } [Display(Name = "频率15")] public double? Pump15Diff { get; set; } [Display(Name = "频率16")] public double? Pump16Diff { get; set; } [Display(Name = "频率17")] public double? Pump17Diff { get; set; } [Display(Name = "频率18")] public double? Pump18Diff { get; set; } #endregion #endregion public Model.ScheduleConclusion ScheduleConclusion { get; set; } public List SchedulePumpList { get; set; } } }