Example #1
0
        public MHEControl_MergeDivert(MergeDivertSimulationInfo info, MergeDivertConveyor mergeDivert)
        {
            mergeDivertConveyor       = mergeDivert;
            mergeDivertSimulationInfo = info;
            Info = info;  // set this to save properties

            mergeDivertConveyor.divertArrival    = divertArrival;
            mergeDivertConveyor.loadDeleted      = loadDeleted;
            mergeDivertConveyor.releasedStraight = releasedStraight;
            mergeDivertConveyor.releasedLeft     = releasedLeft;
            mergeDivertConveyor.releasedRight    = releasedRight;
        }
Example #2
0
        /// <summary>
        /// Creates the correct type of object to display to the user. This will depend on type of kit
        /// The communication point uses this to display the relevent fields to the user.
        /// Defined in BK10PLC.cs
        /// </summary>
        /// <param name="assem"></param>
        /// <returns></returns>
        public MHEControl CreateMHEControl(IControllable assem, ProtocolInfo info)
        {
            MHEControl   protocolConfig = null; //generic plc config object
            ProtocolInfo protocolInfo   = null; //generic plc config object constructor argument type

            //ProtocolInfo protocolInfo = new ProtocolInfo();  //generic plc config object constructor argument type

            if (assem is MultiShuttle)
            {
                if (info is MultiShuttleSimInfo) // create the defined protocol info
                {
                    info.assem     = assem.Name;
                    protocolConfig = new MHEControl_MultiShuttleSimulation(info as MultiShuttleSimInfo, assem as MultiShuttle);
                }
                else //create a new protocol info
                {
                    protocolInfo       = new MultiShuttleSimInfo();
                    protocolInfo.assem = assem.Name;
                    protocolConfig     = new MHEControl_MultiShuttleSimulation(protocolInfo as MultiShuttleSimInfo, assem as MultiShuttle);
                }
            }
            else if (assem is MergeDivertConveyor)
            {
                if (info is MergeDivertSimulationInfo)
                {
                    ((MergeDivertSimulationInfo)info).assem = assem.Name;
                    protocolConfig = new MHEControl_MergeDivert(info as MergeDivertSimulationInfo, assem as MergeDivertConveyor);
                }
                else //create a new protocol info
                {
                    protocolInfo       = new MergeDivertSimulationInfo();
                    protocolInfo.assem = assem.Name;
                    protocolConfig     = new MHEControl_MergeDivert(protocolInfo as MergeDivertSimulationInfo, assem as MergeDivertConveyor);
                }
            }
            else if (assem is AngledDivert)
            {
                if (info is AngledDivertSimulationInfo)
                {
                    ((AngledDivertSimulationInfo)info).assem = assem.Name;
                    protocolConfig = new MHEControl_AngledDivert(info as AngledDivertSimulationInfo, assem as AngledDivert);
                }
                else //create a new protocol info
                {
                    protocolInfo       = new AngledDivertSimulationInfo();
                    protocolInfo.assem = assem.Name;
                    protocolConfig     = new MHEControl_AngledDivert(protocolInfo as AngledDivertSimulationInfo, assem as AngledDivert);
                }
            }
            else if (assem is Transfer)
            {
                if (info is TransferSimulationInfo)
                {
                    ((TransferSimulationInfo)info).assem = assem.Name;
                    protocolConfig = new MHEControl_Transfer(info as TransferSimulationInfo, assem as Transfer);
                }
                else //create a new protocol info
                {
                    protocolInfo       = new TransferSimulationInfo();
                    protocolInfo.assem = assem.Name;
                    protocolConfig     = new MHEControl_Transfer(protocolInfo as TransferSimulationInfo, assem as Transfer);
                }
            }

            else
            {
                Experior.Core.Environment.Log.Write("Can't create PLC config object ");
                return(null);
            }
            //......other assemblies should be added here....do this with generics
            protocolConfig.ParentAssembly = (Assembly)assem;
            return(protocolConfig as MHEControl);
        }