private int GetInjectorNumber(AnalyticRuleType ruleType)
        {
            switch (ruleType)
            {
            case AnalyticRuleType.Injector1CorrectionAt1000Rpm:
            case AnalyticRuleType.Injector1CorrectionAt2000Rpm:
            case AnalyticRuleType.Injector1CorrectionAt3000Rpm:
                return(1);

            case AnalyticRuleType.Injector2CorrectionAt1000Rpm:
            case AnalyticRuleType.Injector2CorrectionAt2000Rpm:
            case AnalyticRuleType.Injector2CorrectionAt3000Rpm:
                return(2);

            case AnalyticRuleType.Injector3CorrectionAt1000Rpm:
            case AnalyticRuleType.Injector3CorrectionAt2000Rpm:
            case AnalyticRuleType.Injector3CorrectionAt3000Rpm:
                return(3);

            case AnalyticRuleType.Injector4CorrectionAt1000Rpm:
            case AnalyticRuleType.Injector4CorrectionAt2000Rpm:
            case AnalyticRuleType.Injector4CorrectionAt3000Rpm:
                return(4);

            default:
                throw new NotSupportedException();
            }
        }
 public void PutParameter(string[] path, AnalyticRuleType type)
 {
     if (path.Length == 0)
     {
         children.Add(new RuleEvaluationChronologyViewModel(
                          EvaluationCache.Get(vin).GetRuleEvaluationChronology(type)));
     }
     else
     {
         if (!children.Any(f =>
                           f is EvaluationFolderViewModel &&
                           ((EvaluationFolderViewModel)f).Key == path[0]))
         {
             EvaluationFolderViewModel newFolder =
                 new EvaluationFolderViewModel(path[0], vin);
             newFolder.PutParameter(GetSubPath(path), type);
             children.Add(newFolder);
         }
         else
         {
             EvaluationFolderViewModel folder =
                 children.First(f =>
                                f is EvaluationFolderViewModel &&
                                ((EvaluationFolderViewModel)f).Key == path[0])
                 as EvaluationFolderViewModel;
             folder.PutParameter(GetSubPath(path), type);
         }
     }
     OnPropertyChanged("Children");
     RefreshSummaryMark();
 }
Exemplo n.º 3
0
 public void PutParameter(string[] path, AnalyticRuleType type)
 {
     if (path.Length == 0)
     {
         children.Add(new AnalyticRuleStatsPerVehicleViewModel(type, vin));
     }
     else
     {
         if (!children.Any(f =>
                           f is ChronoFolderViewModel &&
                           ((ChronoFolderViewModel)f).Key == path[0]))
         {
             ChronoFolderViewModel newFolder =
                 new ChronoFolderViewModel(path[0], vin);
             newFolder.PutParameter(GetSubPath(path), type);
             children.Add(newFolder);
         }
         else
         {
             ChronoFolderViewModel folder =
                 children.First(f =>
                                f is ChronoFolderViewModel &&
                                ((ChronoFolderViewModel)f).Key == path[0]) as ChronoFolderViewModel;
             folder.PutParameter(GetSubPath(path), type);
         }
     }
     OnPropertyChanged("Children");
 }
Exemplo n.º 4
0
 public AnalyticRuleSettings(AnalyticRuleType type,
                             AnalyticItemSettingsReliability reliability)
 {
     SettingsMolecule = new SettingsMolecule();
     RuleType         = type;
     Reliability      = reliability;
 }
Exemplo n.º 5
0
 public void AddParameterMark(AnalyticRuleType type, EvaluationMark mark)
 {
     if (marks.ContainsKey(type))
     {
         throw new NotSupportedException("Rule type already added!");
     }
     marks[type] = mark;
 }
Exemplo n.º 6
0
        public void AddValue(AnalyticRuleType type, DateTime date, double value)
        {
            RuleTypeTreePathResolver pathResolver =
                new RuleTypeTreePathResolver(type);
            string ruleTypeTreePath = pathResolver.GetPath();

            PutDataByPath(ruleTypeTreePath, type, date, value);
        }
