Example #1
0
        public void AssembleMachineForBeginTrayDropoff(TransportOperationMachine machine)
        {
            var station     = machine.Station as IStation;
            var dockStation = machine.Station as ITransportDock;

            if (station != null && dockStation != null && IsStationDropoffReady(station))
            {
                // We can get an early start on handoff preparation if not dropping off to a stainer,
                // or if the transport is already above the stainer.
                var prepareForHandoffEarly = station.Type != StationType.Stainer ||
                                             IsTransportAboveDropoffHeight(dockStation)(machine.Transport);
                if (prepareForHandoffEarly)
                {
                    // Pause until the source station is ready to start hand-off prep.
                    machine.SetPauseUntilConditionOfStation("IsStationDropoffReady", IsStationDropoffReady);

                    // Prepare the source station for handoff.  Quit this machine if the PrepareForHandoff fails.
                    machine.SetActivityTrayHandlerPrepareForHandoff();
                }

                // Move the transport to the tray destination station for a tray drop-off. Quit if the move fails.
                machine.SetConditionalActivityTransportMoveToDropoffHeight(IsTransportParkedInElevator,
                                                                           machine.Configuration.Data.MoveCancellationToken);

                // Pause until the transport is above the destination station's drop-off location.
                // If it is already above, this will continue immediately.
                machine.SetPauseUntilConditionOfTransport("IsTransportAboveDropoffHeight", IsTransportAboveDropoffHeight(dockStation));

                // If we didn't already prepare for handoff before the Z move, do it now.
                if (!prepareForHandoffEarly)
                {
                    // Pause until the source station is ready to start hand-off prep.
                    machine.SetPauseUntilConditionOfStation("IsStationDropoffReady?", IsStationDropoffReady);

                    // Prepare the source station for handoff.  Quit this machine if the PrepareForHandoff fails.
                    machine.SetActivityTrayHandlerPrepareForHandoff();
                }

                // Pause until the destination station is handoff-prepared for drop-off.
                machine.SetPauseUntilConditionOfStation("IsStationHandoffPrepared?", IsStationHandoffPrepared);
                // Wait for transport to be stopped at location.
                machine.SetPauseUntilConditionOfTransport("IsTransportStoppedAtLocation?", IsTransportParkedAtDropoffHeight(dockStation));

                // Ensure destination station is safe to enter to drop-off tray
                machine.SetActivityTrayHandlerSafeToEnter();

                // Don't allow the machine to be stopped once the drop-off has started.
                machine.AddActivity(new DynamicActivity("Set CanStop=false", () => machine.CanStop = false));

                // Possibly finish before doing the drop-off if the operation was cancelled, regardless of tray aborted or not.
                // CompleteTrayDropoff operation will do recovery if we finish here.
                machine.SetFinishOrContinueForMoveStopped();

                // From this point on, TrayMover should stop movements if this machine encounters an error.
                machine.AddActivity(new DynamicActivity("Set machine HaltOnError", () => machine.HaltOnError = true));

                // Tell transport to put the tray. Quit if the move fails.
                // This will not act until transport is at the drop-off height.
                machine.SetActivityTransportPerformDropoff();

                // If dropping off to a stainer, make sure transport is clear of the stainer mount before allowing complete handoff.
                if (station.Type == StationType.Stainer)
                {
                    //TODO: ASK TEST/DEV TEAMS IF STAINER UPPER&LOWER LOADOFFSETS ARE EVER DIFFERENT THAN UPPER&LOWER OFFSETS.
                    //TODO: IF NOT, CAN ELIMINATE THIS AND REMOVE THE LOADOFFSETS FROM THE CONFIGURATION.
                    //TODO: IF STILL NEEDED, ELIMINATE SPECIAL CASE HERE BY MAKING STAINERS OVERRIDE UPPEROFFSET & LOWEROFFSET WHICH INCORPORATES ANY EXTRA OFFSET INTO THE ONE MOVE.
                    // Ensure the transport made it to below the stainer mount.  If it already is below the stainer, just move on.
                    machine.SetPauseUntilConditionOfTransport("IsTransportBelowPickupHeight?", IsTransportBelowPickupHeight(dockStation));
                }
            }
            else
            {
                throw new Exception("Begin tray drop-off failed to build: no destination station, or station is not ready.");
            }
        }
