コード例 #1
0
        public bool Fits(PsaParametersSet set)
        {
            PsaParameterType requiredType    = GetRequiredType();
            bool             hasRequiredType = set.HasParameterOfType(requiredType);
            bool             hasRpmData      = set.HasParameterOfType(PsaParameterType.EngineRpm);

            return(hasRequiredType && hasRpmData);
        }
コード例 #2
0
 public AnalyticRuleCylinderCoilChargePeakTime(
     int cylNum, AnalyticRuleSettings settings)
     : base(settings)
 {
     this.cylNum       = cylNum;
     requiredParameter = ModelRelatedPsaParameters.Get(cylNum);
     RegisterRequiredParameter(PsaParameterType.EngineRpm);
     RegisterRequiredParameter(requiredParameter);
 }
コード例 #3
0
        private static PsaParameterType InferOldFashioned(string nativeId)
        {
            PsaParameterType result = GetFromDataTypeMapper(nativeId);

            if (result != PsaParameterType.Unsupported)
            {
                MapBack(nativeId, result);
            }
            return(result);
        }
コード例 #4
0
        private static PsaParameterType ConvertType(string code)
        {
            PsaParameterType type = DataTypeResolver.GetType(new Mnemocode(code));

            if (type == PsaParameterType.Unsupported)
            {
                Log.Warn(String.Format("Mnemocode {0} is not supported yet.", code));
            }
            return(type);
        }
コード例 #5
0
 public AnalyticRuleCylinderCoilChargeTimeForRpm(
     AnalyticRuleSettings settings)
     : base(settings)
 {
     cylNumber         = CylinderNumberToCoilRuleTypeMapper.Map(settings.RuleType);
     requiredParameter = ModelRelatedPsaParameters.Get(cylNumber);
     RegisterRequiredParameter(PsaParameterType.EngineRpm);
     RegisterRequiredParameter(ModelRelatedPsaParameters.Get(
                                   CylinderNumberToCoilRuleTypeMapper.Map(settings.RuleType)));
 }
コード例 #6
0
        public PsaParameterData GetParameterOfType(PsaParameterType type)
        {
            PsaParameterData rpmData = null;

            if (Parameters.Any(p => p.Type == type))
            {
                rpmData = Parameters.
                          FirstOrDefault(p => p.Type == type);
            }
            return(rpmData);
        }
コード例 #7
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;
 }
コード例 #8
0
        private static PsaParameterType GetFromMnemocodeToPsa(HashSet <Mnemocode> codes)
        {
            PsaParameterType result = PsaParameterType.Unsupported;

            foreach (Mnemocode mnemocode in codes)
            {
                PsaParameterType type = MnemocodeToPsaTypeConversionCache.Get(mnemocode);
                if (type != PsaParameterType.Unsupported)
                {
                    result = type;
                    break;
                }
            }
            return(result);
        }
コード例 #9
0
 private static void MapBack(string nativeId, PsaParameterType type)
 {
     Mnemocode mapBack = MnemocodeToPsaTypeConversionCache.MapBack(type);
     {
         if (mapBack == null)
         {
             if (!UnknownNativeIds.Contains(nativeId))
             {
                 Log.Warn(String.Format("Could not find a mnemocode for native id {0} which is {1}", nativeId, type));
                 UnknownNativeIds.Add(nativeId);
             }
         }
         else
         {
             NativeIdToMnemocodeConversionCache.Set(nativeId, mapBack);
         }
     }
 }
コード例 #10
0
        public static PsaParameterType GetType(string nativeId)
        {
            PsaParameterType    result = PsaParameterType.Unsupported;
            HashSet <Mnemocode> got    = GetFromNative2Mnemocode(nativeId);

            if (got != null && got.Any())
            {
                result = GetFromMnemocodeToPsa(got);
                if (result == PsaParameterType.Unsupported)
                {
                    result = InferOldFashioned(nativeId);
                }
            }
            else
            {
                result = InferOldFashioned(nativeId);
            }
            if (result == PsaParameterType.Unsupported)
            {
                ReportUnknownNativeId(nativeId);
            }
            return(result);
        }
コード例 #11
0
 protected void RegisterRequiredParameter(PsaParameterType type)
 {
     requiredParametersInSet.Add(type);
 }
コード例 #12
0
 public bool HasParameterOfType(PsaParameterType type)
 {
     return(Parameters.Any(p => p.Type == type));
 }
コード例 #13
0
        public static PsaParameterType GetType(string nativeId)
        {
            HashSet <Mnemocode> set  = NativeIdToMnemocodeConversionCache.Get(nativeId);
            Mnemocode           code = null;

            if (set != null)
            {
                code = set.FirstOrDefault();
            }
            if (code == null)
            {
                IList <Mnemocode> mnemocodesFromDatabase = null;
                if (!DatabaseMnemocodeResolver.DatabaseReady && !NativeIdsCheckedInDb.Contains(nativeId))
                {
                    PsaParameterType result = DataTypeMapper.GetType(nativeId);
                    return(result);
                }
                NativeIdsCheckedInDb.Add(nativeId);
                if (mnemocodesFromDatabase.Any())
                {
                    code = mnemocodesFromDatabase.First();
                    if (!String.IsNullOrWhiteSpace(code.Code))
                    {
                        NativeIdToMnemocodeConversionCache.Set(nativeId, code);
                    }
                    else
                    {
                        throw new ArgumentException("Wrong mnemocode from database.");
                    }
                }
                PsaParameterType oldMappedType = DataTypeMapper.GetType(nativeId);
                if (oldMappedType == PsaParameterType.Unsupported)
                {
                    ReportUnknownNativeId(nativeId);
                    return(oldMappedType);
                }
                foreach (Mnemocode dbmc in mnemocodesFromDatabase)
                {
                    MnemocodeToPsaTypeConversionCache.Add(dbmc, oldMappedType);
                }
                if (code == null && oldMappedType != PsaParameterType.Unsupported)
                {
                    Mnemocode mapBack = MnemocodeToPsaTypeConversionCache.MapBack(oldMappedType);
                    {
                        if (mapBack == null)
                        {
                            if (!UnknownNativeIds.Contains(nativeId))
                            {
                                Log.Warn(String.Format("Could not find a mnemocode for native id {0} which is {1}", nativeId, oldMappedType));
                                UnknownNativeIds.Add(nativeId);
                            }
                        }
                        else
                        {
                            NativeIdToMnemocodeConversionCache.Set(nativeId, mapBack);
                        }
                    }
                    return(oldMappedType);
                }
            }
            PsaParameterType type = MnemocodeToPsaTypeConversionCache.Get(code);

            if (type == PsaParameterType.Unsupported)
            {
                type = DataTypeMapper.GetType(nativeId);
                if (type != PsaParameterType.Unsupported)
                {
                    MnemocodeToPsaTypeConversionCache.Add(code, type);
                }
            }
            if (type == PsaParameterType.Unsupported)
            {
                ReportUnknownNativeId(nativeId);
            }
            return(type);
        }
コード例 #14
0
 public PsaParameterTypeViewModel(PsaParameterType model)
 {
     this.model = model;
 }