コード例 #1
0
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                ReturnCode = (CellPassesReturnCode)reader.ReadInt();
                Northing   = reader.ReadDouble();
                Easting    = reader.ReadDouble();

                var numResults = reader.ReadInt();
                CellPasses = new List <ClientCellProfileLeafSubgridRecord>(numResults);
                var bytes = reader.ReadByteArray();
                using (var ms = new MemoryStream(bytes))
                {
                    using (var br = new BinaryReader(ms, Encoding.UTF8, true))
                    {
                        for (var i = 0; i < numResults; i++)
                        {
                            var record = new ClientCellProfileLeafSubgridRecord();
                            record.Read(br);
                            CellPasses.Add(record);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void Test_NullCells()
        {
            var cell = new ClientCellProfileLeafSubgridRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CellProfile) as ClientCellProfileLeafSubgrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].Equals(cell)));
        }
コード例 #3
0
        private CellPassesV2Result.FilteredPassData ConvertCellPass(ClientCellProfileLeafSubgridRecord cellPass, Guid machineId)
        {
            var result = new CellPassesV2Result.FilteredPassData
            {
                FilteredPass = new CellPassesV2Result.CellPassValue
                {
                    Time                = cellPass.LastPassTime,
                    Amplitude           = cellPass.LastPassValidAmp,
                    Height              = cellPass.Height,
                    Ccv                 = cellPass.LastPassValidCCV,
                    Mdp                 = cellPass.LastPassValidMDP,
                    Rmv                 = cellPass.LastPassValidRMV,
                    MachineSpeed        = cellPass.MachineSpeed,
                    Frequency           = cellPass.LastPassValidFreq,
                    GpsModeStore        = (byte)cellPass.LastPassValidGPSMode,
                    MachineUid          = machineId,
                    MaterialTemperature = cellPass.LastPassValidTemperature,
                    RadioLatency        = byte.MaxValue, // Not present in cell pass
                    HalfPass            = cellPass.HalfPass
                },
                TargetsValue = new CellPassesV2Result.CellTargetsValue
                {
                    TargetCcv           = cellPass.TargetCCV,
                    TargetMdp           = cellPass.TargetMDP,
                    TargetPassCount     = (ushort)cellPass.TargetPassCount,
                    TargetThickness     = cellPass.TargetThickness,
                    TempWarningLevelMax = cellPass.TempWarningLevelMin,
                    TempWarningLevelMin = cellPass.TempWarningLevelMax
                },
                EventsValue = new CellPassesV2Result.CellEventsValue
                {
                    EventAutoVibrationState = AutoStateType.Unknown,                  // Not present in cell pass
                    EventDesignNameId       = cellPass.EventDesignNameID,
                    EventIcFlags            = CellPassConsts.NullEventIcFlags,        // Not present in cell pass
                    EventInAvoidZoneState   = CellPassConsts.NullEventAvoidZoneState, // Not present in cell pass
                    EventMachineGear        = (MachineGearType)cellPass.EventMachineGear,
                    EventVibrationState     = ConvertVibState(cellPass.EventVibrationState),
                    EventOnGroundState      = OnGroundStateType.Unknown, // Not present in cell pass
                    GpsAccuracy             = ConvertGpsAccuracy(cellPass.GPSAccuracy),
                    GpsTolerance            = cellPass.GPSTolerance,
                    LayerId = cellPass.LayerID,
                    MapResetDesignNameId = CellPassConsts.NullEventMapResetDesignNameId, // Not present in cell pass
                    MapResetPriorDate    = CellPassConsts.NullTime,                      // Not present in cell pass
                    PositioningTech      = PositioningTechType.Unknown                   // Not present in cell pass
                }
            };

            return(result);
        }
