Example #1
0
        private void ComboBoxFlightRegimeSelectedIndexChanged(object sender, EventArgs e)
        {
            _prevFlightRegime = _flightRegime;
            _flightRegime     = comboBoxFlightRegime.SelectedItem as FlightRegime;

            CheckParametres();
            InvokeFligthRegimeChanget();
        }
Example #2
0
        /*
         * Реализация StringConvertibleObject
         */

        #region public EnginesGeneralCondition(string Data) : base(Data)

        /// <summary>
        /// Создает объект и заполняет данными
        /// </summary>
        /// <param name="source"></param>
        public EnginesGeneralCondition(EngineCondition source)
        {
            _pressALT     = source.PressALT.ToString();
            _timeGMT      = source.TimeGMT;
            _grossWeight  = source.GrossWeight;
            _ias          = source.IAS;
            _mach         = source.Mach;
            _tat          = source.TAT;
            _oat          = source.OAT;
            _flightRegine = source.FlightRegime;
            _groundAir    = source.GroundAir;
            _weather      = source.Weather;
        }
Example #3
0
        /// <summary>
        /// Перегружаем для отладки
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string res = "";

            if (BaseComponent != null)
            {
                res += (BaseComponent + " ");
            }
            if (FlightRegime != null)
            {
                res += FlightRegime.ToString();
            }
            return(res);
        }
Example #4
0
        private void ConditionControlWorkTimeChanget(object sender, EventArgs e)
        {
            if (sender as PowerUnitTimeInRegimeControlItem == null)
            {
                return;
            }
            BaseComponent powerUnit = ((PowerUnitTimeInRegimeControlItem)sender).PowerUnit;
            FlightRegime  fr        = ((PowerUnitTimeInRegimeControlItem)sender).FlightRegime;

            if (powerUnit != null)
            {
                SetWorkTimeGA(powerUnit, fr);
            }
        }
 public EngineTimeInRegimeView(EngineTimeInRegime source)
 {
     if (source == null)
     {
         return;
     }
     Id              = source.Id;
     FlightId        = source.FlightId;
     BaseComponentId = source.EngineId;
     FlightRegimeId  = source.FlightRegimeId;
     TimeInRegime    = new TimeSpan(0, source.TimeInRegime.HasValue ? source.TimeInRegime.Value : 0, 0);
     RecordDate      = source.RecordDate;
     GroundAir       = source.GroundAir;
     FlightRegime    = FlightRegime.GetItemById(source.FlightRegimeId.HasValue ? source.FlightRegimeId.Value : -1);
     BaseComponent   = new BaseComponentView(source.Component);
 }
Example #6
0
        /// <summary>
        /// Возвращает (задает) наработку на заданное число и по заданному режиму
        /// </summary>
        /// <param name="flightRegime"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        private Lifelength this[DateTime date, FlightRegime flightRegime]
        {
            get
            {
                if (flightRegime == null)
                {
                    flightRegime = FlightRegime.UNK;
                }

                if (_Array.ContainsKey(flightRegime))
                {
                    if (_Array[flightRegime] == null)
                    {
                        _Array[flightRegime] = new SortedDictionary <DateTime, Lifelength>();
                    }
                }
                else
                {
                    _Array.Add(flightRegime, new SortedDictionary <DateTime, Lifelength>());
                }

                SortedDictionary <DateTime, Lifelength> array = _Array[flightRegime];

                if (date.Date > DateTime.Today)
                {
                    Lifelength res = _Array.Count > 0 ? new Lifelength(array.Last().Value) : Lifelength.Zero;
                    res.Add(LifelengthSubResource.Calendar, (date.Date - DateTime.Today).Days);
                    return(res);
                }
                if (date.Date < _startDate.Date)
                {
                    return(new Lifelength((_startDate.Date - date.Date).Days, 0, 0));
                }
                return(array.ContainsKey(date.Date) ? array[date.Date] : null);
            }
            set
            {
                if (flightRegime == null)
                {
                    flightRegime = FlightRegime.UNK;
                }

                if (_Array.ContainsKey(flightRegime))
                {
                    if (_Array[flightRegime] == null)
                    {
                        _Array[flightRegime] = new SortedDictionary <DateTime, Lifelength>();
                    }
                }
                else
                {
                    _Array.Add(flightRegime, new SortedDictionary <DateTime, Lifelength>());
                }

                SortedDictionary <DateTime, Lifelength> array = _Array[flightRegime];

                if (array.ContainsKey(date.Date))
                {
                    array[date.Date] = value;
                }
                else
                {
                    if (date.Date >= _startDate.Date && date.Date <= DateTime.Today)
                    {
                        array.Add(date.Date, value);
                    }
                }
            }
        }
Example #7
0
 /// <summary>
 /// Устанавливает подсчитанную наработку на конец дня на заданном режиме
 /// </summary>
 /// <param name="date">День на который необходимо вернуть наработку</param>
 /// <param name="flightRegime">режим работы</param>
 /// <param name="value">значение подсчитанной наработки</param>
 /// <returns></returns>
 public void SetClosingLifelength(DateTime date, FlightRegime flightRegime, Lifelength value)
 {
     this[date, flightRegime ?? FlightRegime.UNK] = value;
 }
Example #8
0
 /// <summary>
 /// Подсчитанная наработка на конец дня
 /// </summary>
 /// <param name="date">День на который необходимо вернуть наработку</param>
 /// <param name="flightRegime">режим работы</param>
 /// <returns></returns>
 public Lifelength GetLifelengthOnEndOfDay(DateTime date, FlightRegime flightRegime)
 {
     return(this[date, flightRegime ?? FlightRegime.UNK]);
 }
Example #9
0
 /// <summary>
 /// Устанавливает подсчитанную наработку на начало дня на заданном режиме
 /// </summary>
 /// <param name="date">День на который необходимо вернуть наработку</param>
 /// <param name="flightRegime">режим работы</param>
 /// <param name="value">значение подсчитанной наработки</param>
 /// <returns></returns>
 public void SetLifelengthOnStartOfDay(DateTime date, FlightRegime flightRegime, Lifelength value)
 {
     this[date.AddDays(-1), flightRegime ?? FlightRegime.UNK] = value;
 }
Example #10
0
        ///// <summary>
        ///// Получает порядковый номер
        ///// </summary>
        ///// <param name="date"></param>
        ///// <returns></returns>
        //private Int32 GetIndex(DateTime date)
        //{
        //    long index = (date.Date.Ticks - _startDate.Ticks) / TimeSpan.TicksPerDay;
        //    return Convert.ToInt32(index);
        //}
        #endregion

        #region public Lifelength GetLifelengthOnStartOfDay(DateTime date, FlightRegime flightRegime)

        /// <summary>
        /// Подсчитанная наработка на начало дня в заданном режиме
        /// </summary>
        /// <param name="date">День на который необходимо вернуть наработку</param>
        /// <param name="flightRegime">режим работы</param>
        /// <returns></returns>
        public Lifelength GetLifelengthOnStartOfDay(DateTime date, FlightRegime flightRegime)
        {
            return(this[date.AddDays(-1), flightRegime ?? FlightRegime.UNK]);
        }
Example #11
0
        private void SetWorkTimeGA(BaseComponent powerUnit, FlightRegime flightRegime)
        {
            if (powerUnit == null)
            {
                return;
            }
            List <PowerUnitTimeInRegimeControlItem> fcs =
                flowLayoutPanelMain.Controls
                .OfType <PowerUnitTimeInRegimeControlItem>()
                .Where(c => c.PowerUnit != null &&
                       c.PowerUnit.ItemId == powerUnit.ItemId &&
                       c.FlightRegime == flightRegime)
                .ToList();
            int t = fcs.Sum(cr => cr.WorkTime);

            Lifelength baseDetailLifeLenghtInRegimeSinceLastOverhaul = null;
            Lifelength baseDetailLifeLenghtSinceLastOverhaul         = null;
            Lifelength baseDetailOhInterval = null;
            Lifelength baseDetailLifeLenghtInRegimeSinceNew =
                GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnStartOfDay(powerUnit, _flightDate, flightRegime);
            Lifelength baseDetailLifeLenghtSinceNew =
                GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnStartOfDay(powerUnit, _flightDate);
            Lifelength baseDetailLifeLimit = powerUnit.LifeLimit;

            ComponentWorkInRegimeParams inRegimeParams =
                powerUnit.ComponentWorkParams.Where(p => p.FlightRegime == flightRegime).FirstOrDefault();

            if (inRegimeParams != null &&
                inRegimeParams.ResorceProvider == SmartCoreType.ComponentDirective &&
                powerUnit.ComponentDirectives.GetItemById(inRegimeParams.ResorceProviderId) != null)
            {
                //в парамтрах работы требуется расчитать время работы в режиме с
                //последнего выполнения директивы
                ComponentDirective dd = powerUnit.ComponentDirectives.GetItemById(inRegimeParams.ResorceProviderId);
                if (dd.LastPerformance == null)
                {
                    baseDetailOhInterval = dd.Threshold.FirstPerformanceSinceNew;
                    //если последнего выполнения директивы нет,
                    //то расчитывается полная работа агрегата в указанном режиме
                    baseDetailLifeLenghtInRegimeSinceLastOverhaul =
                        GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnStartOfDay(powerUnit, _flightDate, flightRegime);
                    baseDetailLifeLenghtSinceLastOverhaul =
                        GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnStartOfDay(powerUnit, _flightDate);
                }
                else
                {
                    baseDetailOhInterval = dd.Threshold.RepeatInterval;
                    //т.к. может просматриваться старый полет (н: месячной давности)
                    //производится поиск последней записи о выполнении перед текущим полетов
                    AbstractPerformanceRecord r = dd.PerformanceRecords.GetLastKnownRecord(_flightDate);
                    if (r != null)
                    {
                        baseDetailLifeLenghtInRegimeSinceLastOverhaul =
                            GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthForPeriod(powerUnit, r.RecordDate, _flightDate.AddHours(-1), flightRegime);
                        baseDetailLifeLenghtSinceLastOverhaul =
                            GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthForPeriod(powerUnit, r.RecordDate, _flightDate.AddHours(-1));//TODO:(Evgenii Babak) выяснить почему AddHours(-1)
                    }
                }
            }

            if (Flight.AircraftId <= 0)
            {
                //извлечение всех полетов ВС
                var flights = GlobalObjects.AircraftFlightsCore.GetAircraftFlightsOnDate(Flight.AircraftId, _flightDate);
                //И поиск всех полетов, что были раньше текущего
                foreach (AircraftFlight aircraftFlight in flights)
                {
                    //Если полет был раньше текущего, то его наработка добавляется
                    //к рассчитываемым ресурсам базового агрегата
                    if (aircraftFlight.FlightDate < _flightDate.Date.Add(_outTime.TimeOfDay))
                    {
                        baseDetailLifeLenghtInRegimeSinceNew.Add(GlobalObjects.CasEnvironment.Calculator.GetFlightLifelength(aircraftFlight, powerUnit, flightRegime));
                        baseDetailLifeLenghtSinceNew.Add(GlobalObjects.CasEnvironment.Calculator.GetFlightLifelength(aircraftFlight, powerUnit));
                        if (baseDetailLifeLenghtInRegimeSinceLastOverhaul == null)
                        {
                            continue;
                        }
                        baseDetailLifeLenghtInRegimeSinceLastOverhaul.Add(GlobalObjects.CasEnvironment.Calculator.GetFlightLifelength(aircraftFlight, powerUnit, flightRegime));
                        if (baseDetailLifeLenghtSinceLastOverhaul == null)
                        {
                            continue;
                        }
                        baseDetailLifeLenghtSinceLastOverhaul.Add(GlobalObjects.CasEnvironment.Calculator.GetFlightLifelength(aircraftFlight, powerUnit));
                    }
                }
            }
            baseDetailLifeLenghtInRegimeSinceNew.Add(LifelengthSubResource.Minutes, t);

            if (baseDetailLifeLenghtInRegimeSinceLastOverhaul != null)
            {
                baseDetailLifeLenghtInRegimeSinceLastOverhaul.Add(LifelengthSubResource.Minutes, t);
            }


            double persentSN = 0, persentLifeLimit = 0, persentSLO = 0, persentOhInt = 0;
            int?   resInRegimeSN = baseDetailLifeLenghtInRegimeSinceNew.GetSubresource(LifelengthSubResource.Minutes);
            int?   resSN         = baseDetailLifeLenghtSinceNew.GetSubresource(LifelengthSubResource.Minutes);
            int?   resLl         = baseDetailLifeLimit.GetSubresource(LifelengthSubResource.Minutes);

            if (resSN != null && resInRegimeSN != null && resSN > 0)
            {
                persentSN = Convert.ToDouble((double)resInRegimeSN * 100 / resSN);
            }
            if (resLl != null && resInRegimeSN != null && resLl > 0)
            {
                persentLifeLimit = Convert.ToDouble((double)resInRegimeSN * 100 / resLl);
            }

            if (baseDetailLifeLenghtInRegimeSinceLastOverhaul != null)
            {
                int?resInRegimeSLO = baseDetailLifeLenghtInRegimeSinceLastOverhaul.GetSubresource(LifelengthSubResource.Minutes);

                if (baseDetailLifeLenghtSinceLastOverhaul != null)
                {
                    int?resSLO = baseDetailLifeLenghtSinceLastOverhaul.GetSubresource(LifelengthSubResource.Minutes);
                    if (resSLO != null && resInRegimeSLO != null && resSLO > 0)
                    {
                        persentSLO = Convert.ToDouble((double)resInRegimeSLO * 100 / resSLO);
                    }
                }
                if (baseDetailOhInterval != null)
                {
                    int?resOhInt = baseDetailOhInterval.GetSubresource(LifelengthSubResource.Minutes);
                    if (resOhInt != null && resInRegimeSLO != null && resOhInt > 0)
                    {
                        persentOhInt = Convert.ToDouble((double)resInRegimeSLO * 100 / resOhInt);
                    }
                }
            }


            foreach (PowerUnitTimeInRegimeControlItem fc in fcs)
            {
                fc.WorkTimeGA       = t;
                fc.WorkTimeSinceNew = baseDetailLifeLenghtInRegimeSinceNew;
                fc.WorkTimeSLO      = baseDetailLifeLenghtInRegimeSinceLastOverhaul;
                fc.PersentSN        = persentSN;
                fc.PersentLifeLimit = persentLifeLimit;
                fc.PersentSLO       = persentSLO;
                fc.PersentOhInt     = persentOhInt;
            }
        }
