| | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | |
| | | namespace IStation |
| | |
| | | /// <returns></returns> |
| | | public static bool IsStation2(IEnumerable<int> flags) |
| | | { |
| | | if (flags==null|| !flags.Any()) |
| | | if (flags == null || !flags.Any()) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | {Flag26, 二输26泵_泵井液位}, |
| | | {Flag27, 二输27泵_泵井液位} |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 泵标志出口压力映射字典 1输水 |
| | | /// </summary> |
| | |
| | | {Flag26, 二输26泵_瞬时流量}, |
| | | {Flag27, 二输27泵_瞬时流量} |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 泵标志转速映射字典 1输水 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region 模型映射 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 总管流量点映射字典 |
| | | /// </summary> |
| | | public readonly static List<string> Pipe1FlowIdList = new List<string>{ |
| | | "SFJD1" , |
| | | "SFJD2" , |
| | | "SFJD3" |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 总管流量点映射字典 |
| | | /// </summary> |
| | | public readonly static List<string> Pipe2FlowIdList = new List<string>{ |
| | | "SFDN2400", |
| | | "SFDN2700", |
| | | }; |
| | | |
| | | public static List<string> GetPipeFlowIdList(int station_index) |
| | | { |
| | | var list = new List<string>(); |
| | | if (station_index == 1) |
| | | { |
| | | list = Pipe1FlowIdList; |
| | | } |
| | | else |
| | | { |
| | | list = Pipe2FlowIdList; |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 总管压力点映射字典 |
| | | /// </summary> |
| | | public readonly static List<string> Pipe1PressureIdList = new List<string>{ |
| | | "SPJD1" , |
| | | "SPJD2" , |
| | | "SPJD3" |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 总管压力点映射字典 |
| | | /// </summary> |
| | | public readonly static List<string> Pipe2PressureIdList = new List<string>{ |
| | | "SPDN2400" , |
| | | "SPDN2700" , |
| | | }; |
| | | public static List<string> GetPipePressureIdList(int station_index) |
| | | { |
| | | var list = new List<string>(); |
| | | if (station_index == 1) |
| | | { |
| | | list = Pipe1PressureIdList; |
| | | } |
| | | else |
| | | { |
| | | list = Pipe2PressureIdList; |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 模型流量点映射字典 |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取泵进口水位字典 |
| | | /// </summary> |
| | | public static Dictionary<int, double> GetFlagInletWaterLevelDict(int station_index, Dictionary<string, double> record_dict) |
| | | { |
| | | if (station_index == 1) |
| | | { |
| | | var flagInletWaterLevelMappingDict1 = new Dictionary<int, string>() |
| | | { |
| | | {Flag11, "R3"}, |
| | | {Flag12, "R3"}, |
| | | {Flag13, "R3"}, |
| | | {Flag14, "R2"}, |
| | | {Flag15, "R2"}, |
| | | {Flag16, "R1"}, |
| | | {Flag17, "R1"}, |
| | | {Flag18, "R1"} |
| | | }; |
| | | var station1_flag_inlet_water_level_dict = new Dictionary<int, double>(); |
| | | foreach (var mapping in flagInletWaterLevelMappingDict1) |
| | | { |
| | | var flag = mapping.Key; |
| | | var code = mapping.Value; |
| | | var water_level = 0d; |
| | | |
| | | water_level = record_dict[code]; |
| | | station1_flag_inlet_water_level_dict.Add(flag, water_level); |
| | | } |
| | | return station1_flag_inlet_water_level_dict; |
| | | } |
| | | else |
| | | { |
| | | var flagInletWaterLevelMappingDict2 = new Dictionary<int, string>() |
| | | { |
| | | {Flag21, "RPump21"}, |
| | | {Flag22, "RPump22"}, |
| | | {Flag23, "RPump23"}, |
| | | {Flag24, "RPump24"}, |
| | | {Flag25, "RPump25"}, |
| | | {Flag26, "RPump26"}, |
| | | {Flag27, "RPump27"} |
| | | }; |
| | | |
| | | var station2_flag_inlet_water_level_dict = new Dictionary<int, double>(); |
| | | foreach (var mapping in flagInletWaterLevelMappingDict2) |
| | | { |
| | | var flag = mapping.Key; |
| | | var code = mapping.Value; |
| | | var water_level = 0d; |
| | | |
| | | water_level = record_dict[code]; |
| | | station2_flag_inlet_water_level_dict.Add(flag, water_level); |
| | | } |
| | | return station2_flag_inlet_water_level_dict; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | private class ChScheduleConfig |
| | | { |
| | | /// <summary> |
| | | /// 一输水 |
| | | /// </summary> |
| | | public Dto.ScheduleConfig Station1 { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 二输水 |
| | | /// </summary> |
| | | public Dto.ScheduleConfig Station2 { get; set; } |
| | | } |
| | | |
| | | private static ChScheduleConfig _config = null; |
| | | /// <summary> |
| | | /// 获取泵进口水位字典 |
| | | /// </summary> |
| | | public static Dto.ScheduleConfig GetScheduleConfig(int station_index) |
| | | { |
| | | if (_config == null) |
| | | { |
| | | var filePath = $"{DAL.FileHelper.GetDataFolder()}\\ScheduleConfig.json"; |
| | | if (!File.Exists(filePath)) |
| | | return default; |
| | | var json = File.ReadAllText(filePath); |
| | | _config = JsonHelper.Json2Object<ChScheduleConfig>(json); |
| | | } |
| | | |
| | | if (station_index == 1) |
| | | { |
| | | return _config.Station1; |
| | | } |
| | | else |
| | | { |
| | | return _config.Station2; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |