Ejemplo n.º 1
0
        private void InfeedDoubleArrived()
        {
            if (LocationA.Active && LocationB.Active)
            {
                Elevator.ParentMultiShuttle.ArrivedAtElevatorConvPosA(new ArrivedOnElevatorEventArgs(Elevator.CurrentTask, (Case_Load)LocationA.ActiveLoad, (Case_Load)LocationB.ActiveLoad, Elevator, LocationA.LocName));

                StraightConveyor sC = Elevator.CurrentTask.GetSourceConvOfLoad((Case_Load)LocationA.ActiveLoad, false);
                if (sC != null)
                {
                    sC.RouteAvailable = RouteStatuses.Request;
                }
                else
                {
                    Log.Write("Error in ElevatorConveyor.InfeedDoubleArrived() Can't find Source location of load", Color.Red);
                }

                StraightConveyor dC = Elevator.CurrentTask.GetDestConvOfLoad((Case_Load)LocationB.ActiveLoad);
                if (dC != null)
                {
                    Elevator.MoveElevator(Elevator.CurrentTask.GetDestConvOfLoad((Case_Load)LocationB.ActiveLoad));
                }
                else
                {
                    Log.Write("Error in ElevatorConveyor.InfeedDoubleArrived() Can't find Dest location of load", Color.Red);
                }
            }
        }
Ejemplo n.º 2
0
        private void CreateTuTelegramReceived(string[] telegramFields)
        {
            if (telegramFields.GetFieldValue(TelegramFields.location) == null)
            {
                return; //Telegram ignored
            }

            if (Core.Assemblies.Assembly.Items.ContainsKey(telegramFields.GetFieldValue(TelegramFields.location)) &&
                Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.location)] is StraightConveyor)
            {
                ATCTray caseTray = CreateCaseTray(TelegramTypes.CreateTuTelegram, telegramFields);

                StraightConveyor sourceConv = Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.location)] as StraightConveyor;
                caseTray.SetYaw(sourceConv.Width, sourceConv.CaseOrientation);
                float position = 0;
                if (caseTray.Yaw == 0)
                {
                    position = position + (caseTray.Length / 2);
                }
                else
                {
                    position = position + (caseTray.Width / 2);
                }
                sourceConv.TransportSection.Route.Add(caseTray, position);
            }
            else
            {
                Log.Write(string.Format("ATC Error {0}: Cannot create load at location from CreateTuTelegram, location {1} does not exist, message ignored", Name, telegramFields.GetFieldValue(TelegramFields.location)), Color.Red);
            }
        }
Ejemplo n.º 3
0
        void LocationB_OnEnter(ActionPoint sender, Load load)
        {
            if (Elevator.CurrentTask.Flow == TaskType.Infeed)
            {
                if (Elevator.CurrentTask.NumberOfLoadsInTask == 1)
                {
                    Elevator.ParentMultiShuttle.ArrivedAtElevatorConvPosB(new ArrivedOnElevatorEventArgs(Elevator.CurrentTask, null, (Case_Load)load, Elevator, LocationB.LocName));
                    load.Stop();

                    StraightConveyor sC = Elevator.CurrentTask.GetSourceConvOfLoad((Case_Load)LocationB.ActiveLoad, false);
                    if (sC != null)
                    {
                        sC.RouteAvailable = RouteStatuses.Request;
                    }
                    else
                    {
                        Log.Write("Error in ElevatorConveyor.LocationB_OnEnter() can't find Source Conv", Color.Red);
                        return;
                    }

                    Elevator.MoveElevator(Elevator.CurrentTask.GetDestConvOfLoad((Case_Load)load));
                }
                else if (Elevator.CurrentTask.NumberOfLoadsInTask == 2)
                {
                    load.Stop();

                    if (UnLoading)
                    {
                        Elevator.MoveElevator(Elevator.CurrentTask.GetDestConvOfLoad((Case_Load)load));
                    }
                    else
                    {
                        InfeedDoubleArrived();
                    }
                }
            }
            else if (Elevator.CurrentTask.Flow == TaskType.Outfeed)
            {
                //picking up 2 loads from different levels and this is the first load
                if (Elevator.CurrentTask.LoadCycle == Cycle.Single && Elevator.CurrentTask.NumberOfLoadsInTask == 2 && TransportSection.Route.Loads.Count == 1)
                {
                    load.Stop();
                    Elevator.ParentMultiShuttle.ArrivedAtElevatorConvPosB(new ArrivedOnElevatorEventArgs(Elevator.CurrentTask, null, (Case_Load)load, Elevator, LocationB.LocName));
                }
                else if (Elevator.CurrentTask.LoadCycle == Cycle.Single || (Elevator.CurrentTask.NumberOfLoadsInTask == 2 && TransportSection.Route.Loads.Count == 2))
                {
                    load.Stop();  // stop if single or the first load of a double
                    Elevator.ParentMultiShuttle.ArrivedAtElevatorConvPosB(new ArrivedOnElevatorEventArgs(Elevator.CurrentTask, null, (Case_Load)load, Elevator, LocationB.LocName));
                }

                if (UnLoading) // last load of a double outfeed that is offloading to 2 different drop points
                {
                    load.Stop();
                    Elevator.MoveElevator(); // The load at B is the first drop off
                }
            }
        }
