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)); }
public AnalyticStatisticsItem Get(PsaParametersSet set, DateTime sourceDataCaptureDateTime) { AnalyticStatisticsItem result = new AnalyticStatisticsItem(ruleType, info.Engine.Family.Type, info.Engine.Type); IList <double> baseValues = set.GetParameterOfType(baseParameter).GetDoubles(); IList <double> dependantValues = set.GetParameterOfType(dependentParameter).GetDoubles(); CorrelatedMedianExtractor extractor = new CorrelatedMedianExtractor(baseValues, dependantValues, baseParamDiffTresholdPercentage); double targetRpm = (int)RuleTypeToRpm.Map(ruleType); double value = extractor.GetForBaseValue(targetRpm); if (!double.IsNaN(value)) { result.Values.Add(new AnalyticStatisticsValue( value, info.Vin, set.Id, sourceDataCaptureDateTime)); } return(result); }
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); }
public FitterUpperLambdaVoltage(VehicleInformation info, AnalyticRuleType type) : base(info, RuleTypeToRpm.Map(type), type) { }
protected override CheckpointRpm GetTargetRpm() { return(RuleTypeToRpm.Map(Type)); }
private AnalyticRuleSettings GetInjectorCorrectionRuleSettings( IList <AnalyticRuleSettings> settings, CheckpointRpm rpm) { return(settings.FirstOrDefault(s => RuleTypeToRpm.Map(s.RuleType) == rpm)); }