コード例 #1
0
        public void Test()
        {
            SettingsAtom atom = new SettingsAtom();

            atom.MinOptimal    = 0.5;
            atom.MaxOptimal    = 1.5;
            atom.MaxAcceptable = 3.1;
            SettingsAtomApplierByAbsoluteValue applier =
                new SettingsAtomApplierByAbsoluteValue(atom);

            Assert.IsTrue(applier.GetMarkForValue(1.5) == 9);
            Assert.IsTrue(applier.GetMarkForValue(0.5) == 9);
            Assert.IsTrue(applier.GetMarkForValue(0.75) == 10);
            Assert.IsTrue(applier.GetMarkForValue(0.91) == 10);
            Assert.IsTrue(applier.GetMarkForValue(2.5) > 2);
            Assert.IsTrue(applier.GetMarkForValue(2.5) < 8);
            Assert.IsTrue(applier.GetMarkForValue(3.1) == 2);
            Assert.IsTrue(applier.GetMarkForValue(4) == 1);
            double d = applier.GetMarkForValue(2.5);
        }
コード例 #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);
        }