Exemplo n.º 7
0
 public void FetchAllForEngine(AnalyticRuleType ruleType,
                               EngineFamilyType engineFamily,
                               EngineType engineType)
 {
     service.GetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompleted += ServiceOnGetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompleted;
     service.GetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeAsync(
         (int)ruleType, (int)engineFamily, (int)engineType);
 }
Exemplo n.º 8
0
        public static List <AnalyticStatisticsValue> GetTypedForVehicle(
            AnalyticRuleType type, string vin)
        {
            string vinU = vin.ToUpper();

            CheckCacheForVehicleAndTypeFillIfRequired(vinU, type);
            return(Cache[vin].Get(type));
        }
 public List <AnalyticStatisticsValue> Get(AnalyticRuleType type)
 {
     if (cacheInternal.ContainsKey(type))
     {
         return(cacheInternal[type]);
     }
     return(null);
 }
Exemplo n.º 10
0
 public AnalyticStatisticsItem(AnalyticRuleType type,
                               EngineFamilyType engineFamilyType, EngineType engineType)
 {
     Type = type;
     TargetEngineFamilyType = engineFamilyType;
     TargetEngineType       = engineType;
     DateGenerated          = DateTime.Now;
     VersionGenerated       = new Version("0.0.0.0");
 }
 public FitterInjectorCorrectionForRpm(
     VehicleInformation info, AnalyticRuleType type)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this.info = info;
     this.type = type;
 }
Exemplo n.º 12
0
 public AnalyticRuleStatsPerVehicleViewModel(AnalyticRuleType type,
                                             string vin)
 {
     this.type = type;
     this.vin  = vin;
     worker.WorkerSupportsCancellation = true;
     worker.WorkerReportsProgress      = false;
     worker.RunWorkerCompleted        += WorkerCompleted;
     worker.DoWork += RetrieveStatisticsAsync;
 }
Exemplo n.º 13
0
        private void PutDataByPath(string path, AnalyticRuleType type,
                                   DateTime captureDate, double value)
        {
            ChronologyPathNavigator navigator =
                new ChronologyPathNavigator(this);
            var parameter = new VehicleChronologicalParameter(type);

            parameter.Values.Add(new KeyValuePair <DateTime, double>(captureDate, value));
            navigator.PlaceDataByPath(path, parameter);
        }
        private void OnFiltersChanged(object sender, EventArgs e)
        {
            AnalyticRuleSettingsPersistency persistency =
                new AnalyticRuleSettingsPersistency(Retrieved, OnError);

            if (controlFiltering.RuleType == null &&
                controlFiltering.Family == null &&
                controlFiltering.Engine == null)
            {
                persistency.FetchAll();
            }
            else if (controlFiltering.RuleType != null &&
                     controlFiltering.Family != null &&
                     controlFiltering.Engine != null)
            {
                AnalyticRuleType ruleType   = controlFiltering.RuleType.Model;
                EngineFamilyType familyType = controlFiltering.Family.Model;
                EngineType       engineType = controlFiltering.Engine.Model;
                persistency.FetchAllForEngine(ruleType, familyType, engineType);
            }
            else if (controlFiltering.RuleType != null &&
                     controlFiltering.Family != null &&
                     controlFiltering.Engine == null)
            {
                AnalyticRuleType ruleType   = controlFiltering.RuleType.Model;
                EngineFamilyType familyType = controlFiltering.Family.Model;
                persistency.FetchAllForEngineFamily(ruleType, familyType);
            }
            else if (controlFiltering.RuleType != null &&
                     controlFiltering.Family == null &&
                     controlFiltering.Engine == null)
            {
                AnalyticRuleType ruleType = controlFiltering.RuleType.Model;
                persistency.FetchAllForRuleType(ruleType);
            }
            else if (controlFiltering.RuleType == null &&
                     controlFiltering.Family != null &&
                     controlFiltering.Engine != null)
            {
                EngineFamilyType familyType = controlFiltering.Family.Model;
                EngineType       engineType = controlFiltering.Engine.Model;
                persistency.FetchAllRulesForEngine(familyType, engineType);
            }
            else if (controlFiltering.RuleType == null &&
                     controlFiltering.Family != null &&
                     controlFiltering.Engine == null)
            {
                EngineFamilyType familyType = controlFiltering.Family.Model;
                persistency.FetchAllRulesForEngineFamily(familyType);
            }
            else
            {
                collection.Clear();
            }
        }
Exemplo n.º 15
0
 protected FitterLambdaVoltageBase(VehicleInformation info,
                                   CheckpointRpm rpm, AnalyticRuleType type)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this.info = info;
     this.rpm  = rpm;
     this.type = type;
 }
Exemplo n.º 16
0
        public AnalyticStatisticsItem(AnalyticRuleType type,
                                      EngineFamilyType engineFamilyType, EngineType engineType)
        {
            Type = type;
            TargetEngineFamilyType = engineFamilyType;
            TargetEngineType       = engineType;
            DateGenerated          = DateTime.Now;
            AssemblyName assemblyName =
                new AssemblyName(Assembly.GetExecutingAssembly().FullName);

            VersionGenerated = assemblyName.Version;
        }
Exemplo n.º 17
0
 public RpmCorrelationFitter(
     PsaParameterType dependentParameter,
     int baseParamDiffTresholdPercentage,
     VehicleInformation info,
     AnalyticRuleType ruleType)
 {
     this.baseParameter      = PsaParameterType.EngineRpm;
     this.dependentParameter = dependentParameter;
     this.baseParamDiffTresholdPercentage = baseParamDiffTresholdPercentage;
     this.info     = info;
     this.ruleType = ruleType;
 }
Exemplo n.º 18
0
        private void SelectedRuleTypeChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }
            else
            {
                buttonOk.IsEnabled = true;
            }
            AnalyticRuleTypeViewModel ruleTypeViewModel =
                e.AddedItems[0] as AnalyticRuleTypeViewModel;

            ruleType = ruleTypeViewModel.Model;
        }
Exemplo n.º 19
0
 private static void CheckCacheForVehicleAndTypeFillIfRequired(
     string vinU, AnalyticRuleType type)
 {
     if (!Cache.ContainsKey(vinU) ||
         (Cache.ContainsKey(vinU) && Cache[vinU].Get(type) == null))
     {
         lock (Cache)
         {
             if (!Cache.ContainsKey(vinU))
             {
                 Cache[vinU] = new StatisticsPerVehicleSubCache();
             }
             Cache[vinU].Set(GetFromService(type, vinU), type);
         }
     }
 }
Exemplo n.º 20
0
 private static List <AnalyticStatisticsValue> GetFromService(
     AnalyticRuleType type, string vin)
 {
     try
     {
         List <AnalyticStatisticsValue> result  = new List <AnalyticStatisticsValue>();
         VtsWebServiceClient            service = new VtsWebServiceClient();
         foreach (AnalyticStatisticsValueDto dto in
                  service.GetAnalyticStatisticsPerVehicle(vin, (int)type))
         {
             result.Add(AnalyticStatisticsValueAssembler.FromDtoToDomainObject(dto));
         }
         return(result);
     }
     catch (Exception e)
     {
         Log.Error(e, "Could not fill Analytic statistics cache");
         return(new List <AnalyticStatisticsValue>());
     }
 }
Exemplo n.º 21
0
        public void CheckNewlyCreatedSignature(AnalyticRuleType type,
                                               EngineFamilyType?familyType, EngineType?engineType)
        {
            if (engineType == null && familyType == null)
            {
                service.GetAnalyticRuleSettingsWhereFamilyAndEngineIsNullCompleted +=
                    ServiceOnGetAnalyticRuleSettingsWhereFamilyAndEngineIsNullCompleted;
                service.GetAnalyticRuleSettingsWhereFamilyAndEngineIsNullAsync((int)type);
            }
            else if (engineType == null && familyType != null)
            {
                service.GetAnalyticRuleSettingsWhereEngineIsNullCompleted +=
                    ServiceOnGetAnalyticRuleSettingsWhereEngineIsNullCompleted;
                service.GetAnalyticRuleSettingsWhereEngineIsNullAsync((int)type, (int)familyType);
            }
            else if (engineType != null && familyType != null)
            {
                service.GetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompleted +=
                    ServiceOnGetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompleted;

                service.GetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeAsync(
                    (int)type, (int)familyType, (int)engineType);
            }
        }
Exemplo n.º 22
0
 public FitterUpperLambdaVoltage(VehicleInformation info, AnalyticRuleType type)
     : base(info, RuleTypeToRpm.Map(type), type)
 {
 }
Exemplo n.º 23
0
 public RuleTypeTreePathResolver(AnalyticRuleType ruleType)
 {
     this.ruleType = ruleType;
 }
Exemplo n.º 24
0
 protected void RegisterRequiredType(AnalyticRuleType type)
 {
     requiredTypes.Add(type);
 }
Exemplo n.º 25
0
 public VehicleChronologicalParameter(AnalyticRuleType type)
 {
     this.type = type;
 }
Exemplo n.º 26
0
 public void FetchAllForRuleType(AnalyticRuleType ruleType)
 {
     service.GetAnalyticRuleSettingsByTypeCompleted += ServiceOnGetAnalyticRuleSettingsByTypeCompleted;
     service.GetAnalyticRuleSettingsByTypeAsync((int)ruleType);
 }
Exemplo n.º 27
0
 public AnalyticRuleSettings GetOfType(AnalyticRuleType type)
 {
     return(RulesSettings.FirstOrDefault(r => r.RuleType == type));
 }
Exemplo n.º 28
0
 public static CheckpointRpm Map(AnalyticRuleType type)
 {
     return(mapping[type]);
 }
 public static int Map(AnalyticRuleType type)
 {
     return(mapping[type]);
 }
