/// <summary> /// Copy constructor /// </summary> /// <param name="cell">The cell to copy</param> public CompactionProfileCell(CompactionProfileCell cell) { cellType = cell.cellType; station = cell.station; firstPassHeight = cell.firstPassHeight; highestPassHeight = cell.highestPassHeight; lastPassHeight = cell.lastPassHeight; lowestPassHeight = cell.lowestPassHeight; lastCompositeHeight = cell.lastCompositeHeight; designHeight = cell.designHeight; cmv = cell.cmv; cmvPercent = cell.cmvPercent; cmvHeight = cell.cmvHeight; mdpPercent = cell.mdpPercent; mdpHeight = cell.mdpHeight; temperature = cell.temperature; temperatureHeight = cell.temperatureHeight; topLayerPassCount = cell.topLayerPassCount; cmvPercentChange = cell.cmvPercentChange; minSpeed = cell.minSpeed; maxSpeed = cell.maxSpeed; cutFill = cell.cutFill; passCountIndex = cell.passCountIndex; temperatureIndex = cell.temperatureIndex; cmvIndex = cell.cmvIndex; mdpIndex = cell.mdpIndex; speedIndex = cell.speedIndex; }
private CompactionProfileResult <CompactionProfileCell> ProcessProductionDataProfileCells(List <ProfileCellData> profileCells, double gridDistanceBetweenProfilePoints, LiftBuildSettings liftBuildSettings) { var profile = new CompactionProfileResult <CompactionProfileCell>(); profile.results = new List <CompactionProfileCell>(); ProfileCellData prevCell = null; foreach (var currCell in profileCells) { var gapExists = ProfilesHelper.CellGapExists(prevCell, currCell, out double prevStationIntercept); if (gapExists) { var gapCell = new CompactionProfileCell(GapCell); gapCell.station = prevStationIntercept; profile.results.Add(gapCell); } var lastPassHeight = currCell.LastPassHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.LastPassHeight; var lastCompositeHeight = currCell.CompositeLastPassHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.CompositeLastPassHeight; var designHeight = currCell.DesignHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.DesignHeight; bool noCCVValue = currCell.TargetCCV == 0 || currCell.TargetCCV == VelociraptorConstants.NO_CCV || currCell.CCV == VelociraptorConstants.NO_CCV; bool noCCVElevation = currCell.CCVElev == VelociraptorConstants.NULL_SINGLE || noCCVValue; bool noMDPValue = currCell.TargetMDP == 0 || currCell.TargetMDP == VelociraptorConstants.NO_MDP || currCell.MDP == VelociraptorConstants.NO_MDP; bool noMDPElevation = currCell.MDPElev == VelociraptorConstants.NULL_SINGLE || noMDPValue; bool noTemperatureValue = currCell.MaterialTemperature == VelociraptorConstants.NO_TEMPERATURE; bool noTemperatureElevation = currCell.MaterialTemperatureElev == VelociraptorConstants.NULL_SINGLE || noTemperatureValue; bool noPassCountValue = currCell.TopLayerPassCount == VelociraptorConstants.NO_PASSCOUNT; //Either have none or both speed values var noSpeedValue = currCell.CellMaxSpeed == VelociraptorConstants.NO_SPEED; var speedMin = noSpeedValue ? float.NaN : (float)(currCell.CellMinSpeed / ConversionConstants.KM_HR_TO_CM_SEC); var speedMax = noSpeedValue ? float.NaN : (float)(currCell.CellMaxSpeed / ConversionConstants.KM_HR_TO_CM_SEC); var cmvPercent = noCCVValue ? float.NaN : (float)currCell.CCV / (float)currCell.TargetCCV * 100.0F; var mdpPercent = noMDPValue ? float.NaN : (float)currCell.MDP / (float)currCell.TargetMDP * 100.0F; var firstPassHeight = currCell.FirstPassHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.FirstPassHeight; var highestPassHeight = currCell.HighestPassHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.HighestPassHeight; var lowestPassHeight = currCell.LowestPassHeight == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.LowestPassHeight; var cutFill = float.IsNaN(lastCompositeHeight) || float.IsNaN(designHeight) ? float.NaN : lastCompositeHeight - designHeight; var cmv = noCCVValue ? float.NaN : currCell.CCV / 10.0F; var cmvHeight = noCCVElevation ? float.NaN : currCell.CCVElev; var mdpHeight = noMDPElevation ? float.NaN : currCell.MDPElev; var temperature = noTemperatureValue ? float.NaN : currCell.MaterialTemperature / 10.0F; // As temperature is reported in 10th... var temperatureHeight = noTemperatureElevation ? float.NaN : currCell.MaterialTemperatureElev; var topLayerPassCount = noPassCountValue ? -1 : currCell.TopLayerPassCount; var cmvPercentChange = currCell.CCV == VelociraptorConstants.NO_CCV ? float.NaN : (currCell.PrevCCV == VelociraptorConstants.NO_CCV ? 100.0f : (float)(currCell.CCV - currCell.PrevCCV) / (float)currCell.PrevCCV * 100.0f); var passCountIndex = noPassCountValue || float.IsNaN(lastPassHeight) ? ValueTargetType.NoData : (currCell.TopLayerPassCount < currCell.TopLayerPassCountTargetRangeMin ? ValueTargetType.BelowTarget : (currCell.TopLayerPassCount > currCell.TopLayerPassCountTargetRangeMax ? ValueTargetType.AboveTarget : ValueTargetType.OnTarget)); var temperatureIndex = noTemperatureValue || noTemperatureElevation ? ValueTargetType.NoData : (currCell.MaterialTemperature < currCell.MaterialTemperatureWarnMin ? ValueTargetType.BelowTarget : (currCell.MaterialTemperature > currCell.MaterialTemperatureWarnMax ? ValueTargetType.AboveTarget : ValueTargetType.OnTarget)); var cmvIndex = noCCVValue || noCCVElevation ? ValueTargetType.NoData : (cmvPercent < liftBuildSettings.CCVRange.Min ? ValueTargetType.BelowTarget : (cmvPercent > liftBuildSettings.CCVRange.Max ? ValueTargetType.AboveTarget : ValueTargetType.OnTarget)); var mdpIndex = noMDPValue || noMDPElevation ? ValueTargetType.NoData : (mdpPercent < liftBuildSettings.MDPRange.Min ? ValueTargetType.BelowTarget : (mdpPercent > liftBuildSettings.MDPRange.Max ? ValueTargetType.AboveTarget : ValueTargetType.OnTarget)); var speedIndex = noSpeedValue || float.IsNaN(lastPassHeight) ? ValueTargetType.NoData : (currCell.CellMaxSpeed > liftBuildSettings.MachineSpeedTarget.MaxTargetMachineSpeed ? ValueTargetType.AboveTarget : (currCell.CellMinSpeed < liftBuildSettings.MachineSpeedTarget.MinTargetMachineSpeed && currCell.CellMaxSpeed < liftBuildSettings.MachineSpeedTarget.MinTargetMachineSpeed ? ValueTargetType.BelowTarget : ValueTargetType.OnTarget)); profile.results.Add(new CompactionProfileCell { cellType = prevCell == null ? ProfileCellType.MidPoint : ProfileCellType.Edge, station = currCell.Station, firstPassHeight = firstPassHeight, highestPassHeight = highestPassHeight, lastPassHeight = lastPassHeight, lowestPassHeight = lowestPassHeight, lastCompositeHeight = lastCompositeHeight, designHeight = designHeight, cutFill = cutFill, cmv = cmv, cmvPercent = cmvPercent, cmvHeight = cmvHeight, mdpPercent = mdpPercent, mdpHeight = mdpHeight, temperature = temperature, temperatureHeight = temperatureHeight, topLayerPassCount = topLayerPassCount, cmvPercentChange = cmvPercentChange, minSpeed = speedMin, maxSpeed = speedMax, passCountIndex = passCountIndex, temperatureIndex = temperatureIndex, cmvIndex = cmvIndex, mdpIndex = mdpIndex, speedIndex = speedIndex }); prevCell = currCell; } //Add a last point at the intercept length of the last cell so profiles are drawn correctly if (prevCell != null && prevCell.InterceptLength > ProfilesHelper.ONE_MM) { var lastCell = new CompactionProfileCell(profile.results[profile.results.Count - 1]) { station = prevCell.Station + prevCell.InterceptLength }; profile.results.Add(lastCell); } if (profile.results.Count > 0) { profile.results[profile.results.Count - 1].cellType = ProfileCellType.MidPoint; } profile.gridDistanceBetweenProfilePoints = gridDistanceBetweenProfilePoints; var sb = new StringBuilder(); sb.Append($"After profile conversion: {profile.results.Count}"); foreach (var cell in profile.results) { sb.Append($",{cell.cellType}"); } log.LogDebug(sb.ToString()); return(profile); }