Пример #1
0
        public static Dictionary <UnLinearityType, Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> > > GetStatisticsOfDiagramOfTransformation(GlobalUnit unit, int numbers)
        {
            Dictionary <UnLinearityType, Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> > > result =
                new Dictionary <UnLinearityType, Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> > >(2);
            Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> > dictIntegralUnLinearity =
                new Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> >(4);
            Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> > dictDiferentialUnLinearity =
                new Dictionary <ModellingDataTypeWithStrategies, Dictionary <StatisticParametrType, double> >(4);

            double[][] integral = new double[4][];
            for (int i = 0; i < 4; i++)
            {
                integral[i] = new double[numbers];
            }

            double[][] differential = new double[4][];
            for (int i = 0; i < 4; i++)
            {
                differential[i] = new double[numbers];
            }

            CharacteristoOfTransformationParametrs param =
                new CharacteristoOfTransformationParametrs(int.MaxValue, 1,
                                                           new AnalogSignal(TypesOfSignalEnum.KxB, new LineParametrs(1.0, 0.0)));

            for (int index = 0; index < numbers; index++)
            {
                PointPairList[] graphArrays = GetDiagramOfTransformationOfAllStrategies(unit);
                // graphArrays.Length==4 без калібрування + 3 стратегії
                for (int i = 0; i < graphArrays.Length; i++)
                {
                    PointPairList integralUnLinearityCurve    = Nonlinearity.CalculateIntegralUnLinearity(graphArrays[i]);
                    PointPairList diferentialUnLinearityCurve = Nonlinearity.CalculateDifferentialUnLinearity(graphArrays[i]);

                    CalculateStatisticsForOneParametr(integralUnLinearityCurve, ref integral[i][index]);
                    CalculateStatisticsForOneParametr(diferentialUnLinearityCurve, ref differential[i][index]);
                }
            }

            dictIntegralUnLinearity.Add(ModellingDataTypeWithStrategies.Simple, MakeLowestDictionary(integral[0]));
            dictIntegralUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithFirstStrategy, MakeLowestDictionary(integral[1]));
            dictIntegralUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithSecondStrategy, MakeLowestDictionary(integral[2]));
            dictIntegralUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithThirdStrategy, MakeLowestDictionary(integral[3]));

            dictDiferentialUnLinearity.Add(ModellingDataTypeWithStrategies.Simple, MakeLowestDictionary(differential[0]));
            dictDiferentialUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithFirstStrategy, MakeLowestDictionary(differential[1]));
            dictDiferentialUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithSecondStrategy, MakeLowestDictionary(differential[2]));
            dictDiferentialUnLinearity.Add(ModellingDataTypeWithStrategies.CalibratedWithThirdStrategy, MakeLowestDictionary(differential[3]));

            result.Add(UnLinearityType.Integral, dictIntegralUnLinearity);
            result.Add(UnLinearityType.Differential, dictDiferentialUnLinearity);

            return(result);
        }
        public static Dictionary <UnLinearityType, Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> > > GetStatisticsOfDiagramOfTransformation(GlobalUnit unit, int numbers)
        {
            var result =
                new Dictionary <UnLinearityType, Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> > >(2);

            Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> > dictIntegralUnLinearity =
                new Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> >(3);
            Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> > dictDiferentialUnLinearity =
                new Dictionary <ModellingDataType, Dictionary <StatisticParametrType, double> >(3);

            Dictionary <int, int[]> regTrackWithoutCalibration;
            Dictionary <int, int[]> regTrackWithCalibration;

            var simpleIntegral = new double[numbers];
            //0- tracking
            //1- cletching
            var calibratedIntegral = new double[2][];

            calibratedIntegral[0] = new double[numbers];
            calibratedIntegral[1] = new double[numbers];

            var simpleDifferential = new double[numbers];
            //0- tracking
            //1- cletching
            var calibratedDifferential = new double[2][];

            calibratedDifferential[0] = new double[numbers];
            calibratedDifferential[1] = new double[numbers];

            CharacteristoOfTransformationParametrs param =
                new CharacteristoOfTransformationParametrs(int.MaxValue, 1,
                                                           new AnalogSignal(TypesOfSignalEnum.KxB, new LineParametrs(1.0, 0.0)));

            for (int index = 0; index < numbers; index++)
            {
                var graphArraysTracking  = GetDiagramOfTransformation(unit, param, CalibrationType.Tracking, out regTrackWithoutCalibration, out regTrackWithCalibration);
                var graphArraysCletching = GetDiagramOfTransformation(unit, param, CalibrationType.Cletching, out regTrackWithoutCalibration, out regTrackWithCalibration);

                var res = new PointPairList [] { graphArraysTracking[1], graphArraysTracking[2], graphArraysCletching[2] };

                GetValueForCurve(Nonlinearity.CalculateDifferentialUnLinearity(res[0]), ref simpleIntegral[index]);
                GetValueForCurve(Nonlinearity.CalculateDifferentialUnLinearity(res[1]), ref calibratedDifferential[0][index]);
                GetValueForCurve(Nonlinearity.CalculateDifferentialUnLinearity(res[2]), ref calibratedDifferential[1][index]);

                GetValueForCurve(Nonlinearity.CalculateIntegralUnLinearity(res[0]), ref simpleDifferential[index]);
                GetValueForCurve(Nonlinearity.CalculateIntegralUnLinearity(res[1]), ref calibratedIntegral[0][index]);
                GetValueForCurve(Nonlinearity.CalculateIntegralUnLinearity(res[2]), ref calibratedIntegral[1][index]);
            }

            dictIntegralUnLinearity.Add(ModellingDataType.Simple, MakeLowestDictionary(simpleIntegral));
            dictIntegralUnLinearity.Add(ModellingDataType.CalibratedTracking, MakeLowestDictionary(calibratedIntegral[0]));
            dictIntegralUnLinearity.Add(ModellingDataType.CalibratedCletching, MakeLowestDictionary(calibratedIntegral[1]));

            dictDiferentialUnLinearity.Add(ModellingDataType.Simple, MakeLowestDictionary(simpleDifferential));
            dictDiferentialUnLinearity.Add(ModellingDataType.CalibratedTracking, MakeLowestDictionary(calibratedDifferential[0]));
            dictDiferentialUnLinearity.Add(ModellingDataType.CalibratedCletching, MakeLowestDictionary(calibratedDifferential[1]));

            result.Add(UnLinearityType.Integral, dictIntegralUnLinearity);
            result.Add(UnLinearityType.Differential, dictDiferentialUnLinearity);

            return(result);
        }