Ejemplo n.º 4
0
        int PickRouteCount()
        {
            StraightConveyor pickStation = pickConveyor.PreviousConveyor as StraightConveyor;

            if (pickStation != null)
            {
                return(pickConveyor.TransportSection.Route.Loads.Count + pickStation.TransportSection.Route.Loads.Count);
            }
            else
            {
                return(pickConveyor.TransportSection.Route.Loads.Count);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Use to combine 2 tasks that are on the same level into 1 task and remove the second task
        /// </summary>
        /// <param name="elevator"></param>
        /// <param name="newTask"></param>
        public void CombineTasks(Elevator elevator, ElevatorTask newTask)
        {
            lock (locker)
            {
                LoadA_ID             = newTask.LoadB_ID;
                SourceLoadA          = newTask.SourceLoadB;
                DestinationLoadA     = newTask.DestinationLoadB;
                SourceLoadAConv      = newTask.SourceLoadBConv;
                DestinationLoadAConv = newTask.DestinationLoadBConv;
                DropIndexLoadA       = newTask.DropIndexLoadB;
                numberOfLoadsInTask  = 2;
                UnloadCycle          = Cycle.Double;

                if (DestinationLoadAConv != DestinationLoadBConv)
                {
                    elevator.CurrentTask.UnloadCycle = Cycle.Single;
                }

                elevator.ElevatorTasks.Remove(newTask);
            }
        }
Ejemplo n.º 6
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            List <string> photocells = new List <string>();

            try
            {
                if (context.Instance is CurveBeltConveyor)
                {
                    CurveBeltConveyor conveyor = context.Instance as CurveBeltConveyor;
                    foreach (Assembly assembly in conveyor.Assemblies)
                    {
                        if (assembly is CasePhotocell)
                        {
                            photocells.Add(assembly.Name);
                        }
                    }
                }
                else if (context.Instance is StraightConveyor)
                {
                    StraightConveyor conveyor = context.Instance as StraightConveyor;
                    foreach (Assembly assembly in conveyor.Assemblies)
                    {
                        if (assembly is CasePhotocell)
                        {
                            photocells.Add(assembly.Name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Environment.Log.Write("PhotocellConverter combodropdown error", Color.Red);
                Core.Environment.Log.Write(ex.Message, Color.Red);
            }


            return(new StandardValuesCollection(photocells));
        }
Ejemplo n.º 7
0
        private void FeedTelegramRecieved(string[] telegramFields, string subtype)
        {
            if (subtype == "F001" || subtype == "F004")  //F001 Tote (Stock Tote), F004 Pick Tote
            {
                //Feed tote to system
                string location    = telegramFields[1];
                string totebarcode = telegramFields[2];
                //string quantity = telegramFields[3];
                string length = telegramFields[3];
                string width  = telegramFields[4];
                string height = telegramFields[5];
                string weight = telegramFields[6];

                if (Experior.Core.Assemblies.Assembly.Items.ContainsKey(location))
                {
                    StraightConveyor conv = Experior.Core.Assemblies.Assembly.Items[location] as StraightConveyor;

                    if (conv.PLC != null)
                    {
                        float l = float.Parse(length) / 1000f; //mm
                        float h = float.Parse(height) / 1000f; //mm
                        float w = float.Parse(width) / 1000f;  //mm

                        Case_Load caseload = conv.PLC.CreateCaseLoad(l, w, h);
                        caseload.SSCCBarcode = totebarcode;

                        if (subtype == "F001")
                        {
                            caseload.Color    = Color.Blue;
                            caseload.UserData = "TOTE";
                        }
                        else //F004
                        {
                            caseload.Color    = Color.LightBlue;
                            caseload.UserData = "PICKTOTE";
                        }

                        //Turn totes to correct orientation when added to conveyors
                        if (conv.Width > 0.5)
                        {
                            caseload.Yaw = (float)(Math.PI / 2f);
                        }

                        float weightfloat = float.Parse(weight);
                        weightfloat /= 1000f; // to get kg
                        caseload.Case_Data.Weight = weightfloat;
                        conv.TransportSection.Route.Add(caseload);
                    }
                    else
                    {
                        Core.Environment.Log.Write("Location not configured with plc for feed telegram location: " + location);
                        Core.Environment.Scene.Pause();
                    }
                }
                else
                {
                    Core.Environment.Log.Write("Location not found for feed telegram: " + location);
                    //Core.Environment.Scene.Pause();
                }
            }
            else if (subtype == "F002") //CARTON
            {
                //Feed carton to system.
                string location         = telegramFields[1];
                string cartonIdentifier = telegramFields[2];
                string length           = telegramFields[3];
                string width            = telegramFields[4];
                string height           = telegramFields[5];
                string weight           = telegramFields[6];

                StraightConveyor conv = Core.Assemblies.Assembly.Items[location] as StraightConveyor;

                if (conv == null)
                {
                    Core.Environment.Log.Write("FEED error, location: " + location + " not found");
                    Core.Environment.Scene.Pause();
                    return;
                }
                if (conv.PLC != null)
                {
                    float l = float.Parse(length) / 1000f; //mm
                    float h = float.Parse(height) / 1000f; //mm
                    float w = float.Parse(width) / 1000f;  //mm

                    Case_Load caseload = conv.PLC.CreateCaseLoad(l, w, h);
                    caseload.SSCCBarcode = cartonIdentifier;
                    caseload.UserData    = "CARTON";
                    caseload.Color       = Color.Peru;

                    //Turn totes to correct orientation when added to conveyors
                    if (conv.Width > 0.5)
                    {
                        caseload.Yaw = (float)(Math.PI / 2f);
                    }

                    float weightfloat = float.Parse(weight);
                    weightfloat /= 1000f; // to get kg
                    caseload.Case_Data.Weight = weightfloat;

                    conv.TransportSection.Route.Add(caseload);
                }
                else
                {
                    Core.Environment.Log.Write("Location not configured with plc for feed telegram location: " + location);
                    //Core.Environment.Scene.Pause();
                }
            }
        }
Ejemplo n.º 8
0
        //Load loadASpecial = null;
        // Load loadBSpecial = null;

        public void ElevatorOnArrived()
        {
            if (CurrentTask == null)
            {
                Log.Write("Elevator arrived with a null current task");
                return;
            }

            ElevatorConveyor.Route.NextRoute = null;
            ElevatorConveyor.Route.LastRoute = null;

            if (OnElevatorArrived != null)
            {
                OnElevatorArrived(this, new EventArgs());
            }

            if (CurrentTask.Flow == TaskType.Infeed)
            {
                if (ElevatorConveyor.Route.Loads.Count == 0) //Arrived at the pickstation so release whatever is waiting for the elevator to arrive
                {
                    Load loadASpecial = null, loadBSpecial = null;

                    var A = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadA);
                    if (A != null)
                    {
                        loadASpecial = A.ActiveLoad;
                    }

                    var B = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB);
                    if (B != null)
                    {
                        loadBSpecial = B.ActiveLoad;
                    }

                    if (loadASpecial != null)
                    {
                        loadASpecial.Release();
                    }

                    if (loadBSpecial != null)
                    {
                        loadBSpecial.Release();
                    }
                }
                else if (CurrentTask.UnloadCycle == Cycle.Single)
                {
                    ElevatorConveyor.LocationB.Release();
                }
                else if (CurrentTask.LoadCycle == Cycle.Double)
                {
                    //if (CurrentTask.UnloadCycle == Cycle.Double && currentElevatorConvLevel.TransportSection.Route.Loads.Count > 0)
                    //{
                    //    Log.Write("MS Error: Cannot drop two loads to infeed rack conveyor");
                    //    Core.Environment.Scene.Pause();
                    //    return;
                    //}

                    //Arrived at a double dropoff infeed rack conveyor so release both elevator loc
                    ElevatorConveyor.LocationB.Release();
                    ElevatorConveyor.LocationA.Release();
                    //ReleaseLocationAFFS(ElevatorConveyor.LocationA.ActiveLoad, "Elevator 328");
                    ElevatorConveyor.LocationB.Enabled = false;
                }
            }
            else if (CurrentTask.Flow == TaskType.Outfeed)
            {
                if (ElevatorConveyor.UnLoading) //outfeed and unloading so have arrived at a DS
                {
                    StraightConveyor conv = CurrentTask.GetDestConvOfLoad((Case_Load)ElevatorConveyor.LocationB.ActiveLoad);

                    if (conv.ThisRouteStatus.Available != RouteStatuses.Available)
                    {
                        conv.ThisRouteStatus.OnRouteStatusChanged += ThisRouteStatus_OnRouteStatusChanged;
                        //Core.Environment.Log.Write("MS Error: Cannot drop load to Drop Station conveyor");
                        //Core.Environment.Scene.Pause();
                        return;
                    }

                    ElevatorConveyor.LocationB.Release();
                    ElevatorConveyor.LocationA.Release();
                    //ReleaseLocationAFFS(ElevatorConveyor.LocationA.ActiveLoad, "Elevator 346");

                    if (CurrentTask.UnloadCycle == Cycle.Double || CurrentTask.NumberOfLoadsInTask == 1)
                    {
                        ElevatorConveyor.LocationB.Enabled = false; // if only 1 load in task don't care about this but doesn't do any harm
                        ElevatorConveyor.UnLoading         = false;
                    }
                }
                else if (!ElevatorConveyor.UnLoading) // still loading the elevator
                {
                    if (CurrentTask.LoadCycle == Cycle.Single && CurrentTask.NumberOfLoadsInTask == 2)
                    {
                    }

                    ((RackConveyor)currentElevatorConvLevel).LocationB.Release();

                    //var locB = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB);
                    //locB.Release();

                    //((RackConveyor)currentElevatorConvLevel).LocationB.Release(); //Release B regardless

                    if (CurrentTask.LoadCycle == Cycle.Double) // If its a double also release A as well
                    {
                        ((RackConveyor)currentElevatorConvLevel).LocationA.Release();

                        //var locA = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadA);
                        //locA.Release(); //BOOM
                        //ReleaseLocationAFFS(locA.ActiveLoad, "Elevator 366");
                        //((RackConveyor)currentElevatorConvLevel).LocationA.Release();
                    }
                }

                //if (ElevatorConveyor.Route.Loads.Count == 0)
                //{
                //    if (CurrentTask.LoadCycle == Cycle.Single)
                //    {

                //        var v = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB);
                //        ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB).Release();
                //    }
                //    else if (CurrentTask.LoadCycle == Cycle.Double)
                //    {
                //        ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadA).Release();
                //        ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB).Release();
                //    }
                //}
                //else
                //{

                //    if (CurrentTask.LoadCycle == Cycle.Single && CurrentTask.NumberOfLoadsInTask() == 2 && ElevatorConveyor.TransportSection.Route.Loads.Count == 1)
                //    {
                //        //loading 2 loads from different levels. Just arrived at the 2nd loads rack conveyor
                //        ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadA).Release();
                //    }
                //    //else if (CurrentTask.UnloadCycle == Cycle.Single && ElevatorConveyor.TransportSection.Route.Loads.Count == 1)
                //    //{
                //    //    ElevatorConveyor.LocationB.Release();
                //    //}
                //    else if ((CurrentTask.UnloadCycle == Cycle.Single && ElevatorConveyor.TransportSection.Route.Loads.Count == 1) || (CurrentTask.UnloadCycle == Cycle.Double && ElevatorConveyor.TransportSection.Route.Loads.Count == 2))
                //    {
                //        //Under these conditions the elevator must have arrived at the drop station
                //        if (CurrentTask.DestinationLoadBConv.NextRouteStatus.Available != RouteStatuses.Available)
                //        {
                //            Core.Environment.Log.Write("MS Error: Cannot drop load to Drop Station conveyor");
                //            Core.Environment.Scene.Pause();
                //            return;
                //        }

                //        ElevatorConveyor.LocationB.Release();
                //        ElevatorConveyor.LocationA.Release();
                //        ElevatorConveyor.LocationB.Enabled = false;
                //    }
                //    else if (CurrentTask.UnloadCycle == Cycle.Single && CurrentTask.NumberOfLoadsInTask() == 2 && ElevatorConveyor.TransportSection.Route.Loads.Count == 2)
                //    {
                //        ElevatorConveyor.LocationA.Release();
                //        ElevatorConveyor.LocationB.Release();
                //    }
                //    else if (CurrentTask.UnloadCycle == Cycle.Single)
                //    {
                //        ElevatorConveyor.LocationA.Release();
                //    }
                //}
            }

            //if (ElevatorConveyor.Route.Loads.Count > 0 && ElevatorType == MultiShuttleDirections.Infeed)//This is wrong must not use elevator type as it does not exist
            //{
            //    if (CurrentTask.UnloadCycle == Cycle.Single && unloadConveyor.TransportSection.Route.Loads.Count > 1)
            //    {
            //        Core.Environment.Log.Write("MS Error: Cannot drop load to infeed rack conveyor");
            //        Core.Environment.Scene.Pause();
            //        return;
            //    }
            //    ElevatorConveyor.LocationB.Release();
            //}
        }
Ejemplo n.º 9
0
        internal void MoveElevator(StraightConveyor conv = null)
        {
            if (CurrentTask.TasksLoadsArrivedOnElevator == CurrentTask.NumberOfLoadsInTask)
            {
                ElevatorConveyor.UnLoading = true;
            }
            else if (CurrentTask.TasksLoadsArrivedOnElevator < CurrentTask.NumberOfLoadsInTask)
            {
                ElevatorConveyor.UnLoading = false;
            }

            //A different points the locations might be disabled to make controlling loads so make sure that they are enabled before moving
            ElevatorConveyor.LocationA.Enabled = true;
            ElevatorConveyor.LocationB.Enabled = true;

            //var psConv = ParentMultiShuttle.PickStationConveyors[0];  //TODO infeed only single PS only

            if (conv != null) //supplied with a destination
            {
                currentElevatorConvLevel = conv;
            }
            else if (ElevatorConveyor.TransportSection.Route.Loads.Count == 0) //get the first load to pickup, don't care if outfeed or infeed
            {
                currentElevatorConvLevel = CurrentTask.SourceLoadBConv ?? CurrentTask.SourceLoadAConv;
            }
            else if (CurrentTask.Flow == TaskType.Outfeed) // an outfeed so there must be a load at LocationB, the load at B is the first drop off
            {
                if (CurrentTask.NumberOfLoadsInTask == 2)
                {
                    if (ElevatorConveyor.Route.Loads.Count == 1 && !ElevatorConveyor.UnLoading)                                                 //Have already got 1 load on board get the second pickup conveyor
                    {
                        currentElevatorConvLevel = CurrentTask.GetSourceConvOfLoad((Case_Load)ElevatorConveyor.Route.Loads.ElementAt(0), true); // regardless of what load is on board get the dest of the load not picked up
                    }
                    else //2 loads going to 1 or 2 dropstations..currently always choose location probably will not work with drivethrought or where the DS is not infront of the MS
                    {
                        currentElevatorConvLevel = CurrentTask.GetDestConvOfLoad((Case_Load)ElevatorConveyor.LocationB.ActiveLoad);
                    }
                }
                else if (CurrentTask.NumberOfLoadsInTask == 1)
                {
                    currentElevatorConvLevel = CurrentTask.GetDestConvOfLoad((Case_Load)ElevatorConveyor.LocationB.ActiveLoad);
                }
            }
            else if (CurrentTask.Flow == TaskType.Infeed)// && psConv.Route.Loads.Count == 0)
            {
                var ps = ParentMultiShuttle.PickStationConveyors.Find(x => x.RouteAvailable == RouteStatuses.Blocked && x.TransportSection.Route.Loads.Count == 0);
                if (ps != null)
                {
                    ps.RouteAvailable = RouteStatuses.Request;
                }
                //psConv.RouteAvailable = RouteStatuses.Request; // A new infeed job has just been loaded on the elevator so make the pickstation avaiable
            }

            if (currentElevatorConvLevel == null)
            {
                Log.Write("Error in Elevator.MoveElevator(), can't find currentElevatorConvLevel", Color.Red);
                return;
            }

            //Account for the offset height of the elevator
            float ElevatorHeight = ParentMultiShuttle.Position.Y;
            float ConveyorHeight = currentElevatorConvLevel.Height;
            float MovePosition   = ConveyorHeight - ElevatorHeight;

            if (lift.Destination.Distance == MovePosition)
            {
                lift.Destination.Distance = MovePosition;
                ElevatorOnArrived();
                return;
            }

            if (lift.Destination.Distance > MovePosition) //currentElevatorConvLevel.Height)
            {
                lift.Route.Motor.Backward();
            }
            else if (lift.Destination.Distance < MovePosition) //currentElevatorConvLevel.Height)
            {
                lift.Route.Motor.Forward();
            }

            lift.Destination.Distance = MovePosition; //currentElevatorConvLevel.Height;
            lift.Route.Motor.Start();
            lift.ShuttleCar.Release();
        }
Ejemplo n.º 10
0
        internal void MoveElevator(StraightConveyor conv = null)
        {
            if (CurrentTask.TasksLoadsArrivedOnElevator == CurrentTask.NumberOfLoadsInTask)
            {
                ElevatorConveyor.UnLoading = true;
            }
            else if (CurrentTask.TasksLoadsArrivedOnElevator < CurrentTask.NumberOfLoadsInTask)
            {
                ElevatorConveyor.UnLoading = false;
            }

            //A different points the locations might be disabled to make controlling loads so make sure that they are enabled before moving
            ElevatorConveyor.LocationA.Enabled = true;
            ElevatorConveyor.LocationB.Enabled = true;

            //var psConv = ParentMultiShuttle.PickStationConveyors[0];  //TODO infeed only single PS only

            if (conv != null) //supplied with a destination
            {
                moveToConvLevel = conv;
            }
            else if (ElevatorConveyor.TransportSection.Route.Loads.Count == 0) //get the first load to pickup, don't care if outfeed or infeed
            {
                ElevatorConveyor.Route.Motor.Forward();                        // At the start of move when the elevator is empty set the conveyor in the forward direction
                moveToConvLevel = CurrentTask.SourceLoadBConv ?? CurrentTask.SourceLoadAConv;
            }
            else if (CurrentTask.Flow == TaskType.Outfeed) // an outfeed so there must be a load at LocationB, the load at B is the first drop off
            {
                if (CurrentTask.NumberOfLoadsInTask == 2)
                {
                    if (ElevatorConveyor.Route.Loads.Count == 1 && !ElevatorConveyor.UnLoading)                                        //Have already got 1 load on board get the second pickup conveyor
                    {
                        moveToConvLevel = CurrentTask.GetSourceConvOfLoad((Case_Load)ElevatorConveyor.Route.Loads.ElementAt(0), true); // regardless of what load is on board get the dest of the load not picked up
                    }
                    else if (ElevatorConveyor.Route.Loads.Count == 1 && ElevatorConveyor.UnLoading)                                    //Unloading second load
                    {
                        moveToConvLevel = CurrentTask.GetDestConvOfLoad((Case_Load)ElevatorConveyor.Route.Loads.ElementAt(0));
                    }
                    else //2 loads going to 1 or 2 dropstations..currently always choose location probably will not work with drivethrought or where the DS is not infront of the MS as it may not be the destination of the B load that is needed
                    {
                        moveToConvLevel = CurrentTask.DestinationLoadBConv;
                    }
                }
                else if (CurrentTask.NumberOfLoadsInTask == 1)
                {
                    moveToConvLevel = CurrentTask.GetDestConvOfLoad((Case_Load)ElevatorConveyor.LocationB.ActiveLoad);
                }
            }
            else if (CurrentTask.Flow == TaskType.Infeed)// && psConv.Route.Loads.Count == 0)
            {
                var ps = ParentMultiShuttle.PickStationConveyors.Find(x => x.RouteAvailable == RouteStatuses.Blocked && x.TransportSection.Route.Loads.Count == 0);
                if (ps != null)
                {
                    ps.RouteAvailable = RouteStatuses.Request;
                }
            }

            if (moveToConvLevel == null)
            {
                Log.Write(string.Format("{0}: Error in Elevator.MoveElevator(), can't find currentElevatorConvLevel", ParentMultiShuttle.Name), Color.Red);
                if (conv != null)
                {
                    Log.Write(string.Format("{0}: Conveyor {1}", ParentMultiShuttle.Name, conv.Name), Color.Red);
                }
                Log.Write(Environment.StackTrace, Color.Red);
                return;
            }

            //Account for the offset height of the elevator
            float ElevatorHeight = ParentMultiShuttle.Position.Y;
            float ConveyorHeight = moveToConvLevel.Height;
            float MovePosition   = ConveyorHeight - ElevatorHeight;

            float check = Math.Abs(Vehicle.DestAP.Distance - MovePosition);

            if (Math.Abs(Vehicle.DestAP.Distance - MovePosition) < 0.001)
            {
                //MRP 11-10-2018. Maybe it is better to invoke the arrived event. (Maybe some other code needs to be done first)
                Vehicle.DestAP.Distance = MovePosition;
                Core.Environment.Invoke(() => ElevatorOnArrived(null, null));
                return;
            }

            if (Vehicle.DestAP.Distance > MovePosition)
            {
                Lift.Route.Motor.Backward();
            }
            else if (Vehicle.DestAP.Distance < MovePosition)
            {
                Lift.Route.Motor.Forward();
            }

            Vehicle.DestAP.Distance = MovePosition;
            Lift.Route.Motor.Start();
            Vehicle.Release();
        }
Ejemplo n.º 11
0
        private void StartTransportTelegramReceived(string[] telegramFields)
        {
            //Look for the load somewhere in the model, if the load is found then change it's status, if not create it at the source location
            //ATCCaseLoad caseLoad = (ATCCaseLoad)Case_Load.GetCaseFromIdentification(telegramFields.GetFieldValue(TelegramFields.tuIdent));
            IATCCaseLoadType caseLoad = (IATCCaseLoadType)Case_Load.GetCaseFromIdentification(telegramFields.GetFieldValue(TelegramFields.tuIdent));


            if (caseLoad != null) //The load has been found so some attributes need to be changed (Cannot change the dimensions of the load however)
            {
                caseLoad.TUType          = telegramFields.GetFieldValue(TelegramFields.tuType);
                caseLoad.Source          = telegramFields.GetFieldValue(TelegramFields.source);
                caseLoad.Destination     = telegramFields.GetFieldValue(TelegramFields.destination);
                caseLoad.PresetStateCode = telegramFields.GetFieldValue(TelegramFields.presetStateCode);
                caseLoad.Color           = LoadColor(telegramFields.GetFieldValue(TelegramFields.color));

                float weight;
                float.TryParse(telegramFields.GetFieldValue(TelegramFields.weight), out weight);
                caseLoad.CaseWeight = weight / 1000;

                //Deal with additional project specific fields
                foreach (string field in ProjectFields)
                {
                    string fieldValue = telegramFields.GetFieldValue(field);
                    if (fieldValue != null)
                    {
                        if (caseLoad.ProjectFields.ContainsKey(field))
                        {
                            caseLoad.ProjectFields[field] = fieldValue;
                        }
                        else
                        {
                            caseLoad.ProjectFields.Add(field, fieldValue);
                        }
                    }
                }

                //The load may be at a request location and the load will need to be released
                if (caseLoad.LoadWaitingForWCS && caseLoad.Stopped)
                {
                    //Load may be waiting on a transfer so call the mergeDivert
                    if (caseLoad.Route.Parent.Parent is MergeDivertConveyor)
                    {
                        MergeDivertConveyor mergeDivert = caseLoad.Route.Parent.Parent as MergeDivertConveyor;
                        //if (mergeDivert.divertArrival != null)
                        //{
                        //    mergeDivert.divertArrival(caseLoad);
                        //}
                        mergeDivert.ControlDivertPoint((Load)caseLoad);
                    }

                    caseLoad.LoadWaitingForWCS = false;
                    caseLoad.ReleaseLoad();
                }
            }
            else //The load has not been found but should one be created? Normally created through the Emulation Control Telegrams
            {
                if (Core.Assemblies.Assembly.Items.ContainsKey(telegramFields.GetFieldValue(TelegramFields.source)) &&
                    Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.source)] is StraightConveyor)
                {
                    caseLoad = CreateCaseLoad(TelegramTypes.StartTransportTelegram, telegramFields);
                    StraightConveyor sourceConv = Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.source)] as StraightConveyor;
                    caseLoad.SetYaw(sourceConv.Width, sourceConv.CaseOrientation);
                    float position = 0;
                    if (caseLoad.Yaw == 0)
                    {
                        position = position + (caseLoad.Length / 2);
                    }
                    else
                    {
                        position = position + (caseLoad.Width / 2);
                    }
                    sourceConv.TransportSection.Route.Add((Load)caseLoad, position);
                }
                else
                {
                    Log.Write(string.Format("ATC Error {0}: Cannot create load at location from StartTransportTelegram, location {1} does not exist, message ignored", Name, telegramFields.GetFieldValue(TelegramFields.source)), Color.Red);
                }
            }
        }
