Ejemplo n.º 1
0
        async Task testAsync(AxisTestMode mode, int numOfPoints, IProgress <double> progress, CancellationToken cancellation)
        {
            var averagePoints = await aquireAveragePoints();

            switch (mode)
            {
            case AxisTestMode.XZ:
                _axisTestResults.X0 = checkRangeOrNull(averagePoints.X, G0_INTERVAL);
                _axisTestResults.Z0 = checkRangeOrNull(averagePoints.Z, G0_INTERVAL);
                if (_axisTestResults.X0 == null ||
                    _axisTestResults.Z0 == null)
                {
                    Logger.LogError($"Параметры вышли за допустимый диапазон", $"-MSG. Все параметры: {averagePoints}");
                }
                break;

            case AxisTestMode.Y:
                _axisTestResults.Y0 = checkRangeOrNull(averagePoints.Y, G0_INTERVAL);
                if (_axisTestResults.Y0 == null)
                {
                    Logger.LogError($"Параметры вышли за допустимый диапазон", $"-MSG. Все параметры: {averagePoints}");
                }
                break;

            default:
                throw new NotSupportedException();
            }

            return; //////////////////////////////////////////////////////////////////

            async Task <(double X, double Y, double Z)> aquireAveragePoints()
            {
                (double X, double Y, double Z)avg = (0, 0, 0);
                for (int i = 1; i <= numOfPoints; i++)
                {
                    var points = await fetchPoints();

                    avg.X += points.X;
                    avg.Y += points.Y;
                    avg.Z += points.Z;

                    progress.Report(i / (double)numOfPoints);
                }
                avg.X /= numOfPoints;
                avg.Y /= numOfPoints;
                avg.Z /= numOfPoints;

                return(avg);
            }
        }
Ejemplo n.º 2
0
 ShockTestMode instantiateTestMode(AxisTestMode testMode)
 {
     return(new ShockTestMode(testMode, NumOfTestingPoints));
 }
Ejemplo n.º 3
0
 public ShockTestMode(AxisTestMode mode, int numOfPoints)
 {
     _mode        = mode;
     _numOfPoints = numOfPoints;
     TestType     = TestType.AXIS;
 }