/// <summary>
 /// Устанавлиает фильтры
 /// </summary>
 private void setFilters(LaunchScript data)
 {
     switch (data.filterType)
     {
         case FilterType.MovingAverage:
             {
                 filterX = new FilterMovingAverage(data.filterLength);
                 filterY = new FilterMovingAverage(data.filterLength);
                 filterZ = new FilterMovingAverage(data.filterLength);
             }
             break;
         case FilterType.SignlePole:
             {
                 filterX = new FilterSinglePole(data.filterLength, data.filterParameter);
                 filterY = new FilterSinglePole(data.filterLength, data.filterParameter);
                 filterZ = new FilterSinglePole(data.filterLength, data.filterParameter);
             }
             break;
         case FilterType.Gaussian:
             {
                 filterX = new FilterGaussian(data.filterLength, data.filterParameter);
                 filterY = new FilterGaussian(data.filterLength, data.filterParameter);
                 filterZ = new FilterGaussian(data.filterLength, data.filterParameter);
             }
             break;
     }
 }
示例#2
0
        public void FilterMovingAverage_GetOutput_2()
        {
            Filter filter = new FilterMovingAverage(4);

            filter.AddInput(-155.0);
            filter.AddInput(-160.0);
            filter.AddInput(-175.0);
            filter.AddInput(172.0);

            double result = filter.GetOutput();

            Assert.IsTrue(ExtraMath.EqualValue(result, 190.5));
        }
示例#3
0
        public void FilterMovingAverage_GetOutput_1()
        {
            Filter filter = new FilterMovingAverage(4);

            filter.AddInput(10.0);
            filter.AddInput(15.0);
            filter.AddInput(25.0);
            filter.AddInput(36.0);

            double result = filter.GetOutput();

            Assert.IsTrue(ExtraMath.EqualValue(result, 21.5));
        }
示例#4
0
        /// <summary>
        /// Устанавилвает стратегии
        /// </summary>
        /// <param name="parameters"></param>
        private void setStrategies(StrategiesParameters parameters)
        {
            input = new List<double>();
            output = new List<double>();
            pure = new List<double>();
            noise = new List<double>();

            switch (parameters.Filter)
            {
                case FilterType.MovingAverage:
                    filter = new FilterMovingAverage(parameters.FilterLength);                       break;
                case FilterType.SignlePole:
                    filter = new FilterSinglePole(parameters.FilterLength, parameters.SinglePoleK);  break;
                case FilterType.Gaussian:
                    filter = new FilterGaussian(parameters.FilterLength, parameters.GaussianA);      break;
            }
               
            switch (parameters.Noiser)
            {
                case NoiserType.Idle:
                    noiser = new NoiserIdle();                                                    break;
                case NoiserType.Uniform:
                    noiser = new NoiserUniform(parameters.UniformMin, parameters.UniformMax);     break;
                case NoiserType.Normal:
                    noiser = new NoiserNormal(parameters.NormalMean, parameters.NormalDeviation); break;
                case NoiserType.Function:
                    noiser = new NoiserFunction(ExtraMath.PieceWiseExample1);                     break;
            }

            if (parameters.Source == SourceType.Network)
            {
                udpThread = new UdpThread();
                udpThread.Start();

                IsEmulation = false;

                source = new SourceNetwork(parameters.Axis, parameters.IP);
            }
            else
            {
                IsEmulation = true;

                switch (parameters.Source)
                {
                    case SourceType.Sin:
                        source = new SourceEmulatorSin(emulatorSettings, noiser, parameters.SinAmplitude, parameters.SinAverage, parameters.SinPeriod);
                        break;
                    case SourceType.Linear:
                        source = new SourceEmulatorLinear(emulatorSettings, noiser, parameters.LinearMin, parameters.LinearMax);
                        break;
                    case SourceType.Fourier:
                        source = new SourceEmulatorFourier(emulatorSettings, noiser, parameters.HalfOffset, parameters.aList, parameters.bList);
                        break;
                }
            }
        }