tangxu
2024-08-01 9fe74fc1c8dfb27733888160fd2d63908e26acd4
Calc/IStation.Calc.Core/µÝ¹é¼ÆËã2/ErQuCalcHelper_2_µÝ¹é.cs
@@ -24,8 +24,7 @@
        /// <returns></returns>
        protected IStation.CalcModel.AnaPrj ToAnaPrj(BlockItemList opt_bundle)
        {
            LogHelper.Info(_startOpenPumpCount.ToString());
            LogHelper.Info(JsonHelper.Object2Json(_startOpenPumpArray));
            if (this._startOpenPumpCount == -1 || _startOpenPumpArray == null)
            {//不知道开始的状态
                return ToAnaPrj未知开始状态(opt_bundle);
@@ -143,7 +142,7 @@
            #region å¤„理第一个
            int block_id = 0;
            if (first_open_block_time_item.StartIndx > 1)
            if (first_open_block_time_item.StartIndx > 1 )
            {//开始时就关机
                block_id++;
                var bt1 = BuildAnaPrjBlockTime(block_id, 0, 0, first_open_block_time_item.StartIndx,
@@ -223,6 +222,8 @@
            var pumpSwitchList = new List<AnaPrjSwitchInfo>();
            var first_block_item = all_time_block.First();
            int switch_group_id = 1;
            //开始状态
            //IStation.LogHelper.Info("_startOpenPumpArray:"+_startOpenPumpArray + ",first_block_item.OpenPumpCount:" + first_block_item.OpenPumpCount);
            if (BuildSwitchPumpIndexArray(ref pumpSwitchList, switch_group_id, ref first_block_item, this._startOpenPumpArray))
            {
                switch_group_id++;
@@ -236,7 +237,9 @@
                    switch_group_id++;
                }
            }
            //
            switch_group_id++;
            BuildSwitchPumpIndexArray4Finish(ref pumpSwitchList, switch_group_id, all_time_block.Last());
            #region è®¡ç®—具体时间, ä¿è¯æ—¶é—´é—´éš”, è€ƒè™‘顺序
            var max_switch_group_id = switch_group_id;
@@ -305,7 +308,7 @@
            //结束时的泵允许状态
            opt_prj.EndTimeOpenPumpStatus = all_time_block.Last().OpenPumpIndexs;
            IStation.LogHelper.Info("pumpSwitchList count:" + pumpSwitchList.Count);
            //IStation.LogHelper.Info("pumpSwitchList count:" + pumpSwitchList.Count);
            opt_prj.PumpSwitchs = pumpSwitchList;
@@ -444,6 +447,49 @@
            }
        }
        //
        private bool BuildSwitchPumpIndexArray4Finish(
            ref List<AnaPrjSwitchInfo> sw_list,
            int switch_group_id,
              AnaPrjBlockTime current_block_time_item
            )
        {
            if (current_block_time_item.EndTimeIndex < this._timeList.Count -2)
                return false ;
                if (current_block_time_item.OpenPumpCount == 0)
                {//表示不用切泵
                    return false;
                }
            var lastOpenPumpIndexs = current_block_time_item.OpenPumpIndexs;
            if (lastOpenPumpIndexs == null || lastOpenPumpIndexs.Count() == 0)
            {
                return false;
            }
                foreach (var idx in IStation.AnaGlobalParas.Setting.OptimalPumpIndexSequence)
                    {
                        if (!lastOpenPumpIndexs.Contains(idx))
                            continue;//原来都没开, å°±ä¸ç”¨è€ƒè™‘
                        current_block_time_item.EndSwitchGroupID = switch_group_id;
                            sw_list.Add(new AnaPrjSwitchInfo()
                            {
                                GroupID = switch_group_id,
                                SwitchType = 0,//关闭
                                Time = current_block_time_item.EndTime,
                                PumpIndex = idx
                            });
                    }
                return true;
        }
        private AnaPrjBlockTime BuildAnaPrjBlockTime(int block_id, int open_pump_count,
            int start_indx, int end_index,
            double reservoir_start_height, double reservoir_end_height)