Example #1
0
        public override void DirectVMNotify()
        {
            if (CraneInfo != null && PLC_Status != null)
            {
                CraneInfo.Name             = Name;
                CraneInfo.NumCommands      = PLC_Status.NumCommands;
                CraneInfo.Command_ID       = PLC_Status.Command_ID;
                CraneInfo.BufferCommand_ID = PLC_Status.BufferCommand_ID;
                CraneInfo.LPosition        = PLC_Status.LPosition;
                CraneInfo.FPosition        = PLC_Status.FPosition;
                CraneInfo.StateMachine     = PLC_Status.StateMachine;
                CraneInfo.Palette          = PLC_Status.Palette;
                CraneInfo.AlarmID          = PLC_Status.AlarmID;
                CraneInfo.Fault            = PLC_Status.Fault;
                CraneInfo.SetAlarms(PLC_Status.CurrentAlarms, Warehouse);
                CraneInfo.SetSensors(PLC_Status.Status);
                CraneInfo.Status      = PLC_Status.Status;
                CraneInfo.LastCommand = Command != null?Command.ToSmallString() : "";

                CraneInfo.LastBufferCommand = BufferCommand != null?BufferCommand.ToSmallString() : "";

                CraneInfo.Palette = Place != null ? new Palette {
                    Barcode = (uint)Place.Material
                } : null;
                CraneInfo.Online = Online();
                CallNotifyVM(CraneInfo);
            }
        }
Example #2
0
        // initialize
        public override void Initialize(BasicWarehouse w)
        {
            try
            {
                base.Initialize(w);
                if (CraneInfo != null)
                {
                    CraneInfo.Name = Name;
                    CraneInfo.Initialize();
                }

                if (HomePosition != null)
                {
                    LPHomePosition = LPosition.FromString(HomePosition);
                }

                if (OutRouteDef != null)
                {
                    if (OutRouteDef == null || OutRouteDef.XmlRoute == null)
                    {
                        throw new BasicWarehouseException(String.Format("{0} has no XmlRoute defined", Name));
                    }
                    OutConveyor                = new List <IConveyorIO>();
                    OutRouteDef.Node           = new List <RouteNode>();
                    OutRouteDef.FinalRouteCost = new List <Route>();
                    foreach (XmlRouteNode node in OutRouteDef.XmlRoute)
                    {
                        OutRouteDef.Node.Add(new RouteNode {
                            Next = Warehouse.FindConveyorBasic(node.Next), Cost = node.Cost
                        });
                        OutConveyor.Add(Warehouse.CheckForConveyorIO(node.Next));
                    }
                }
            }
            catch (Exception ex)
            {
                Warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, ex.Message);
                throw new CraneException(String.Format("{0} Crane.Initialize failed", Name));
            }
        }