Ejemplo n.º 12
0
        public Miniload(MiniloadInfo info)
            : base(info)
        {
            MiniloadInfo = info;

            Lift.Height = 0.05f;
            Lift.Color  = Color.DarkBlue;

            StraightConveyorInfo pickConveyorInfo = new StraightConveyorInfo()
            {
                Length    = 1.61f,
                thickness = 0.05f,
                Width     = 0.5f,
                Speed     = 0.7f
            };

            pickConveyor = new StraightConveyor(pickConveyorInfo);
            pickConveyor.endLine.Visible          = false;
            pickConveyor.startLine.Visible        = false;
            pickConveyor.Color                    = Color.Gray;
            pickConveyor.arrow.Visible            = false;
            pickConveyor.TransportSection.Visible = false;
            pickConveyor.RouteAvailable           = RouteStatuses.Blocked;
            pickConveyor.EndFixPoint.Visible      = false;
            pickConveyor.EndFixPoint.Enabled      = false;

            Add(pickConveyor);
            pickConveyor.TransportSection.Route.InsertActionPoint(pos2Pick);
            pickConveyor.TransportSection.Route.InsertActionPoint(pos1Pick);
            pos2Pick.OnEnter += pos1pd_OnEnter;
            pos1Pick.OnEnter += pos2pd_OnEnter;

            StraightConveyorInfo dropConveyorInfo = new StraightConveyorInfo()
            {
                Length    = 1.61f,
                thickness = 0.05f,
                Width     = 0.5f,
                Speed     = 0.7f
            };

            dropConveyor = new StraightConveyor(dropConveyorInfo);
            dropConveyor.endLine.Visible          = false;
            dropConveyor.startLine.Visible        = false;
            dropConveyor.Color                    = Color.Gray;
            dropConveyor.arrow.Visible            = false;
            dropConveyor.TransportSection.Visible = false;
            dropConveyor.RouteAvailable           = RouteStatuses.Blocked;
            dropConveyor.StartFixPoint.Visible    = false;
            dropConveyor.StartFixPoint.Enabled    = false;

            Add(dropConveyor);
            dropConveyor.TransportSection.Route.InsertActionPoint(pos2Drop);
            dropConveyor.TransportSection.Route.InsertActionPoint(pos1Drop);

            dropConveyor.OnNextRouteStatusAvailableChanged += dropConveyor_OnNextRouteStatusAvailableChanged;

            StraightConveyorInfo holdingConveyorInfo = new StraightConveyorInfo()
            {
                Length    = 1,
                thickness = 0.05f,
                Width     = 0.5f,
                Speed     = 0.7f
            };

            holdingConveyor = new StraightConveyor(holdingConveyorInfo);
            holdingConveyor.endLine.Visible          = false;
            holdingConveyor.startLine.Visible        = false;
            holdingConveyor.arrow.Visible            = false;
            holdingConveyor.TransportSection.Visible = false;
            holdingConveyor.StartFixPoint.Visible    = false;
            holdingConveyor.EndFixPoint.Visible      = false;

            Add(holdingConveyor);
            holdingConveyor.TransportSection.Route.InsertActionPoint(holdingAp);

            holdingAp.OnEnter += holdingAp_OnEnter;

            UpdateMiniload();

            AllCranes.Add(this);

            subMenu = new List <System.Windows.Forms.ToolStripItem>();
            subMenu.Add(new System.Windows.Forms.ToolStripMenuItem("Reset", Common.Icons.Get("fault")));
            subMenu[0].Click += new EventHandler(DematicHBW_ClickReset);
            //subMenu.Add(new System.Windows.Forms.ToolStripMenuItem("Set compartment occupied", Common.Icons.Get("fault")));
            //subMenu[1].Click += new EventHandler(DematicHBW_ClickCompartmentOccupied);
            //subMenu.Add(new System.Windows.Forms.ToolStripMenuItem("Set compartment empty", Common.Icons.Get("fault")));
            //subMenu[2].Click += new EventHandler(DematicHBW_ClickCompartmentEmpty);
            //subMenu.Add(new System.Windows.Forms.ToolStripMenuItem("Fault Miniload", Common.Icons.Get("fault")));
            //subMenu[3].Click += new EventHandler(DematicHBW_ClickFault);

            Control.FinishedJob += Control_FinishedJob;
            Control.LoadDropped += Control_LoadDropped;

            LoadingSpeed   = 1;
            UnloadingSpeed = 1;

            ControllerProperties = StandardCase.SetMHEControl(info, this);
            Experior.Core.Environment.Scene.OnLoaded += Scene_OnLoaded;
        }