示例#1
0
        public static void PopulateFilteredValues(IProductionEventLists values,
                                                  IFilteredValuePopulationControl PopulationControl,
                                                  ref FilteredPassData filteredPass)
        {
            // todo bool UseMachineRMVThreshold;
            // todo short OverrideRMVJumpThreshold;

            if (values == null)
            {
                Log.LogError($"MachineTargetValues supplied to PopulateFilteredValues is null. PopulationControl = {PopulationControl.GetFlags():X}");
                return;
            }

            DateTime _Time = filteredPass.FilteredPass.Time;

            if (PopulationControl.WantsTargetCCVValues)
            {
                filteredPass.TargetValues.TargetCCV = values.TargetCCVStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullCCV);
            }

            if (PopulationControl.WantsTargetMDPValues)
            {
                filteredPass.TargetValues.TargetMDP = values.TargetMDPStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullMDP);
            }

            if (PopulationControl.WantsTargetCCAValues)
            {
                filteredPass.TargetValues.TargetCCA = values.TargetCCAStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullCCATarget);
            }

            if (PopulationControl.WantsTargetPassCountValues)
            {
                filteredPass.TargetValues.TargetPassCount = values.TargetPassCountStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullPassCountValue);
            }

            if (PopulationControl.WantsTargetLiftThicknessValues)
            {
                filteredPass.TargetValues.TargetLiftThickness = values.TargetLiftThicknessStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullOverridingTargetLiftThicknessValue);
            }

            // Design Name...
            if (PopulationControl.WantsEventDesignNameValues)
            {
                filteredPass.EventValues.EventDesignNameID = values.MachineDesignNameIDStateEvents.GetValueAtDate(_Time, out _, Common.Consts.kNoDesignNameID);
            }

            // Vibration State...
            if (PopulationControl.WantsEventVibrationStateValues)
            {
                filteredPass.EventValues.EventVibrationState = values.VibrationStateEvents.GetValueAtDate(_Time, out _, VibrationState.Invalid);

                if (filteredPass.EventValues.EventVibrationState != VibrationState.On)
                {
                    filteredPass.FilteredPass.SetFieldsForVibeStateOff();
                }
            }

            // Auto Vibration State...
            if (PopulationControl.WantsEventAutoVibrationStateValues)
            {
                filteredPass.EventValues.EventAutoVibrationState =
                    values.AutoVibrationStateEvents.GetValueAtDate(_Time, out _, AutoVibrationState.Unknown);
            }

            // IC Flags...
            if (PopulationControl.WantsEventICFlagsValues)
            {
                filteredPass.EventValues.EventFlags = values.ICFlagsStateEvents.GetValueAtDate(_Time, out _, 0);
            }

            // Machine Gear...
            if (PopulationControl.WantsEventMachineGearValues)
            {
                filteredPass.EventValues.EventMachineGear = values.MachineGearStateEvents.GetValueAtDate(_Time, out _, MachineGear.Null);
            }

            // RMV Jump Threshold...
            if (PopulationControl.WantsEventMachineCompactionRMVJumpThreshold)
            {
                filteredPass.EventValues.EventMachineRMVThreshold = values.RMVJumpThresholdEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullRMV);

                // TODO: PopulationControl.WantsEventMachineCompactionRMVJumpThreshold does not honour global RMV override values

                /*
                 * if TICSiteModel(Owner).GetMachineRMVOverrideState(filteredPass.FilteredPass.InternalSiteModelMachineIndex,
                 * UseMachineRMVThreshold, OverrideRMVJumpThreshold))
                 * {
                 * if (UseMachineRMVThreshold)
                 *  filteredPass.EventValues.EventMachineRMVThreshold = values.RMVJumpThresholdEvents.GetValueAtDate(_Time, out _);
                 * else
                 *  filteredPass.EventValues.EventMachineRMVThreshold = OverrideRMVJumpThreshold;
                 * }
                 */
            }

            // Machine Automatic States...
            if (PopulationControl.WantsEventMachineAutomaticsValues)
            {
                filteredPass.EventValues.EventMachineAutomatics =
                    values.MachineAutomaticsStateEvents.GetValueAtDate(_Time, out _, AutomaticsType.Unknown);
            }

            if (PopulationControl.WantsEventMapResetValues)
            {
                throw new NotImplementedException("PopulationControl.WantsEventMapResetValues not implemented");

                /*
                 * filteredPass.EventValues.MapReset_DesignNameID = values.?????.GetValueAtDate(_Time, out int _);
                 * // LocateClosestPreviousMapResetAtDate(MachineTargetValues, _Time, MapReset_PriorDate, MapReset_DesignNameID);
                 */
            }

            if (PopulationControl.WantsEventElevationMappingModeValues)
            {
                filteredPass.EventValues.EventElevationMappingMode =
                    values.ElevationMappingModeStateEvents.GetValueAtDate(_Time, out _, ElevationMappingMode.LatestElevation);
            }

            if (PopulationControl.WantsEventInAvoidZoneStateValues)
            {
                throw new NotImplementedException("PopulationControl.WantsEventInAvoidZoneStateValues not implemented");
            }

            if (PopulationControl.WantsEventGPSAccuracyValues)
            {
                GPSAccuracyAndTolerance value = values.GPSAccuracyAndToleranceStateEvents.GetValueAtDate(_Time, out _, NullGPSAccuracyAndTolerance);

                filteredPass.EventValues.GPSAccuracy  = value.GPSAccuracy;
                filteredPass.EventValues.GPSTolerance = value.GPSTolerance;
            }

            if (PopulationControl.WantsEventPositioningTechValues)
            {
                filteredPass.EventValues.PositioningTechnology = values.PositioningTechStateEvents.GetValueAtDate(_Time, out _, PositioningTech.Unknown);
            }

            if (PopulationControl.WantsTempWarningLevelMinValues)
            {
                filteredPass.TargetValues.TempWarningLevelMin = values.TargetMinMaterialTemperature.GetValueAtDate(_Time, out _, CellPassConsts.NullMaterialTemperatureValue);
                filteredPass.TargetValues.TempWarningLevelMax = values.TargetMaxMaterialTemperature.GetValueAtDate(_Time, out _, CellPassConsts.NullMaterialTemperatureValue);
            }

            if (PopulationControl.WantsLayerIDValues)
            {
                filteredPass.EventValues.LayerID = values.LayerIDStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullLayerID);
            }
        }
