示例#1
0
        public MHEControl CreateMHEControl(IControllable assem, ProtocolInfo info)
        {
            sorterElement = assem as SorterElement;

            MHEControl protocolConfig = null;  //generic plc config object

            if (assem is SorterElement)
            {
                protocolConfig = CreateMHEControlGeneric <SorterATCInfo, MHEControl_Sorter>(assem, info);
            }
            else if (assem is CommunicationPoint)
            {
                protocolConfig = CreateMHEControlGeneric <MHEControl_CommPointInfo, MHEControl_CommPoint>(assem, info);
            }
            else
            {
                Experior.Core.Environment.Log.Write("Can't create MHE Control, object is not defined in the 'CreateMHEControl' of the controller", Color.Red);
                return(null);
            }
            //......other assemblies should be added here....do this with generics...correction better to do this with reflection...That is BaseController should use reflection
            //and not generics as we do not know the types at design time and it means that the above always has to be edited when adding a new MHE control object.
            protocolConfig.ParentAssembly = (Assembly)assem;
            controls.Add(protocolConfig);
            return(protocolConfig as MHEControl);
        }
示例#2
0
 public MHEControl_Sorter(SorterATCInfo info, SorterElement sorterElement)
 {
     Info                 = info; // set this to save properties
     sorterATCInfo        = info;
     SorterMasterElement  = sorterElement;
     mheController_Sorter = ((MHEController_Sorter)SorterMasterElement.Controller);
     //Check if experior is loading a model.
     if (Environment.Scene.Loading)
     {
         Environment.Scene.OnLoaded += Environment_LoadingCompleted;
     }
     else
     {
         SetSorterMaster();
     }
 }
示例#3
0
        private void SetSorterMaster()
        {
            if (SorterMasterElement != null)
            {
                //unsubscribe from old sortermaster.Control events
                SorterMasterElement.Control.LoadArrivedAtInduction   -= Control_Load_Arrived_At_Induction;
                SorterMasterElement.Control.LoadArrivedAtDestination -= Control_Load_Arrived_At_Destination;
                SorterMasterElement.Control.CarrierArrived           -= Control_Carrier_Arrived_At_Induction;
            }

            SorterMasterElement = (SorterElement)Assembly.Get(SorterMasterName);

            if (SorterMasterElement != null)
            {
                //Subscribe to sortermaster.Control events
                SorterMasterElement.Control.LoadArrivedAtInduction   += Control_Load_Arrived_At_Induction;
                SorterMasterElement.Control.LoadArrivedAtDestination += Control_Load_Arrived_At_Destination;
                SorterMasterElement.Control.CarrierArrived           += Control_Carrier_Arrived_At_Induction;
            }
        }
示例#4
0
 public SorterMasterControl(SorterElement parent)
 {
     this.parent = parent;
 }