Exemple #1
0
        public PalletStraight(PalletStraightInfo info) : base(info)
        {
            try
            {
                palletStraightInfo      = info;
                ReleaseTimer.OnElapsed += ReleaseTimer_OnElapsed;

                ConstructDevice          = new ConstructDevice(string.Empty);
                LineReleasePhotocellName = palletStraightInfo.LineReleasePhotocellName;
                DeviceInfo deviceInfo = DeviceInfos.Find(i => i.name == LineReleasePhotocellName);
                if (deviceInfo == null)
                {
                    PalletPhotocellInfo photocellInfo = new PalletPhotocellInfo();
                    photocellInfo.name         = "LineRelease";
                    photocellInfo.distanceFrom = PositionPoint.End;
                    photocellInfo.distance     = 0.125f;
                    photocellInfo.type         = ConstructDevice.DeviceTypes["Add Photocell"].Item1; //Item1 is the device type ...obviously!
                    DeviceInfos.Add(photocellInfo);
                }
                ConstructDevice.InsertDevices(this as IConstructDevice);

                SetLineReleasePhotocell();
                LineReleaseEvents(true);

                if (ControlType == ControlTypes.Local)
                {
                    OnLoadArrived += Photocell_OnLoadArrived;
                }
            }
            catch (Exception ex)
            {
                Core.Environment.Log.Write(ex.Message);
            }
        }
Exemple #2
0
        public TCar(TCarInfo info) : base(info)
        {
            tCarInfo    = info;
            info.height = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!??

            Core.Environment.Scene.OnLoaded += Scene_OnLoaded;

            var offCentre = TCarWidth / 2 - TCarWidth;

            // Left track used to move the load
            track = new StraightTransportSection(Color.Gray, TCarLength, 0.05f, 0.05f);
            Add(track);
            track.Route.Motor.Speed = 1; // m/s ?
            track.LocalPosition     = new Vector3(-TCarLength / 2, -0.05f, offCentre);

            // Load Vehicle
            trackLoad           = Core.Loads.Load.CreateBox(0.1f, 0.1f, 0.1f, Color.BlueViolet);
            trackLoad.Embedded  = true;
            trackLoad.Deletable = false;
            track.Route.Add(trackLoad);
            trackLoad.OnPositionChanged += TrackLoad_OnPositionChanged;
            trackLoad.Stop();
            trackLoad.Visible = false;

            // Right track (visual only)
            trackRight = new Cube(Color.Gray, TCarLength, 0.05f, 0.05f);
            Add(trackRight);
            trackRight.LocalPosition = new Vector3(-TCarLength / 2, -0.05f, -offCentre);

            // Action point for lift rail
            trackStopPoint          = track.Route.InsertActionPoint(0);
            trackStopPoint.Color    = Color.Black;
            trackStopPoint.Visible  = false;
            trackStopPoint.OnEnter += TrackStopPoint_OnEnter;

            // Conveyor
            PalletStraightInfo straightInfo = new PalletStraightInfo
            {
                ConveyorType = PalletConveyorType.Roller,
                thickness    = 0.05f,
                spacing      = 0.1f,
                width        = ConveyorWidth,
                length       = TCarWidth,
                speed        = 0.3f,
                color        = tCarInfo.color,
            };

            conveyor = new PalletStraight(straightInfo);
            conveyor.LineReleasePhotocell.OnPhotocellStatusChanged += LineReleasePhotocell_OnPhotocellStatusChanged;
            conveyor.ThisRouteStatus.OnRouteStatusChanged          += ThisRouteStatus_OnRouteStatusChanged;
            conveyor.Entering.Name         = "EnterPoint";
            conveyor.Leaving.Name          = "ExitPoint";
            conveyor.StartFixPoint.Visible = false;
            conveyor.EndFixPoint.Visible   = false;
            Add(conveyor);
            conveyor.LocalPosition = new Vector3(-conveyor.Width / 2, 0, 0);
            conveyor.LocalYaw      = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f));

            SetupFixPoints();

            Tasks.CollectionChanged += Tasks_CollectionChanged;

            Reset();
        }