コード例 #4
0
        private string FormatADataRow(ClientCellProfileLeafSubgridRecord cell, double easting, double northing, int runningIndexLLHCoords)
        {
            var resultString = new StringBuilder();

            if (!cell.LastPassTime.Equals(_runningLastPassTime))
            {
                _cellPassTimeString  = _csvExportFormatter.FormatCellPassTime(cell.LastPassTime);
                _runningLastPassTime = cell.LastPassTime;
            }
            resultString.Append($"{_cellPassTimeString},");

            if (!(_runningNorthing.Equals(northing) && _runningEasting.Equals(easting)))
            {
                _coordString     = FormatCoordinate(northing, easting, runningIndexLLHCoords);
                _runningNorthing = northing;
                _runningEasting  = easting;
            }
            resultString.Append($"{_coordString},");

            if (!cell.Height.Equals(_runningHeight))
            {
                _heightString  = _csvExportFormatter.FormatElevation(cell.Height);
                _runningHeight = cell.Height;
            }
            resultString.Append($"{_heightString},");

            resultString.Append($"{cell.PassCount},");

            var lastPassValidRadioLatencyString = _csvExportFormatter.FormatRadioLatency(cell.LastPassValidRadioLatency);

            resultString.Append($"{lastPassValidRadioLatencyString},");

            if (!cell.EventDesignNameID.Equals(_runningDesignNameId))
            {
                _lastDesignNameString = FormatDesignNameID(cell.EventDesignNameID);
                _runningDesignNameId  = cell.EventDesignNameID;
            }
            resultString.Append($"{_lastDesignNameString},");

            if (!cell.InternalSiteModelMachineIndex.Equals(_runningMachineId))
            {
                _lastMachineNameString = FormatMachineName(cell.InternalSiteModelMachineIndex);
                _runningMachineId      = cell.InternalSiteModelMachineIndex;
            }
            resultString.Append($"{_lastMachineNameString},");

            if (!cell.MachineSpeed.Equals(_runningMachineSpeed))
            {
                _machineSpeedString  = _csvExportFormatter.FormatSpeed(cell.MachineSpeed);
                _runningMachineSpeed = cell.MachineSpeed;
            }
            resultString.Append($"{_machineSpeedString},");

            if (!cell.LastPassValidGPSMode.Equals(_runningGpsMode))
            {
                _gpsModeString  = _csvExportFormatter.FormatGPSMode(cell.LastPassValidGPSMode);
                _runningGpsMode = cell.LastPassValidGPSMode;
            }
            resultString.Append($"{_gpsModeString},");

            if (!(cell.GPSAccuracy.Equals(_runningGpsAccuracy) && cell.GPSTolerance.Equals(_runningGpsTolerance)))
            {
                _gpsAccuracyToleranceString = _csvExportFormatter.FormatGPSAccuracy(cell.GPSAccuracy, cell.GPSTolerance);
                _runningGpsAccuracy         = cell.GPSAccuracy;
                _runningGpsTolerance        = cell.GPSTolerance;
            }
            resultString.Append($"{_gpsAccuracyToleranceString},");

            if (!cell.TargetPassCount.Equals(_runningTargetPassCount))
            {
                _targetPassCountString  = _csvExportFormatter.FormatPassCount(cell.TargetPassCount);
                _runningTargetPassCount = cell.TargetPassCount;
            }
            resultString.Append($"{_targetPassCountString},");

            resultString.Append($"{cell.TotalWholePasses},");

            resultString.Append($"{cell.LayersCount},"); // for cellPasses this contains layerID

            if (!cell.LastPassValidCCV.Equals(_runningLastPassValidCcv))
            {
                _lastPassValidCcvString  = _csvExportFormatter.FormatCompactionCCVTypes(cell.LastPassValidCCV);
                _runningLastPassValidCcv = cell.LastPassValidCCV;
            }
            resultString.Append($"{_lastPassValidCcvString},");

            if (!cell.TargetCCV.Equals(_runningTargetCcv))
            {
                _lastTargetCcvString = _csvExportFormatter.FormatCompactionCCVTypes(cell.TargetCCV);
                _runningTargetCcv    = cell.TargetCCV;
            }
            resultString.Append($"{_lastTargetCcvString},");

            if (!cell.LastPassValidMDP.Equals(_runningLastPassValidMdp))
            {
                _lastPassValidMdpString  = _csvExportFormatter.FormatCompactionCCVTypes(cell.LastPassValidMDP);
                _runningLastPassValidMdp = cell.LastPassValidMDP;
            }
            resultString.Append($"{_lastPassValidMdpString},");

            if (!cell.TargetMDP.Equals(_runningTargetMdp))
            {
                _lastTargetMdpString = _csvExportFormatter.FormatCompactionCCVTypes(cell.TargetMDP);
                _runningTargetMdp    = cell.TargetMDP;
            }
            resultString.Append($"{_lastTargetMdpString},");

            if (!cell.LastPassValidRMV.Equals(_runningValidRmv))
            {
                _lastValidRmvString = _csvExportFormatter.FormatCompactionCCVTypes(cell.LastPassValidRMV);
                _runningValidRmv    = cell.LastPassValidRMV;
            }
            resultString.Append($"{_lastValidRmvString},");

            if (!cell.LastPassValidFreq.Equals(_runningValidFreq))
            {
                _lastValidFreqString = _csvExportFormatter.FormatFrequency(cell.LastPassValidFreq);
                _runningValidFreq    = cell.LastPassValidFreq;
            }
            resultString.Append($"{_lastValidFreqString},");

            if (!cell.LastPassValidAmp.Equals(_runningValidAmp))
            {
                _lastValidAmpString = _csvExportFormatter.FormatAmplitude(cell.LastPassValidAmp);
                _runningValidAmp    = cell.LastPassValidAmp;
            }
            resultString.Append($"{_lastValidAmpString},");

            if (!cell.TargetThickness.Equals(_runningTargetThickness))
            {
                _lastTargetThicknessString = _csvExportFormatter.FormatTargetThickness(cell.TargetThickness);
                _runningTargetThickness    = cell.TargetThickness;
            }
            resultString.Append($"{_lastTargetThicknessString},");

            if (!cell.EventMachineGear.Equals(_runningEventMachineGear))
            {
                _lastEventMachineGearString = _csvExportFormatter.FormatMachineGearValue(cell.EventMachineGear);
                _runningEventMachineGear    = cell.EventMachineGear;
            }
            resultString.Append($"{_lastEventMachineGearString},");

            if (!cell.EventVibrationState.Equals(_runningEventVibrationState))
            {
                _lastEventVibrationStateString = _csvExportFormatter.FormatEventVibrationState(cell.EventVibrationState);
                _runningEventVibrationState    = cell.EventVibrationState;
            }
            resultString.Append($"{_lastEventVibrationStateString},");

            if (!cell.LastPassValidTemperature.Equals(_runningLastPassValidTemperature))
            {
                _lastPassValidTemperatureString  = _csvExportFormatter.FormatLastPassValidTemperature(cell.LastPassValidTemperature);
                _runningLastPassValidTemperature = cell.LastPassValidTemperature;
            }
            resultString.Append($"{_lastPassValidTemperatureString}"); // no training comma

            return(resultString.ToString());
        }