Example #2
0
        private void AssembleMachineForBeginTrayPickup(TransportOperationMachine machine)
        {
            // In this case, Station is the source of the tray.
            var station     = machine.Station as IStation;
            var dockStation = machine.Station as ITransportDock;

            if (station != null && dockStation != null)
            {
                // Wait for the source station to detect a tray, responding only to the IsTrayDetected trigger.
                // The source station should have the tray.  Slide id does not have a tray present sensor, so it should fake it.
                machine.AddQuitOrContinueCondition(
                    new DynamicConstraint <ITrayDetector>("Tray Not Detected At Source?", machine.Station, (td) => !td.IsTrayDetected),
                    new DynamicConstraint <ITrayDetector>("Tray Detected At Source?", machine.Station, (td) => td.IsTrayDetected));

                // We can get an early start on handoff preparation if not picking up from a stainer,
                // or if the transport is already below the stainer.
                var prepareForHandoffEarly = station.Type != StationType.Stainer ||
                                             IsTransportBelowPickupHeight(dockStation)(machine.Transport);
                if (prepareForHandoffEarly)
                {
                    // Pause until the source station is ready for hand-off preparation.
                    machine.SetPauseUntilConditionOfStation("IsStationPickupReady?", IsStationPickupReady);

                    // Prepare the source station for handoff.  Quit this machine if the PrepareForHandoff fails.
                    machine.SetActivityTrayHandlerPrepareForHandoff();
                }

                // Move the transport to the tray source station for a tray pick-up. Quit if the move fails.
                machine.SetConditionalActivityTransportMoveToPickupHeight(IsTransportParkedInElevator,
                                                                          machine.Configuration.Data.MoveCancellationToken);

                // Pause until the transport is below the source station's pick-up location.
                machine.SetPauseUntilConditionOfTransport("IsTransportBelowPickupHeight?", IsTransportBelowPickupHeight(dockStation));

                // If we didn't already prepare for handoff before the elevator move, do it now.
                if (!prepareForHandoffEarly)
                {
                    // Pause until the source station is ready.
                    machine.SetPauseUntilConditionOfStation("IsStationPickupReady?", IsStationPickupReady);

                    // Prepare the source station for handoff.  Quit this machine if the PrepareForHandoff fails.
                    machine.SetActivityTrayHandlerPrepareForHandoff();
                }

                // Pause until source station is handoff-prepared for pickup.
                machine.SetPauseUntilConditionOfStation("IsStationHandoffPrepared?", IsStationHandoffPrepared);
                // Wait for transport to be stopped at the pick-up height.
                machine.SetPauseUntilConditionOfTransport("IsTransportStoppedAtLocation?", IsTransportParkedAtPickupHeight(dockStation));

                // Ensure source station is safe to enter to pick-up tray
                machine.SetActivityTrayHandlerSafeToEnter();

                // From this point on, TrayMover should stop movements if this machine encounters an error.
                machine.AddActivity(new DynamicActivity("Set machine HaltOnError", () => machine.HaltOnError = true));

                // Tell transport to get the tray. Quit if the move fails.
                machine.SetActivityTransportPerformPickup();

                // If picking up from a stainer, make sure transport is clear of stainer mount before allowing complete handoff.
                if (station.Type == StationType.Stainer)
                {
                    //TODO: ASK TEST/DEV TEAMS IF STAINER UPPER&LOWER LOADOFFSETS ARE EVER DIFFERENT THAN UPPER&LOWER OFFSETS.
                    //TODO: IF NOT, CAN ELIMINATE THIS AND REMOVE THE LOADOFFSETS FROM THE CONFIGURATION.
                    //TODO: IF STILL NEEDED, ELIMINATE SPECIAL CASE HERE BY MAKING STAINERS OVERRIDE UPPEROFFSET & LOWEROFFSET WHICH INCORPORATES ANY EXTRA OFFSET INTO THE ONE MOVE.
                    // Ensure the transport made it to the desired Z position.
                    machine.SetPauseUntilConditionOfTransport("IsTransportAboveDropoffHeight?", IsTransportAboveDropoffHeight(dockStation));
                }
            }
            else
            {
                throw new Exception("Begin tray pick-up failed to build: no source station.");
            }
        }