コード例 #1
0
        /// <summary>
        /// Converts SummaryVolumesProfileResponse data into SummaryVolumesProfileResult data.
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private ProfileDataResult <SummaryVolumesProfileCell> ConvertResult(ProfileRequestResponse <SummaryVolumeProfileCell> result)
        {
            var profileCells = result.ProfileCells.Select(pc =>
                                                          new SummaryVolumesProfileCell(
                                                              pc.Station,
                                                              pc.InterceptLength,
                                                              pc.OTGCellX,
                                                              pc.OTGCellY,
                                                              pc.DesignElev,
                                                              pc.LastCellPassElevation1,
                                                              pc.LastCellPassElevation2))
                               .ToList();

            return(new ProfileDataResult <SummaryVolumesProfileCell>(result.GridDistanceBetweenProfilePoints, profileCells));
        }
コード例 #2
0
        public void Test_ProfileRequestResponse()
        {
            var cell = new ProfileCell(new FilteredMultiplePassInfo(new [] { new FilteredPassData() }),
                                       1, 2, 3.0, 4.0);

            var cells = new List <ProfileCell> {
                cell
            };

            var response = new ProfileRequestResponse <ProfileCell>
            {
                ResultStatus = RequestErrorStatus.OK,
                ProfileCells = cells
            };

            var result = SimpleBinarizableInstanceTester.TestClass(response, "Custom ProfileRequestResponse not same after round trip serialisation");

            Assert.True(result != null);
        }
コード例 #3
0
        /// <summary>
        /// Converts SummaryVolumesProfileResponse data into SummaryVolumesProfileResult data.
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private ProfileDataResult <ProfileCellData> ConvertResult(ProfileRequestResponse <ProfileCell> result)
        {
            var profileCells = result.ProfileCells.Select(pc =>
                                                          new ProfileCellData(
                                                              pc.Station,
                                                              pc.InterceptLength,
                                                              pc.CellFirstElev,
                                                              pc.CellLastElev,
                                                              pc.CellLowestElev,
                                                              pc.CellHighestElev,
                                                              pc.CellFirstCompositeElev,
                                                              pc.CellHighestCompositeElev,
                                                              pc.CellLastCompositeElev,
                                                              pc.CellLowestCompositeElev,
                                                              pc.DesignElev,
                                                              pc.CellCCV,
                                                              pc.CellTargetCCV,
                                                              pc.CellCCVElev,
                                                              pc.CellPreviousMeasuredCCV,
                                                              pc.CellPreviousMeasuredTargetCCV,
                                                              pc.CellMDP,
                                                              pc.CellTargetMDP,
                                                              pc.CellMDPElev,
                                                              pc.CellMaterialTemperature,
                                                              pc.CellMaterialTemperatureWarnMin,
                                                              pc.CellMaterialTemperatureWarnMax,
                                                              pc.CellMaterialTemperatureElev,
                                                              pc.CellTopLayerThickness,
                                                              pc.TopLayerPassCount,
                                                              pc.TopLayerPassCountTargetRangeMin,
                                                              pc.TopLayerPassCountTargetRangeMax,
                                                              pc.CellMinSpeed,
                                                              pc.CellMaxSpeed))
                               .ToList();

            return(new ProfileDataResult <ProfileCellData>(result.GridDistanceBetweenProfilePoints, profileCells));
        }
コード例 #4
0
        /// <summary>
        /// Executes the profiler logic in the cluster compute context where each cluster node processes its fraction of the work and returns the
        /// results to the application service context
        /// </summary>
        public async Task <ProfileRequestResponse <T> > ExecuteAsync()
        {
            LiftParams.CCVSummaryTypes |= CCVSummaryTypes.Compaction;
            LiftParams.MDPSummaryTypes |= MDPSummaryTypes.Compaction;

            ProfileRequestResponse <T> Response = null;

            try
            {
                var ProfileCells = new List <T>(INITIAL_PROFILE_LIST_SIZE);

                try
                {
                    // Note: Start/end point lat/lon fields have been converted into grid local coordinate system by this point
                    if (NEECoords.Length > 1)
                    {
                        Log.LogInformation($"#In#: DataModel {ProjectID}, Vertices:{NEECoords[0]} -> {NEECoords[1]}");
                    }
                    else
                    {
                        Log.LogWarning($"#In#: DataModel {ProjectID}, Note! vertices list has insufficient vertices (min of 2 required)");
                    }

                    SiteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(ProjectID);

                    if (SiteModel == null)
                    {
                        Log.LogWarning($"Failed to locate site model {ProjectID}");
                        return(Response = new ProfileRequestResponse <T> {
                            ResultStatus = RequestErrorStatus.NoSuchDataModel
                        });
                    }

                    // Obtain the sub grid existence map for the project
                    var ProdDataExistenceMap = SiteModel.ExistenceMap;

                    var PopulationControl = new FilteredValuePopulationControl();
                    PopulationControl.PreparePopulationControl(ProfileTypeRequired, LiftParams, Filters.Filters[0].AttributeFilter);

                    IDesignWrapper designWrapper = null;
                    if (Design != null && Design.DesignID != Guid.Empty)
                    {
                        var design = SiteModel.Designs.Locate(Design.DesignID);
                        if (design == null)
                        {
                            throw new ArgumentException($"Design {Design.DesignID} is unknown in project {SiteModel.ID}");
                        }
                        designWrapper = new DesignWrapper(Design, design);
                    }

                    Log.LogInformation("Creating IProfileBuilder");
                    var Profiler = DIContext.Obtain <IProfilerBuilder <T> >();
                    if (Profiler == null)
                    {
                        Log.LogWarning($"Failed to create IProfileBuilder via DI");
                        return(Response = new ProfileRequestResponse <T> {
                            ResultStatus = RequestErrorStatus.FailedOnRequestProfile
                        });
                    }

                    Profiler.Configure(ProfileStyle, SiteModel, ProdDataExistenceMap, ProfileTypeRequired, Filters,
                                       designWrapper, PopulationControl,
                                       new CellPassFastEventLookerUpper(SiteModel), VolumeType, Overrides, LiftParams);

                    Log.LogInformation("Building cell profile");
                    if (Profiler.CellProfileBuilder.Build(NEECoords, ProfileCells))
                    {
                        SetupForCellPassStackExamination(Filters.Filters[0].AttributeFilter);

                        Log.LogInformation("Building lift profile");
                        if (Profiler.CellProfileAnalyzer.Analyze(ProfileCells, CellPassIterator))
                        {
                            Log.LogInformation("Lift profile building succeeded");

                            // Remove null cells in the profiles list. NUll cells are defined by cells with null CellLastHeight.
                            // All duplicate null cells will be replaced by a by single null cell entry
                            var ThinnedProfileCells = ProfileCells.Where((x, i) =>
                                                                         i == 0 || !ProfileCells[i].IsNull() || (ProfileCells[i].IsNull() && !ProfileCells[i - 1].IsNull())).ToList();

                            Response = new ProfileRequestResponse <T>
                            {
                                ProfileCells = ThinnedProfileCells,
                                ResultStatus = RequestErrorStatus.OK
                            };

                            return(Response);
                        }

                        Log.LogInformation("Lift profile building failed");
                    }
                }
                finally
                {
                    Log.LogInformation($"#Out# Execute: DataModel {ProjectID} complete for profile line. #Result#:{Response?.ResultStatus ?? RequestErrorStatus.Exception} with {Response?.ProfileCells?.Count ?? 0} vertices");
                }
            }
            catch (Exception E)
            {
                Log.LogError(E, "Execute: Exception:");
            }

            return(new ProfileRequestResponse <T>());
        }