Ejemplo n.º 1
0
        /// <summary>
        /// Метод запука скрипта
        /// </summary>
        private void Start()
        {
            LaunchScript data = GameObject.Find("LaunchManager").GetComponent<LaunchScript>();

            Debug.Log("FilterType=" + data.filterType.ToString());
            Debug.Log("FilterLength=" + data.filterLength.ToString());
            Debug.Log("FilterParameter=" + String.Format("{0:0.000}", data.filterParameter));

            List<IPAddress> ipList = AddressProvider.GetLocalIp();

            source = new SourceNetwork(RotationAxis.Yaw, ipList[ipList.Count - 1]);
            source.Start();

            UdpThread udpThread = new UdpThread();
            udpThread.Start();

            setFilters(data);
        }
Ejemplo n.º 2
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;
                }
            }
        }