Exemplo n.º 30
0
        public IFitter Create(AnalyticRuleType ruleType)
        {
            // Injector corrections

            /*if (ruleType == AnalyticRuleType.InjectorCorrectionAt1000Rpm ||
             *  ruleType == AnalyticRuleType.InjectorCorrectionAt2000Rpm ||
             *  ruleType == AnalyticRuleType.InjectorCorrectionAt3000Rpm)
             * {
             *  return new FitterInjectorsCorrectionForRpm(info, ruleType);
             * }*/

            if (ruleType == AnalyticRuleType.Injector1CorrectionAt1000Rpm ||
                ruleType == AnalyticRuleType.Injector1CorrectionAt2000Rpm ||
                ruleType == AnalyticRuleType.Injector1CorrectionAt3000Rpm ||
                ruleType == AnalyticRuleType.Injector2CorrectionAt1000Rpm ||
                ruleType == AnalyticRuleType.Injector2CorrectionAt2000Rpm ||
                ruleType == AnalyticRuleType.Injector2CorrectionAt3000Rpm ||
                ruleType == AnalyticRuleType.Injector3CorrectionAt1000Rpm ||
                ruleType == AnalyticRuleType.Injector3CorrectionAt2000Rpm ||
                ruleType == AnalyticRuleType.Injector3CorrectionAt3000Rpm ||
                ruleType == AnalyticRuleType.Injector4CorrectionAt1000Rpm ||
                ruleType == AnalyticRuleType.Injector4CorrectionAt2000Rpm ||
                ruleType == AnalyticRuleType.Injector4CorrectionAt3000Rpm)
            {
                return(new FitterInjectorCorrectionForRpm(info, ruleType));
            }

            // Labmda
            if (ruleType == AnalyticRuleType.LambdaUpperVoltageAt1000Rpm ||
                ruleType == AnalyticRuleType.LambdaUpperVoltageAt2000Rpm ||
                ruleType == AnalyticRuleType.LambdaUpperVoltageAt3000Rpm)
            {
                return(new FitterUpperLambdaVoltage(info, ruleType));
            }

            if (ruleType == AnalyticRuleType.LambdaLowerVoltageAt1000Rpm ||
                ruleType == AnalyticRuleType.LambdaLowerVoltageAt2000Rpm ||
                ruleType == AnalyticRuleType.LambdaLowerVoltageAt3000Rpm)
            {
                return(new FitterLowerLambdaVoltage(info, ruleType));
            }

            // engine startup undervoltage
            if (ruleType == AnalyticRuleType.EngineStartUndervoltage)
            {
                return(new FitterStartupUndervoltage(info));
            }

            // Fuel Pressure Delta (Common Rail diesel)
            if (ruleType == AnalyticRuleType.FuelPressureDelta1000Rpm ||
                ruleType == AnalyticRuleType.FuelPressureDelta2000Rpm ||
                ruleType == AnalyticRuleType.FuelPressureDelta3000Rpm)
            {
                return(new RpmCorrelationFitter(
                           PsaParameterType.FuelSystemPressureDelta, 5, info, ruleType));
            }

            if (ruleType == AnalyticRuleType.FuelPressureRegulatorCurrent1000Rpm ||
                ruleType == AnalyticRuleType.FuelPressureRegulatorCurrent2000Rpm ||
                ruleType == AnalyticRuleType.FuelPressureRegulatorCurrent3000Rpm)
            {
                return(new RpmCorrelationFitter(
                           PsaParameterType.FuelRegulatorCurrent, 5, info, ruleType));
            }

            // cyl coil charge timing
            if (ruleType == AnalyticRuleType.Cylinder1CoilChargeTime1000Rpm ||
                ruleType == AnalyticRuleType.Cylinder1CoilChargeTime2000Rpm ||
                ruleType == AnalyticRuleType.Cylinder1CoilChargeTime3000Rpm ||

                ruleType == AnalyticRuleType.Cylinder2CoilChargeTime1000Rpm ||
                ruleType == AnalyticRuleType.Cylinder2CoilChargeTime2000Rpm ||
                ruleType == AnalyticRuleType.Cylinder2CoilChargeTime3000Rpm ||

                ruleType == AnalyticRuleType.Cylinder3CoilChargeTime1000Rpm ||
                ruleType == AnalyticRuleType.Cylinder3CoilChargeTime2000Rpm ||
                ruleType == AnalyticRuleType.Cylinder3CoilChargeTime3000Rpm ||

                ruleType == AnalyticRuleType.Cylinder4CoilChargeTime1000Rpm ||
                ruleType == AnalyticRuleType.Cylinder4CoilChargeTime2000Rpm ||
                ruleType == AnalyticRuleType.Cylinder4CoilChargeTime3000Rpm)
            {
                return(new FitterCylinderCoilChargeTimeForRpm(info, ruleType));
            }

            // cyl coil charge startup peak
            if (ruleType == AnalyticRuleType.Cylinder1CoilStartupChargeTimePeak ||
                ruleType == AnalyticRuleType.Cylinder2CoilStartupChargeTimePeak ||
                ruleType == AnalyticRuleType.Cylinder3CoilStartupChargeTimePeak ||
                ruleType == AnalyticRuleType.Cylinder4CoilStartupChargeTimePeak)
            {
                return(new FitterCylinderCoilStartupChargeTimePeak(info, ruleType));
            }

            // Injection time for different rpms
            if (ruleType == AnalyticRuleType.InjectionTimeAt1000Rpm ||
                ruleType == AnalyticRuleType.InjectionTimeAt2000Rpm ||
                ruleType == AnalyticRuleType.InjectionTimeAt3000Rpm)
            {
                return(new RpmCorrelationFitter(
                           PsaParameterType.InjectionTime, 5, info, ruleType));
            }

            if (ruleType == AnalyticRuleType.InjectionTimeStartupPeak)
            {
                return(new FitterInjectionTimeStartupPeak(info));
            }

            // fitter not found for rule type!
            throw new NotImplementedException();
        }