コード例 #5
0
        /// <summary>
        /// Gets the required datum from the cell according to the requested display mode
        /// </summary>
        private async Task ExtractRequiredValue(IDesignWrapper cutFillDesign, ClientCellProfileLeafSubgridRecord cell, CellDatumResponse_ClusterCompute result, CellDatumRequestArgument_ClusterCompute arg)
        {
            var success = false;
            int intValue;

            switch (arg.Mode)
            {
            case DisplayMode.Height:
                result.Value = cell.Height;
                success      = result.Value != CellPassConsts.NullHeight;
                break;

            case DisplayMode.CCV:
            case DisplayMode.CompactionCoverage:
                result.Value = cell.LastPassValidCCV;
                success      = result.Value != CellPassConsts.NullCCV;
                break;

            case DisplayMode.CCVPercent:
            case DisplayMode.CCVSummary:
            case DisplayMode.CCVPercentSummary:
                result.Value = 0; // default - no value...
                intValue     = arg.Overrides.OverrideMachineCCV ? arg.Overrides.OverridingMachineCCV : cell.TargetCCV;
                if (intValue != 0)
                {
                    success = cell.LastPassValidCCV != CellPassConsts.NullCCV && intValue != CellPassConsts.NullCCV;
                    if (success)
                    {
                        result.Value = ((double)cell.LastPassValidCCV / intValue) * 100;
                    }
                }
                break;

            case DisplayMode.PassCount:
                result.Value = cell.PassCount;
                success      = result.Value != CellPassConsts.NullPassCountValue;
                break;

            case DisplayMode.PassCountSummary:
                result.Value = 0; // default - no value...
                if (arg.Overrides.OverrideTargetPassCount)
                {
                    if (cell.PassCount > arg.Overrides.OverridingTargetPassCountRange.Max)
                    {
                        intValue = arg.Overrides.OverridingTargetPassCountRange.Max;
                    }
                    else if (cell.PassCount < arg.Overrides.OverridingTargetPassCountRange.Min)
                    {
                        intValue = arg.Overrides.OverridingTargetPassCountRange.Min;
                    }
                    else
                    {
                        intValue = cell.PassCount;
                    }
                }
                else
                {
                    intValue = cell.TargetPassCount;
                }
                if (intValue != 0)
                {
                    success = cell.PassCount != CellPassConsts.NullPassCountValue;
                    if (success)
                    {
                        result.Value = ((double)cell.PassCount / intValue) * 100;
                    }
                }
                break;

            case DisplayMode.CutFill:
                result.Value = cell.Height;
                if (cutFillDesign != null)
                {
                    var designSpotHeightResult = await cutFillDesign.Design.GetDesignSpotHeight(arg.ProjectID, cutFillDesign.Offset, arg.NEECoords.X, arg.NEECoords.Y);

                    if (designSpotHeightResult.errorCode == DesignProfilerRequestResult.OK && designSpotHeightResult.spotHeight != CellPassConsts.NullHeight)
                    {
                        result.Value = result.Value - designSpotHeightResult.spotHeight;
                        success      = true;
                    }
                }
                break;

            case DisplayMode.TemperatureSummary:
            case DisplayMode.TemperatureDetail:
                result.Value = cell.LastPassValidTemperature;
                success      = cell.LastPassValidTemperature != CellPassConsts.NullMaterialTemperatureValue;
                if (success)
                {
                    result.Value = cell.LastPassValidTemperature / 10.0; // temp is stored a int a 1 point precision
                }
                break;

            case DisplayMode.MDP:
                result.Value = cell.LastPassValidMDP;
                success      = result.Value != CellPassConsts.NullMDP;
                break;

            case DisplayMode.MDPSummary:
            case DisplayMode.MDPPercent:
            case DisplayMode.MDPPercentSummary:
                result.Value = 0; // default - no value...
                intValue     = arg.Overrides.OverrideMachineMDP ? arg.Overrides.OverridingMachineMDP : cell.TargetMDP;
                if (intValue != 0)
                {
                    success = cell.LastPassValidMDP != CellPassConsts.NullMDP && intValue != CellPassConsts.NullMDP;
                    if (success)
                    {
                        result.Value = ((double)cell.LastPassValidMDP / intValue) * 100;
                    }
                }
                break;

            case DisplayMode.MachineSpeed:
                result.Value = cell.MachineSpeed;
                success      = cell.MachineSpeed != Consts.NullMachineSpeed;
                break;

            case DisplayMode.CCVPercentChange:
            case DisplayMode.CMVChange:
                result.Value = cell.CCVChange;
                success      = cell.CCVChange != CellPassConsts.NullCCV;
                break;

            case DisplayMode.Latency:
            case DisplayMode.RMV:
            case DisplayMode.Frequency:
            case DisplayMode.Amplitude:
            case DisplayMode.Moisture:
            case DisplayMode.GPSMode:
            case DisplayMode.VolumeCoverage:
                break;
            }

            result.ReturnCode = success ? CellDatumReturnCode.ValueFound : CellDatumReturnCode.NoValueFound;
        }