Esempio n. 1
0
        protected override void PickFromPsaParametersSet(
            DateTime date, PsaParametersSet set)
        {
            IList <double>        rpmData  = set.GetParameterOfType(PsaParameterType.EngineRpm).GetDoubles();
            IList <double>        timeData = set.GetParameterOfType(PsaParameterType.InjectionTime).GetDoubles();
            EngineStartupDetector detector = new EngineStartupDetector(rpmData);

            if (!detector.EngineStartupDetected())
            {
                return;
            }
            IList <int> indexes  = detector.GetEngineStartupPointIndexes();
            double      peakTime = 0;

            foreach (int i in indexes)
            {
                double newPeakTime = StartupRegionExtractor.Extract(i, timeData).Max();
                if (newPeakTime > peakTime)
                {
                    peakTime = newPeakTime;
                }
            }
            if (peakTime == 0)
            {
                return;
            }
            SettingsAtomApplier applier = new SettingsAtomApplier(
                Settings.SettingsMolecule.GetPriorityAtom());
            double mark = applier.GetMarkForValue(peakTime);

            MarksHistory[date] = mark;
        }
        protected override void PickFromPsaParametersSet(
            DateTime date, PsaParametersSet set)
        {
            IList <double>        rpmData      = set.GetParameterOfType(PsaParameterType.EngineRpm).GetDoubles();
            IList <double>        requiredData = set.GetParameterOfType(requiredParameter).GetDoubles();
            EngineStartupDetector detector     = new EngineStartupDetector(rpmData);

            if (!detector.EngineStartupDetected())
            {
                return;
            }
            IList <int> startupIndexes = detector.GetEngineStartupPointIndexes();

            foreach (int startupIndex in startupIndexes)
            {
                double peak = StartupRegionExtractor.Extract(startupIndex, requiredData).Max();
                if (double.IsNaN(peak))
                {
                    continue;
                }
                SettingsAtomApplier applier = new SettingsAtomApplier(
                    Settings.SettingsMolecule.GetPriorityAtom());
                double mark = applier.GetMarkForValue(peak);
                if (!double.IsNaN(mark))
                {
                    MarksHistory[date] = mark;
                }
            }
        }
Esempio n. 3
0
        public AnalyticStatisticsItem Get(PsaParametersSet set,
                                          DateTime sourceDataCaptureDateTime)
        {
            AnalyticStatisticsItem result = new AnalyticStatisticsItem(
                AnalyticRuleType.EngineStartUndervoltage,
                info.Engine.Family.Type, info.Engine.Type);
            IList <double> rpmLine =
                set.GetParameterOfType(PsaParameterType.EngineRpm).GetDoubles();
            IList <double> voltagesLine =
                set.GetParameterOfType(PsaParameterType.BatteryVoltage).GetDoubles();
            EngineStartupDetector detector = new EngineStartupDetector(rpmLine);

            if (!detector.EngineStartupDetected())
            {
                return(result); // empty, will be assimilated and disappear
            }
            IList <int> startupPoints = detector.GetEngineStartupPointIndexes();

            // we will have as many statistical values as there is startup points
            foreach (int startupPointIndex in startupPoints)
            {
                StartupUndervoltageExtractor extractor =
                    new StartupUndervoltageExtractor(startupPointIndex, voltagesLine);
                double startupUndervoltage = extractor.Extract();
                if (!double.IsNaN(startupUndervoltage))
                {
                    result.Values.Add(new AnalyticStatisticsValue(
                                          startupUndervoltage, info.Vin, set.Id,
                                          sourceDataCaptureDateTime));
                }
            }
            return(result);
        }
        public void TestEngineStartupDetection()
        {
            //taken from my c4 real data
            IList <double> initialLine = new List <double>()
            {
                736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1280, 832, 768, 672, 672, 768, 736, 736, 736, 1536, 960, 832, 768, 736, 864, 1280, 1376, 1408, 896, 800, 736, 736, 736, 1952, 2208, 2240, 2464, 2656, 2688, 2720, 2848, 2912, 3008, 3104, 3136, 3136, 2944, 2784, 2656, 2208, 1856, 1728, 736, 0, 0, 0, 0, 0, 640, 864, 0, 0, 0, 0, 256, 1024, 800, 640, 768, 736, 1152, 1184, 1088, 896, 800, 1536, 1920, 1504, 896, 768, 736, 736, 736, 736, 736, 736, 736
            };
            EngineStartupDetector detector = new EngineStartupDetector(initialLine);

            Assert.IsTrue(detector.EngineStartupDetected());

            IList <int> startupValues = detector.GetEngineStartupPointIndexes();

            Assert.IsTrue(startupValues.Count == 3);
            Assert.IsTrue(startupValues.Contains(22));
            Assert.IsTrue(startupValues.Contains(70));
            Assert.IsTrue(startupValues.Contains(76));
        }
        private IList <double> ExtractStartupVoltageValues(PsaParameterData rpm,
                                                           PsaParameterData voltage)
        {
            IList <double>        result   = new List <double>();
            EngineStartupDetector detector =
                new EngineStartupDetector(rpm.GetDoubles());

            if (detector.EngineStartupDetected())
            {
                IList <int> startupIndexes =
                    detector.GetEngineStartupPointIndexes();
                IList <double> voltageValues = voltage.GetDoubles();
                foreach (int index in startupIndexes)
                {
                    result.Add(voltageValues[index]);
                }
            }
            return(result);
        }
Esempio n. 6
0
        public AnalyticStatisticsItem Get(PsaParametersSet set, DateTime sourceDataCapturetime)
        {
            AnalyticStatisticsItem result = new AnalyticStatisticsItem(
                AnalyticRuleType.InjectionTimeStartupPeak,
                info.Engine.Family.Type, info.Engine.Type);
            IList <double>        rpmData  = set.GetParameterOfType(PsaParameterType.EngineRpm).GetDoubles();
            IList <double>        reqData  = set.GetParameterOfType(PsaParameterType.InjectionTime).GetDoubles();
            EngineStartupDetector detectro = new EngineStartupDetector(rpmData);

            if (detectro.EngineStartupDetected())
            {
                IList <int> startupIndexes = detectro.GetEngineStartupPointIndexes();
                foreach (int startupIndex in startupIndexes)
                {
                    AnalyticStatisticsValue value =
                        new AnalyticStatisticsValue(
                            StartupRegionExtractor.Extract(startupIndex, reqData).Max(),
                            info.Vin, set.Id, sourceDataCapturetime);
                    result.Values.Add(value);
                }
            }
            return(result);
        }
Esempio n. 7
0
        public AnalyticStatisticsItem Get(PsaParametersSet set,
                                          DateTime sourceDataCaptureTime)
        {
            AnalyticStatisticsItem result = new AnalyticStatisticsItem(
                ruleType, info.Engine.Family.Type, info.Engine.Type);
            IList <double>        rpmData      = set.GetParameterOfType(PsaParameterType.EngineRpm).GetDoubles();
            IList <double>        requiredData = set.GetParameterOfType(RequiredType).GetDoubles();
            EngineStartupDetector detector     = new EngineStartupDetector(rpmData);

            if (!detector.EngineStartupDetected())
            {
                return(result);
            }
            IList <int> startupIndexes = detector.GetEngineStartupPointIndexes();

            foreach (int startupIndex in startupIndexes)
            {
                double res = StartupRegionExtractor.Extract(startupIndex, requiredData).Max();
                result.Values.Add(new AnalyticStatisticsValue(
                                      res, info.Vin, set.Id, sourceDataCaptureTime));
            }
            return(result);
        }