Exemplo n.º 1
0
        //загрузка переменой в зависимости от участка пути
        private static void ChosenPlace(SafetyFactor safetyFactor, string place)
        {
            switch (place)
            {
            case "Прямая":
                SafetyFactorСomparisonleft  = safetyFactor.StraightSafetyFactorLeft;
                SafetyFactorСomparisonRight = safetyFactor.StraightSafetyFactorRight;
                ValueForChartLeft           = safetyFactor.ValueForChartStraightLeft;
                ValueForChartRight          = safetyFactor.ValueForChartStraightRight;
                break;

            case "Кривая650":
                SafetyFactorСomparisonleft  = safetyFactor.R650SafetyFactorLeft;
                SafetyFactorСomparisonRight = safetyFactor.R650SafetyFactorRight;
                ValueForChartLeft           = safetyFactor.ValueForChartR650Left;
                ValueForChartRight          = safetyFactor.ValueForChartR650Right;
                break;

            case "Кривая350":
                SafetyFactorСomparisonleft  = safetyFactor.R350SafetyFactorLeft;
                SafetyFactorСomparisonRight = safetyFactor.R350SafetyFactorRight;
                ValueForChartLeft           = safetyFactor.ValueForChartR350Left;
                ValueForChartRight          = safetyFactor.ValueForChartR350Right;
                break;

            case "Стрелка":
                SafetyFactorСomparisonleft  = safetyFactor.ArrowSafetyFactorLeft;
                SafetyFactorСomparisonRight = safetyFactor.ArrowSafetyFactorRight;
                ValueForChartLeft           = safetyFactor.ValueForChartArrowLeft;
                ValueForChartRight          = safetyFactor.ValueForChartArrowRight;
                break;
            }
        }
Exemplo n.º 2
0
        private static void SafetyFactorСomparison(ForceValues force, SafetyFactor safetyFactor, MovingAverage movingAverage)
        {
            //определение минимальных значений коэффициента запаса от схода для левого и правого колеса
            var minLeftSafetyFactor  = movingAverage.LeftSafetyFactorForMovingAverage.Min();
            var minRightSafetyFactor = movingAverage.RightSafetyFactorForMovingAverage.Min();

            //запись в текестовой форме
            movingAverage._MinSafetyFactorLeft  = Convert.ToString(minLeftSafetyFactor, CultureInfo.InvariantCulture);
            movingAverage._MinSafetyFactorRight = Convert.ToString(minRightSafetyFactor, CultureInfo.InvariantCulture);
            //запись значений в словарь со скоростями и типом движения
            switch (movingAverage.Place)
            {
            case "Прямая":
                safetyFactor.StraightSafetyFactorLeft[movingAverage._Speed].Add(minLeftSafetyFactor);
                safetyFactor.StraightSafetyFactorRight[movingAverage._Speed].Add(minRightSafetyFactor);
                break;

            case "Кривая650":
                safetyFactor.R650SafetyFactorLeft[movingAverage._Speed].Add(minLeftSafetyFactor);
                safetyFactor.R650SafetyFactorRight[movingAverage._Speed].Add(minRightSafetyFactor);
                break;

            case "Кривая350":
                safetyFactor.R350SafetyFactorLeft[movingAverage._Speed].Add(minLeftSafetyFactor);
                safetyFactor.R350SafetyFactorRight[movingAverage._Speed].Add(minRightSafetyFactor);
                break;

            case "Стрелка":
                safetyFactor.ArrowSafetyFactorLeft[movingAverage._Speed].Add(minLeftSafetyFactor);
                safetyFactor.ArrowSafetyFactorRight[movingAverage._Speed].Add(minRightSafetyFactor);
                break;
            }
        }
Exemplo n.º 3
0
 private static Sensor NewSensor(uint protocolType, SafetyFactor type)
 {
     return(new Sensor
     {
         SensorID = 17,
         ProtocolType = (uint)protocolType,
         ModuleNo = 99,
         ChannelNo = 1,
         DtuID = 123,
         Name = "TEST",
         FactorType = (uint)type
     });
 }
Exemplo n.º 4
0
 public static SafetyFactor AddSafetyFactor(SafetyFactor safetyFactor, string lastPlace, string lastSpeed)
 {
     if (lastPlace != "Стрелки")//исправить
     {
         ChoseIndexSpeed(lastSpeed);
     }
     else
     {
         ChoseIndexSpeedArrow(lastSpeed);
     }
     ChosenPlace(safetyFactor, lastPlace);
     ForeachDictionary(SafetyFactorСomparisonleft, lastSpeed, ValueForChartLeft);
     ForeachDictionary(SafetyFactorСomparisonRight, lastSpeed, ValueForChartRight);
     return(safetyFactor);
 }
Exemplo n.º 5
0
        public static Tuple <ForceValues, MovingAverage> ReadCSVfile(string filePath, SafetyFactor safetyFactor)
        {
            var forceValues   = new ForceValues();
            var movingAverage = new MovingAverage();

            //запись имени сигнала
            AddNameSignal(filePath, movingAverage);
            //считывание файла
            ReadFile(filePath, forceValues, movingAverage);
            //подсчет скользящей средней
            MovingAverage(forceValues, movingAverage);
            //Запись значений для коэффициента запаса от схода
            SafetyFactorСomparison(forceValues, safetyFactor, movingAverage);
            return(Tuple.Create(forceValues, movingAverage));
        }