Ejemplo n.º 1
0
 private void SharedTestTimerOnElapsed(object sender, ElapsedEventArgs e)
 {
     if (IsTestRunning)
     {
         if (IsTestCanceled)
         {
             IsTestRunning  = false;
             IsTestCanceled = true;
             TestComplete.Invoke(TestSysResult.Canceled);
         }
         else if (e.SignalTime - BeginTime > _testTimeout)
         {
             // timeout
             IsTestRunning = false;
             ProgressChanged.Invoke(100, TestSysStepResult.Bad, "МУК не включает Emerson");
             TestComplete.Invoke(TestSysResult.Fail);
         }
         else
         {
             if (LastReceivedData.Diagnostic3Parsed.MukIsSwitchingEmersionOn)
             {
                 IsTestRunning    = false;
                 LastReceivedData = null;
                 ProgressChanged.Invoke(100, TestSysStepResult.Good, "Включение Emerson осуществлено");
                 TestComplete.Invoke(TestSysResult.Success);
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the stopwatch and execute the function.
        /// </summary>
        private void RunTest()
        {
            _executionTimer = Stopwatch.StartNew();
            _testFunction.Invoke();
            _executionTimer.Stop();

            TestComplete?.Invoke(_executionTimer.Elapsed);
        }
Ejemplo n.º 3
0
        public void Test(byte[,] input, byte[] input_tests)
        {
            List <double[]> features = new List <double[]>();

            for (int i = 0; i < input.GetLength(0); i++)
            {
                double[] f = new double[input.GetLength(1)];
                for (int j = 0; j < input.GetLength(1); j++)
                {
                    f[j] = NormalizePixelValues(input[i, j]);
                }
                features.Add(f);
            }

            int count = 0, correct = 0;

            for (int i = 0; i < input.GetLength(0); i++)
            {
                var res = nnet.FeedForward(features[i]);
                count++;
                double maxConfidence = 0;
                int    digit         = 0;
                for (int j = 0; j < res.Length; j++)
                {
                    if (res[j] > maxConfidence)
                    {
                        maxConfidence = res[j];
                        digit         = j;
                    }
                }
                if (digit == input_tests[i])
                {
                    correct++;
                }

                TestProgressChanged?.Invoke(this, new TestProgressChangedEventArgs(count, correct));

                //Debug.WriteLine("Predicted: " + digit + " Real: " + input_tests[i] + " Acc.: " + ((double)correct / count * 100).ToString("#.##") + "% Total: " + count + " Correct: " + correct);
            }

            TestComplete?.Invoke(this, new TestProgressChangedEventArgs(count, correct));
        }
Ejemplo n.º 4
0
 protected void OnTestComplete()
 {
     TestComplete?.Invoke(this);
 }