Ejemplo n.º 1
0
 private void TryRelease()
 {
     if (!ReleaseDelayTimer.Running) //Assume that if the timer is not running then must be free to release a load
     {
         if (TimerReleaseConvs.Any())
         {
             StraightThrough convToRelease = TimerReleaseConvs.First();
             TimerReleaseConvs.Remove(convToRelease);
             convToRelease.RouteAvailable = RouteStatuses.Available;
             ReleaseDelayTimer.Start();
         }
     }
 }
Ejemplo n.º 2
0
            /// <summary>
            /// Release the load from infeed point into the transfer
            /// </summary>
            /// <param name="entrySide">Side of the transfer to release</param>
            /// <param name="exitConv">Route the load will take on the transfer</param>
            /// <param name="load">The load to be routed</param>
            public void RouteLoad(StraightThrough entrySide, StraightThrough exitConv, Load load)
            {
                load.UserData = exitConv;

                if (exitConv.NextRouteStatus.Available == RouteStatuses.Available)
                {
                    threeWaySwitch.TimerReleaseConvs.Add(this);
                }
                else
                {
                    exitConv.WaitingConveyors[exitConv.convPosition].Add(entrySide);
                }

                threeWaySwitch.TryRelease();
            }
Ejemplo n.º 3
0
        public ThreeWaySwitch(ThreeWaySwitchInfo info) : base(info)
        {
            try
            {
                threeWaySwitchInfo   = info;
                ControllerProperties = StandardCase.SetMHEControl(info, this);
                info.height          = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!??

                LeftConv = new StraightThrough(NewStraightInfo(info), this)
                {
                    convPosition = ThreeWayRoutes.Left
                };
                RightConv = new StraightThrough(NewStraightInfo(info), this)
                {
                    convPosition = ThreeWayRoutes.Right
                };
                CenterConv = new StraightThrough(NewStraightInfo(info), this)
                {
                    convPosition = ThreeWayRoutes.Center
                };

                Add(LeftConv, new Vector3(0, 0, -info.width / 2));
                Add(RightConv, new Vector3(0, 0, info.width / 2));
                Add(CenterConv, new Vector3(0, 0, info.centerOffset));

                ReleaseDelayTimer                    = new Core.Timer(ReleaseDelayTimeStraight); //loads will be only be released when the timer elapses the timer will start when a load transfers
                ReleaseDelayTimer.OnElapsed         += ReleaseDelayTimer_OnElapsed;
                ReleaseDelayTimer.AutoReset          = false;
                TimerReleaseConvs.CollectionChanged += TimerReleaseConvs_CollectionChanged;

                ThreeWayLength         = info.threeWayLength;
                internalWidth          = info.threeWayWidth - ((float)info.internalConvWidth / 1000);
                CenterOffset           = info.centerOffset;
                LeftDefaultDirection   = info.leftDefaultDirection;
                RightDefaultDirection  = info.rightDefaultDirection;
                CenterDefaultDirection = info.centerDefaultDirection;
                InternalConvWidth      = info.internalConvWidth;
                Speed = info.speed;

                ReleaseDelayTimeStraight         = info.releaseDelayTimeStraight;
                Core.Environment.Scene.OnLoaded += Scene_OnLoaded;
            }
            catch (Exception e)
            {
                Log.Write(e.Message);
            }
        }
Ejemplo n.º 4
0
            void StraightThrough_OnNextRouteStatusAvailableChanged(object sender, RouteStatusChangedEventArgs e)
            {
                if (e._available == RouteStatuses.Available)
                {
                    if (WaitingConveyors[convPosition].Any())
                    {
                        //Has the conveyor route that has just become avaiable have any loads that want to transfer to it.
                        if (WaitingConveyors[convPosition] != null) //only get on WaitingConveyors from RouteLoad(..)
                        {
                            StraightThrough waitingConv = WaitingConveyors[convPosition].First();
                            WaitingConveyors[convPosition].Remove(waitingConv);
                            threeWaySwitch.TimerReleaseConvs.Add(waitingConv); //simply adding to this list will when the timer stops release it
                        }

                        if (threeWaySwitch.OnTransferStatusChangedController != null)
                        {
                            threeWaySwitch.OnTransferStatusChangedController(this, new EventArgs());
                        }
                    }
                }
            }
Ejemplo n.º 5
0
            /// <summary>
            /// Controls switching the load back to the correct StraightThrough conveyor
            /// </summary>
            void endAP_OnEnter(ActionPoint sender, Core.Loads.Load load)
            {
                ThreeWayRoutes? exitRoute = null;
                StraightThrough thisConv  = load.UserData as StraightThrough;

                if (thisConv != null)
                {
                    exitRoute = thisConv.convPosition;
                }

                //if (threeWaySwitch.ControlType == ControlTypes.Local)
                //{
                //    if (straightThrough.convPosition == ThreeWayRoutes.Right)
                //    {
                //        if (threeWaySwitch.RightDefaultDirection == ThreeWayRoutes.Left)
                //        {
                //            load.Switch(threeWaySwitch.LeftConv.endAP);
                //        }
                //        else if (threeWaySwitch.RightDefaultDirection == ThreeWayRoutes.Center)
                //        {
                //            load.Switch(threeWaySwitch.CenterConv.endAP);
                //        }
                //    }
                //    else if (straightThrough.convPosition == ThreeWayRoutes.Left)
                //    {
                //        if (threeWaySwitch.LeftDefaultDirection == ThreeWayRoutes.Right)
                //        {
                //            load.Switch(threeWaySwitch.RightConv.endAP);
                //        }
                //        else if (threeWaySwitch.LeftDefaultDirection == ThreeWayRoutes.Center)
                //        {
                //            load.Switch(threeWaySwitch.CenterConv.endAP);
                //        }
                //    }
                //    else if (straightThrough.convPosition == ThreeWayRoutes.Center)
                //    {
                //        if (threeWaySwitch.CenterDefaultDirection == ThreeWayRoutes.Right)
                //        {
                //            load.Switch(threeWaySwitch.RightConv.endAP);
                //        }
                //        else if (threeWaySwitch.CenterDefaultDirection == ThreeWayRoutes.Left)
                //        {
                //            load.Switch(threeWaySwitch.LeftConv.endAP);
                //        }
                //    }
                //}
                //else if (threeWaySwitch.ControlType == ControlTypes.Controller)
                //{
                if (straightThrough.convPosition == ThreeWayRoutes.Right)
                {
                    if (exitRoute == ThreeWayRoutes.Left)
                    {
                        load.Switch(threeWaySwitch.LeftConv.endAP);
                    }
                    else if (exitRoute == ThreeWayRoutes.Center)
                    {
                        load.Switch(threeWaySwitch.CenterConv.endAP);
                    }
                }
                else if (straightThrough.convPosition == ThreeWayRoutes.Left)
                {
                    if (exitRoute == ThreeWayRoutes.Right)
                    {
                        load.Switch(threeWaySwitch.RightConv.endAP);
                    }
                    else if (exitRoute == ThreeWayRoutes.Center)
                    {
                        load.Switch(threeWaySwitch.CenterConv.endAP);
                    }
                }
                else if (straightThrough.convPosition == ThreeWayRoutes.Center)
                {
                    if (exitRoute == ThreeWayRoutes.Right)
                    {
                        load.Switch(threeWaySwitch.RightConv.endAP);
                    }
                    else if (exitRoute == ThreeWayRoutes.Left)
                    {
                        load.Switch(threeWaySwitch.LeftConv.endAP);
                    }
                }
                //}
            }