Пример #1
0
        public StraightPhotocellConveyor(StraightPhotocellConveyorInfo info) : base(info)
        {
            try
            {
                straightInfo            = info;
                releaseTimer.OnElapsed += ReleaseTimer_OnElapsed;

                constructDevice          = new ConstructDevice(string.Empty);
                LineReleasePhotocellName = straightInfo.LineReleasePhotocellName;
                DeviceInfo deviceInfo = DeviceInfos.Find(i => i.name == LineReleasePhotocellName);
                if (deviceInfo == null)
                {
                    CasePhotocellInfo photocellInfo = new CasePhotocellInfo();
                    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);
            }
            catch (Exception ex)
            {
                Core.Environment.Log.Write(ex.Message);
            }
        }
Пример #2
0
        public CasePhotocell(CasePhotocellInfo info, BaseTrack conv) : base(info, conv)
        {
            photocellInfo = info;
            AssemblyInfo ai = new AssemblyInfo();

            conveyor = conv;

            photocellDisplay = new CasePhotocellDisplay(new PhotocellDisplayInfo {
                width = info.width
            });
            photocellDisplay.ListSolutionExplorer       = false;
            photocellDisplay.OnPhotocellDisplayDeleted += photocellDisplay_OnPhotocellDisplayDeleted;

            Add(photocellDisplay, new Vector3(info.length / 2, 0, 0));
            sensor.OnEnter += sensor_OnEnter;
            sensor.OnLeave += sensor_OnLeave;
            sensor.Color    = Color.Green;
            sensor.Visible  = false;

            conv.TransportSection.Route.InsertActionPoint(sensor);

            //If the photocell is connected to a belt conveyor then we want to pause the timers if the conveyor is not available
            if (conveyor is IBeltControl)
            {
                beltControl = conveyor as IRouteStatus;
                routeStatus = beltControl.GetRouteStatus(conveyor.StartFixPoint);
                routeStatus.OnRouteStatusChanged += routeStatus_OnRouteStatusChanged;
            }

            OnNameChanged += CasePhotocell_OnNameChanged;
        }
Пример #3
0
        public BeltControl(Assembly assembly)
        {
            conveyor = assembly as IBeltControl;
            ReleaseTimer.OnElapsed     += ReleaseTimer_OnElapsed;
            LoadWaitingTimer.OnElapsed += LoadWaitingTimer_OnElapsed;

            if (!Core.Environment.Scene.Loading)
            {
                constructDevice = new ConstructDevice(string.Empty);
                DeviceInfo deviceInfo = conveyor.DeviceInfos.Find(i => i.name == conveyor.LineReleasePhotocellName);

                if (deviceInfo == null)
                {
                    CasePhotocellInfo photocellInfo = new CasePhotocellInfo();
                    photocellInfo.name         = conveyor.LineReleasePhotocellName;
                    photocellInfo.distanceFrom = PositionPoint.End;
                    photocellInfo.distance     = 0.125f;
                    photocellInfo.type         = constructDevice.DeviceTypes["Add Photocell"].Item1; //Item1 is the device type ...obviously!

                    conveyor.DeviceInfos.Add(photocellInfo);
                }
                constructDevice.InsertDevices(conveyor as IConstructDevice);

                SetLineReleasePhotocell();
                LineReleaseEvents(true);
            }
        }
Пример #4
0
        void photoCellPlacment_OnElapsed(Timer sender)
        {
            try
            {
                StraightBeltConveyor photocellBelt = photoCellCreator.Route.Parent.Parent as StraightBeltConveyor; //TODO what about other types --- really need a Dematic base conveyor
                CasePhotocellInfo    pcinfo        = new CasePhotocellInfo()
                {
                    name         = "Induct_" + ((KeyValuePair <string, float>)eSortedTeachTimes.Current).Key,
                    distance     = photoCellCreator.Distance,
                    distanceFrom = PositionPoint.Start,
                    type         = photocellBelt.beltControl.constructDevice.DeviceTypes["Add Photocell"].Item1
                };

                CasePhotocell pc = beltControl.constructDevice.InsertDevice(pcinfo, photocellBelt as IConstructDevice) as CasePhotocell;
                photocellBelt.DeviceInfos.Add(pcinfo); //Add the device info to the assembly that it was created on so that it will be saved when the user saves the model
                BeltSorterMerge bsm = Experior.Core.Assemblies.Assembly.Items[((KeyValuePair <string, float>)eSortedTeachTimes.Current).Key] as BeltSorterMerge;

                bsm.MergePhotocellName = string.Format("{0},{1}", photocellBelt.Name, pc.Name);

                if (eSortedTeachTimes.MoveNext()) //reset the timer ready for the next photocell
                {
                    KeyValuePair <string, float> photoCellInfo = (KeyValuePair <string, float>)eSortedTeachTimes.Current;
                    photoCellPlacment.Timeout = photoCellInfo.Value - previousTime;
                    previousTime += photoCellInfo.Value - previousTime;
                    photoCellPlacment.Reset();
                    photoCellPlacment.Start();
                }
                else //After all photocells have been created subcribe to there deleted event
                {
                    AssignMergePhotoCellDeleted();
                }
            }
            catch (Exception ex)
            {
                Log.Write("Error in photoCellPlacment_OnElapsed: " + ex.Message);
            }
        }