private void ExtractForInjector(PsaParametersSet set,
                                        AnalyticStatisticsItem result, int injectorNumber,
                                        DateTime sourceDataCaptureDateTime)
        {
            PsaParameterData forThisInjector =
                set.GetCertainInjectorCorrections(injectorNumber);

            if (forThisInjector == null)
            {
                return;
            }
            PsaParameterData rpmData =
                set.GetParameterOfType(PsaParameterType.EngineRpm);
            CorrelatedMedianExtractor extractor =
                new CorrelatedMedianExtractor(
                    rpmData.GetDoubles(), forThisInjector.GetDoubles(),
                    RpmCorrelationThresholdPercentage);
            double res = extractor.GetForBaseValue((int)RuleTypeToRpm.Map(type));

            if (double.IsNaN(res))
            {
                return;
            }
            // becuse we need correction's absolute value, it can be negative
            double abs = Math.Abs(res);

            result.Values.Add(new AnalyticStatisticsValue(
                                  abs, info.Vin, set.Id, sourceDataCaptureDateTime));
        }
Beispiel #2
0
        protected override void PickFromPsaParametersSet(
            DateTime date, PsaParametersSet source)
        {
            IList <double> baseLine = source.GetParameterOfType(
                PsaParameterType.EngineRpm).GetDoubles();
            IList <double> dependantLine = source.
                                           GetCertainInjectorCorrections(injectorNumber).GetDoubles();
            CorrelatedMedianExtractor correlatedMedianExtractor =
                new CorrelatedMedianExtractor(baseLine, dependantLine,
                                              BaseValuesDifferencePercentageThreshold);
            CheckpointRpm targetRpm   = RuleTypeToRpm.Map(settings.RuleType);
            double        resultValue = correlatedMedianExtractor.GetForBaseValue(
                Convert.ToDouble(targetRpm));

            if (double.IsNaN(resultValue))
            {
                return;
            }
            SettingsAtomApplierByAbsoluteValue applier =
                new SettingsAtomApplierByAbsoluteValue(
                    settings.SettingsMolecule.GetPriorityAtom());

            MarksHistory[date] = applier.GetMarkForValue(resultValue);
        }