Пример #1
0
        public async Task Test_CellDatumRequest_ClusterCompute_Execute_SingleCellSiteModelMinimalValues(DisplayMode mode)
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();
            AddDesignProfilerGridRouting();

            var baseTime        = DateTime.UtcNow;
            var siteModel       = BuildModelForSingleCellDatum(baseTime, true);
            var designUid       = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 1.0f);
            var referenceDesign = new DesignOffset(designUid, 0);
            var request         = new CellDatumRequest_ClusterCompute();
            var arg             = CreateCellDatumRequestArgument_ClusterCompute(siteModel, referenceDesign, mode, new OverrideParameters());
            var response        = await request.ExecuteAsync(arg, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, arg.OTGCellX, arg.OTGCellY));

            response.Should().NotBeNull();
            //Only elevation and pass count
            var expected = CellDatumReturnCode.NoValueFound;

            switch (mode)
            {
            case DisplayMode.Height:
            case DisplayMode.CutFill:
            case DisplayMode.PassCount:
            case DisplayMode.PassCountSummary:
                expected = CellDatumReturnCode.ValueFound;
                break;
            }
            Assert.Equal(expected, response.ReturnCode);
        }
Пример #2
0
        [InlineData(DisplayMode.CutFill, 3.5, false)]//1.5 offset from 5
        public async Task Test_CellDatumRequest_ClusterCompute_Execute_SingleCellSiteModelLastPass(DisplayMode mode, double expectedValue, bool withOverrides)
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();
            AddDesignProfilerGridRouting();

            var baseTime        = DateTime.UtcNow;
            var siteModel       = BuildModelForSingleCellDatum(baseTime);
            var designUid       = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 1.0f);
            var referenceDesign = new DesignOffset(designUid, 1.5);
            var overrides       = withOverrides
        ? new OverrideParameters
            {
                OverrideMachineCCV             = true,
                OverridingMachineCCV           = 440,
                OverrideMachineMDP             = true,
                OverridingMachineMDP           = 440,
                OverrideTargetPassCount        = true,
                OverridingTargetPassCountRange = new PassCountRangeRecord(4, 8)
                                                 //others not used in cell datum
            }
        : new OverrideParameters();
            var request  = new CellDatumRequest_ClusterCompute();
            var arg      = CreateCellDatumRequestArgument_ClusterCompute(siteModel, referenceDesign, mode, overrides);
            var response = await request.ExecuteAsync(arg, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, arg.OTGCellX, arg.OTGCellY));

            response.Should().NotBeNull();
            Assert.Equal(CellDatumReturnCode.ValueFound, response.ReturnCode);
            Assert.Equal(expectedValue, response.Value);
            Assert.Equal(baseTime.AddMinutes(10), response.TimeStampUTC);
        }
Пример #3
0
        public void Test_CellDatumRequest_ClusterCompute_Execute_MissingDesign()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();
            var request   = new CellDatumRequest_ClusterCompute();

            Assert.ThrowsAsync <ArgumentException>(async() => await request.ExecuteAsync(CreateCellDatumRequestArgument_ClusterCompute(siteModel, new DesignOffset(Guid.NewGuid(), -0.5), DisplayMode.Height, new OverrideParameters()), new SubGridSpatialAffinityKey()));
        }
Пример #4
0
        public async Task Test_CellDatumRequest_ClusterCompute_Execute_EmptySiteModel()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();
            var request   = new CellDatumRequest_ClusterCompute();

            var response = await request.ExecuteAsync(CreateCellDatumRequestArgument_ClusterCompute(siteModel, new DesignOffset(), DisplayMode.Height, new OverrideParameters()), new SubGridSpatialAffinityKey());

            response.Should().NotBeNull();
            Assert.Equal(CellDatumReturnCode.NoValueFound, response.ReturnCode);
        }
Пример #5
0
        /// <summary>
        /// Executor that implements requesting and rendering sub grid information to create the cell datum
        /// </summary>
        public async Task <CellDatumResponse_ApplicationService> ExecuteAsync(CellDatumRequestArgument_ApplicationService arg)
        {
            Log.LogInformation($"Performing Execute for DataModel:{arg.ProjectID}, Mode={arg.Mode}");

            var result = new CellDatumResponse_ApplicationService
            {
                ReturnCode = CellDatumReturnCode.UnexpectedError, DisplayMode = arg.Mode, Northing = arg.Point.Y, Easting = arg.Point.X
            };

            var siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(arg.ProjectID);

            if (siteModel == null)
            {
                Log.LogError($"Failed to locate site model {arg.ProjectID}");
                return(result);
            }

            if (!arg.CoordsAreGrid)
            {
                //WGS84 coords need to be converted to NEE
                var pointToConvert = new XYZ(arg.Point.X, arg.Point.Y, 0);
                arg.Point       = DIContext.Obtain <ICoreXWrapper>().LLHToNEE(siteModel.CSIB(), pointToConvert.ToCoreX_XYZ(), CoreX.Types.InputAs.Radians).ToTRex_XYZ();
                result.Northing = arg.Point.Y;
                result.Easting  = arg.Point.X;
            }

            var existenceMap = siteModel.ExistenceMap;

            // Determine the on-the-ground cell
            siteModel.Grid.CalculateIndexOfCellContainingPosition(arg.Point.X, arg.Point.Y, out int OTGCellX, out int OTGCellY);

            if (!existenceMap[OTGCellX >> SubGridTreeConsts.SubGridIndexBitsPerLevel, OTGCellY >> SubGridTreeConsts.SubGridIndexBitsPerLevel])
            {
                result.ReturnCode = CellDatumReturnCode.NoValueFound;
                return(result);
            }

            //Now get the production data for this cell
            var argClusterCompute = new CellDatumRequestArgument_ClusterCompute(
                arg.ProjectID, arg.Mode, arg.Point, OTGCellX, OTGCellY, arg.Filters, arg.ReferenceDesign, arg.Overrides, arg.LiftParams);
            var request  = new CellDatumRequest_ClusterCompute();
            var response = await request.ExecuteAsync(argClusterCompute, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, OTGCellX, OTGCellY));

            result.ReturnCode   = response.ReturnCode;
            result.Value        = response.Value;
            result.TimeStampUTC = response.TimeStampUTC;

            return(result);
        }