Example #12
0
 /// <summary>
 /// Создает экземпляр объекта с определенным значением
 /// </summary>
 /// <param name="value">Значение</param>
 public ValueChangedEventArgs(FlightRegime value)
 {
     Value = value;
 }
Example #13
0
 public Lifelength GetFlightLifelength(AircraftFlight flight, BaseComponent bd, FlightRegime flightRegime)
 {
     return(_provider.GetFlightLifelengthWithRegimeBaseComponent(flight.ItemId, bd.ItemId, flightRegime.ItemId));
 }
Example #14
0
 public Lifelength GetFlightLifelengthForPeriod(BaseComponent baseComponent, DateTime fromDate, DateTime toDate,
                                                FlightRegime flightRegime)
 {
     return(_provider.GetFlightLifelengthForPeriodWithRegimeBaseComponent(baseComponent.ItemId, fromDate, toDate, flightRegime.ItemId));
 }
Example #15
0
 public Lifelength GetFlightLifelengthOnStartOfDay(BaseComponent baseComponent, DateTime date, FlightRegime flightRegime)
 {
     return(_provider.GetFlightLifelengthOnStartOfDayRegimeBaseComponent(baseComponent.ItemId, date, flightRegime.ItemId));
 }
Example #16
0
 public static ActualStateRecordView GetLastKnownRecord(this List <ActualStateRecordView> records, DateTime date, FlightRegime flightRegime)
 {
     if (flightRegime == null)
     {
         flightRegime = FlightRegime.UNK;
     }
     date = date.Date;
     return(records.OrderByDescending(r => r.RecordDate.Value.Date)
            .FirstOrDefault(r => r.RecordDate.Value.Date <= date && r.WorkRegimeTypeId.Equals(flightRegime.Id)));
 }