示例#2
0
 public static bool Equals(GPSAccuracyAndTolerance x, GPSAccuracyAndTolerance y) => x.GPSAccuracy == y.GPSAccuracy && x.GPSTolerance == y.GPSTolerance;
示例#3
0
        public void Initialise(IFilteredValuePopulationControl populationControl)
        {
            TrackingUseMachineRMVThreshold   = false;
            TrackingOverrideRMVJumpThreshold = CellPassConsts.NullRMV;

            if (populationControl.WantsTargetCCVValues)
            {
                TargetCCV          = CellPassConsts.NullCCV;
                TargetCCV_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.TargetCCV);
            }

            if (populationControl.WantsTargetMDPValues)
            {
                TargetMDP          = CellPassConsts.NullMDP;
                TargetMDP_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.TargetMDP);
            }

            if (populationControl.WantsTargetCCAValues)
            {
                TargetCCA          = CellPassConsts.NullCCA;
                TargetCCA_Tracking = new SiteModelMachineTargetValueTrackingState <byte>(MachineTargetValues, ProductionEventType.TargetCCA);
            }

            if (populationControl.WantsTargetPassCountValues)
            {
                TargetPassCount          = 0; // kICNullPassCountValue;
                TargetPassCount_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TargetPassCount);
            }

            if (populationControl.WantsTargetLiftThicknessValues)
            {
                TargetLiftThickness          = CellPassConsts.NullHeight;
                TargetLiftThickness_Tracking = new SiteModelMachineTargetValueTrackingState <float>(MachineTargetValues, ProductionEventType.TargetLiftThickness);
            }

            /* TODO map reset events not included
             * if (populationControl.WantsEventMapResetValues)
             * {
             * EventMapResetPriorDate = 0;
             * EventMapResetDesignID = kNoDesignNameID;
             * EventMapReset_Tracking.Initialise();
             * }
             */

            if (populationControl.WantsEventDesignNameValues)
            {
                EventDesignNameID          = Consts.kNoDesignNameID;
                EventDesignNameID_Tracking = new SiteModelMachineTargetValueTrackingState <int>(MachineTargetValues, ProductionEventType.DesignChange);
            }

            if (populationControl.WantsEventVibrationStateValues)
            {
                EventVibrationState          = VibrationState.Invalid;
                EventVibrationState_Tracking = new SiteModelMachineTargetValueTrackingState <VibrationState>(MachineTargetValues, ProductionEventType.VibrationStateChange);
            }

            if (populationControl.WantsEventAutoVibrationStateValues)
            {
                EventAutoVibrationState          = AutoVibrationState.Unknown;
                EventAutoVibrationState_Tracking = new SiteModelMachineTargetValueTrackingState <AutoVibrationState>(MachineTargetValues, ProductionEventType.AutoVibrationStateChange);
            }

            if (populationControl.WantsEventElevationMappingModeValues)
            {
                ElevationMappingModeState          = ElevationMappingMode.LatestElevation;
                ElevationMappingModeState_Tracking = new SiteModelMachineTargetValueTrackingState <ElevationMappingMode>(MachineTargetValues, ProductionEventType.ElevationMappingModeStateChange);
            }

            if (populationControl.WantsEventICFlagsValues)
            {
                EventICFlag          = 0;
                EventICFlag_Tracking = new SiteModelMachineTargetValueTrackingState <byte>(MachineTargetValues, ProductionEventType.ICFlagsChange);
            }

            if (populationControl.WantsEventMachineGearValues)
            {
                EventMachineGear          = MachineGear.Null;
                EventMachineGear_Tracking = new SiteModelMachineTargetValueTrackingState <MachineGear>(MachineTargetValues, ProductionEventType.MachineGearChange);
            }

            if (populationControl.WantsEventMachineCompactionRMVJumpThreshold)
            {
                EventMachineRMVThreshold          = CellPassConsts.NullRMV;
                EventMachineRMVThreshold_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.MachineRMVJumpValueChange);
            }

            if (populationControl.WantsEventMachineAutomaticsValues)
            {
                EventMachineAutomatics          = AutomaticsType.Unknown;
                EventMachineAutomatics_Tracking = new SiteModelMachineTargetValueTrackingState <AutomaticsType>(MachineTargetValues, ProductionEventType.MachineAutomaticsChange);
            }

            if (populationControl.WantsEventGPSAccuracyValues)
            {
                GPSAccuracyAndTolerance   = new GPSAccuracyAndTolerance(GPSAccuracy.Unknown, CellPassConsts.NullGPSTolerance);
                GPSAccuracyState_Tracking = new SiteModelMachineTargetValueTrackingState <GPSAccuracyAndTolerance>(MachineTargetValues, ProductionEventType.GPSAccuracyChange);
            }

            if (populationControl.WantsEventPositioningTechValues)
            {
                PositioningTechState          = PositioningTech.Unknown;
                PositioningTechState_Tracking = new SiteModelMachineTargetValueTrackingState <PositioningTech>(MachineTargetValues, ProductionEventType.PositioningTech);
            }

            if (populationControl.WantsTempWarningLevelMinValues)
            {
                TempWarningLevelMin          = CellPassConsts.NullMaterialTemperatureValue;
                TempWarningLevelMin_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TempWarningLevelMinChange);
            }

            if (populationControl.WantsTempWarningLevelMaxValues)
            {
                TempWarningLevelMax          = CellPassConsts.NullMaterialTemperatureValue;
                TempWarningLevelMax_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TempWarningLevelMaxChange);
            }

            if (populationControl.WantsLayerIDValues)
            {
                EventLayerID          = CellPassConsts.NullLayerID;
                EventLayerID_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.LayerID);
            }
        }