| | |
| | | using IStation.Model; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Linq; |
| | | |
| | | namespace IStation.Calc |
| | | { |
| | |
| | | /// <returns></returns> |
| | | public static IStation.Calc.ErQuCalcBaseHelper Build(IStation.CalcModel.AnaRequest anaRequest) |
| | | { |
| | | if (anaRequest.MaxLimitWaterBoxLevel != null) |
| | | if (anaRequest.MaxReservoirLevel != null) |
| | | { |
| | | DateTime? limit_time = GetMaxLimitWaterBoxTime(anaRequest); |
| | | DateTime? limit_time = GetMaxReservoirLevelTime(anaRequest); |
| | | |
| | | if(limit_time == null) |
| | | if (limit_time == null) |
| | | { |
| | | var calc = new IStation.Calc.ErQuCalcHelper_2_éå½_宿°´ä½_ä»»ææ¶é´(); |
| | | calc.SetMaxReservoirHeight(anaRequest.MaxLimitWaterBoxLevel.Value); |
| | | |
| | | calc.SetMaxReservoirHeight(anaRequest.MaxReservoirLevel.Value); |
| | | |
| | | return calc; |
| | | } |
| | | else |
| | | { |
| | | var calc = new IStation.Calc.ErQuCalcHelper_2_éå½_宿°´ä½_æå®æ¶é´(); |
| | | calc.SetMaxReservoirHeight(anaRequest.MaxLimitWaterBoxLevel.Value, limit_time.Value); |
| | | return calc; |
| | | calc.SetMaxReservoirHeight(anaRequest.MaxReservoirLevel.Value, limit_time.Value); |
| | | return calc; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return new IStation.Calc.ErQuCalcHelper_2_éå½_宿°´é(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private static DateTime? GetMaxLimitWaterBoxTime(IStation.CalcModel.AnaRequest anaRequest) |
| | | { |
| | | if (string.IsNullOrEmpty(anaRequest.MaxLimitWaterBoxTime)) |
| | | private static DateTime? GetMaxReservoirLevelTime(IStation.CalcModel.AnaRequest anaRequest) |
| | | { |
| | | if (string.IsNullOrEmpty(anaRequest.MaxReservoirLevelTime)) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | DateTime time; |
| | | if (DateTime.TryParse(anaRequest.MaxLimitWaterBoxTime, out time)) |
| | | if (DateTime.TryParse(anaRequest.MaxReservoirLevelTime, out time)) |
| | | { |
| | | return time; |
| | | } |
| | | |
| | | if (anaRequest.MaxLimitWaterBoxTime.Contains(":")) |
| | | if (anaRequest.MaxReservoirLevelTime.Contains(":")) |
| | | { |
| | | var sss = anaRequest.MaxLimitWaterBoxTime.Split(':'); |
| | | if(sss.Count() == 2) |
| | | var sss = anaRequest.MaxReservoirLevelTime.Split(':'); |
| | | if (sss.Count() == 2) |
| | | { |
| | | int hour = 0; |
| | | int miut = 0; |
| | |
| | | else |
| | | return new DateTime(anaRequest.StartTime.Year, anaRequest.StartTime.Month, anaRequest.StartTime.Day, hour, miut, 0); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int hour = 0; |
| | | if (int.TryParse(anaRequest.MaxLimitWaterBoxTime, out hour)) |
| | | if (int.TryParse(anaRequest.MaxReservoirLevelTime, out hour)) |
| | | { |
| | | if (hour < anaRequest.StartTime.Hour) |
| | | return new DateTime(anaRequest.EndTime.Year, anaRequest.EndTime.Month, anaRequest.EndTime.Day, hour, 0, 0); |
| | |
| | | return new DateTime(anaRequest.StartTime.Year, anaRequest.StartTime.Month, anaRequest.StartTime.Day, hour, 0, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | return null; |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="anaRequest"></param> |
| | | public void SetAnaRequest(IStation.CalcModel.AnaRequest anaRequest) |
| | | { |
| | | this._start_levelæ°´åºæ°´ä½ = anaRequest.CurrentWaterBoxLevel; |
| | | this._startOpenCount = anaRequest.StartOpenCount; |
| | | this._start_levelæ°´åºæ°´ä½ = anaRequest.StartReservoirLevel; |
| | | this._clacOptType = anaRequest.CalcOptType; |
| | | |
| | | |
| | | if(anaRequest.IsKnownStartOpenPump) |
| | | { |
| | | if(anaRequest.StartOpenPumpIndexArray == null) |
| | | {//没æèµå¼å°±æ¯è¡¨ç¤ºä¸ç¥é, 妿é½ä¸å¼æº, èµå¼[] |
| | | this._startOpenPumpCount = -1; |
| | | } |
| | | else |
| | | { |
| | | this._startOpenPumpArray = anaRequest.StartOpenPumpIndexArray; |
| | | this._startOpenPumpCount = anaRequest.StartOpenPumpIndexArray.Count; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | this._startOpenPumpCount = -1; |
| | | } |
| | | |
| | | if (anaRequest.TotalFlowIn != null) |
| | | this._stationTotalFlow = anaRequest.TotalFlowIn.Value; |
| | |
| | | |
| | | this.SetRiverWaterLevels(anaRequest.WaterLevelsé¿æ±); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è®¡ç®æä¼ |
| | | /// </summary> |
| | | /// <param name="TargetFlowTotal"></param> |
| | | /// <param name="error_info"></param> |
| | | /// <returns></returns> |
| | | public virtual List<AnaPrj> CalcOptPrjs(out string error_info) |
| | | public virtual AnaPrj CalcOptPrj(out string error_info) |
| | | { |
| | | error_info = null; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | List<AnaPrj> listPrj; |
| | | // List<AnaPrj> listPrj; |
| | | System.Diagnostics.Stopwatch sw2 = new System.Diagnostics.Stopwatch(); |
| | | sw2.Start(); |
| | | |
| | |
| | | CalcTimeData(dd_minute); |
| | | |
| | | // çæ£å¼å§åæ |
| | | listPrj = CalcOptPrjsCore(); |
| | | var optPrj = CalcOptPrjsCore(); |
| | | sw2.Stop(); |
| | | |
| | | |
| | |
| | | // Thread.Sleep(20 * 1000); |
| | | //} |
| | | |
| | | if (listPrj == null || listPrj.Count == 0) |
| | | if (optPrj == null) |
| | | { |
| | | error_info = "æªæ¾å°åéçè°åº¦æ¹æ¡"; |
| | | return null; |
| | | } |
| | | foreach (var prj in listPrj) |
| | | { |
| | | prj.StartTime = this._calStartTime; |
| | | prj.EndTime = this._calEndTime; |
| | | } |
| | | |
| | | optPrj.StartTime = this._calStartTime; |
| | | optPrj.EndTime = this._calEndTime; |
| | | |
| | | |
| | | |
| | | OnShowDebugInfo.Invoke(string.Format("计ç®ç¨æ¶: {0} ç§", seconds)); |
| | | |
| | | return listPrj; |
| | | return optPrj; |
| | | } |
| | | |
| | | |
| | |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | protected virtual List<AnaPrj> CalcOptPrjsCore() |
| | | protected virtual AnaPrj CalcOptPrjsCore() |
| | | { |
| | | return null; |
| | | } |
| | |
| | | /// ä¸è®¸åæ³µæ¶é´ |
| | | /// </summary> |
| | | protected List<IStation.CalcModel.TimeRange> _limitSwitchPumpTimes = null; |
| | | public List<IStation.CalcModel.TimeRange> LimitSwitchPumpTimes { get { return _limitSwitchPumpTimes; } set { _limitSwitchPumpTimes = value; } } |
| | | public List<IStation.CalcModel.TimeRange> LimitSwitchPumpTimes |
| | | { |
| | | get { return _limitSwitchPumpTimes; } |
| | | set |
| | | { |
| | | _limitSwitchPumpTimes = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¸è®¸å¼æ³µæ¶é´ |
| | | /// </summary> |
| | | protected List<IStation.CalcModel.TimeRange> _limitOpenPumpTimes = null; |
| | | public List<IStation.CalcModel.TimeRange> LimitOpenPumpTimes { get { return _limitOpenPumpTimes; } set { _limitOpenPumpTimes = value; } } |
| | | public List<IStation.CalcModel.TimeRange> LimitOpenPumpTimes |
| | | { |
| | | get { return _limitOpenPumpTimes; } |
| | | set |
| | | { |
| | | _limitOpenPumpTimes = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | /// <summary> |
| | | /// åå§å弿ºå°æ° |
| | | /// </summary> |
| | | protected int _startOpenCount = -1; |
| | | public int StartOpenCount { get => _startOpenCount; set => _startOpenCount = value; } |
| | | protected int _startOpenPumpCount = -1; |
| | | protected List<int> _startOpenPumpArray = null; |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |