Ejemplo n.º 1
0
        protected override UnitloadList UnitloadListSelection(UnitloadList unitloads)
        {
            UnitloadList unitloadsinQueue    = new UnitloadList();
            UnitloadList consideredunitloads = new UnitloadList();

            foreach (Unitload unit in unitloads)
            {
                if (unit.IsCompleted == false)
                {
                    OperationList consideredOperations = new OperationList();
                    foreach (JobRoute currentRoute in unit.Alternates)
                    {
                        Operation operation = currentRoute.Operations[unit.Completed.Count];
                        if (consideredOperations.Contains(operation) == false && consideredunitloads.Contains(unit) == false)
                        {
                            //operation can be done in identical processors
                            if (operation.Processor == null)
                            {
                                foreach (Processor processor in unit.Station.Processors)
                                {
                                    if ((processor.IsAvailable == true) && (processor.Operations.Contains(operation)))
                                    {
                                        unitloadsinQueue.Add(unit);
                                        consideredOperations.Add(operation);
                                        consideredunitloads.Add(unit);
                                        break;
                                    }
                                }
                            }
                            else //if the processor of the operation is determined from beginning (not identical)
                            {
                                if (operation.Processor.IsAvailable == true)
                                {
                                    unitloadsinQueue.Add(unit);
                                    consideredOperations.Add(operation);
                                    consideredunitloads.Add(unit);
                                    break;
                                }
                            }
                        }
                        if (consideredunitloads.Contains(unit))
                        {
                            break;
                        }
                    }
                }
            }
            return(unitloadsinQueue);
        }
Ejemplo n.º 2
0
        //this function is for just inputstations(copied from inputcell functions after deleting inputcell)
        public UnitloadList FindUnreleasedUnitloads()
        {
            UnitloadList unitloads = new UnitloadList();

            foreach (Unitload unitload in this.InQueue.Content)
            {
                if (unitload.InTransfer == false)
                {
                    unitloads.Add(unitload);
                }
            }
            return(unitloads);
        }
Ejemplo n.º 3
0
        protected override void ControlStation(FLOW.NET.Layout.Station stationIn)
        {
            UnitloadList uloadtogo = new UnitloadList();

            if (stationIn.GetFreeProcessors().Count > 0)
            {
                if (stationIn.InQueue.Content != null)
                {
                    foreach (Unitload u in stationIn.InQueue.Content)
                    {
                        uloadtogo.Add(u);
                    }
                    uloadtogo = this.Manager.Algorithms.PartSequencingForProcessor.Execute(uloadtogo); //FirstComeMustGo is an example
                    foreach (Unitload unit in uloadtogo)
                    {
                        Processor selectedprocessor = null;
                        if (unit.IsCompleted == false)
                        {
                            selectedprocessor = this.Manager.Algorithms.ProcessorSelection.Execute(unit);
                        }
                        if (selectedprocessor != null)
                        {
                            unit.InTransfer = true;
                            double transferTime = stationIn.TransferTime.GenerateValue();
                            this.Manager.EventCalendar.ScheduleStartProcessEvent(this.Manager.Time, selectedprocessor, unit, transferTime);
                            selectedprocessor.Reserved++;
                            ((Station)selectedprocessor.Parent).BinMagazine.SpendComponent(unit.Operation.ComponentUsages);
                            ((Station)selectedprocessor.Parent).BinMagazine.CheckComponentOrder(unit.Operation.ComponentUsages);
                        }
                        if (stationIn.GetFreeProcessors().Count == 0)
                        {
                            break;
                        }
                    }
                }
            }
            stationIn.BlockageUpdate(this.Manager.Time);
            stationIn.StarvationUpdate(uloadtogo, this.Manager.Time);
        }
Ejemplo n.º 4
0
        protected void PerformCyclicalOrder(Station inputStationIn)
        {
            UnitloadListStringDictionary unitloads = new UnitloadListStringDictionary();
            UnitloadList      orderedUnitloads     = new UnitloadList();
            JobTypeList       jobTypes             = new JobTypeList();
            int               totalRelease         = 0;
            MovableObjectList queueContent         = inputStationIn.InQueue.Content;

            foreach (Unitload unitload in queueContent)
            {
                if (unitload.EntryTime == this.Manager.Time)
                {
                    Job currentJob = (Job)unitload.Parent;
                    if (unitloads.ContainsKey(currentJob.JobType.Name) == false)
                    {
                        UnitloadList jobList = new UnitloadList();
                        unitloads.Add(currentJob.JobType.Name, jobList);
                        jobList.Add(unitload);
                        jobTypes.Add(currentJob.JobType);
                    }
                    else
                    {
                        UnitloadList jobList = unitloads[currentJob.JobType.Name];
                        jobList.Add(unitload);
                    }
                    totalRelease++;
                }
            }
            int[] frequency       = new int[jobTypes.Count];
            int[] remaining       = new int[jobTypes.Count];
            int[] minimumPosition = new int[jobTypes.Count];
            int   index           = 0;

            foreach (JobType jobType in jobTypes)
            {
                UnitloadList jobList = unitloads[jobType.Name];
                frequency[index]         = (int)Math.Ceiling((double)totalRelease / jobList.Count);
                remaining[index]         = jobList.Count;
                minimumPosition[index++] = 0;
            }
            while (totalRelease != 0)
            {
                int leastPosition = Int32.MaxValue;
                for (int i = 0; i < jobTypes.Count; i++)
                {
                    if (minimumPosition[i] < leastPosition)
                    {
                        leastPosition = minimumPosition[i];
                    }
                }
                int mostRemaining    = 0;
                int selectedJobIndex = -1;
                for (int i = 0; i < jobTypes.Count; i++)
                {
                    if (minimumPosition[i] == leastPosition)
                    {
                        if (mostRemaining < remaining[i])
                        {
                            mostRemaining    = remaining[i];
                            selectedJobIndex = i;
                        }
                    }
                }
                remaining[selectedJobIndex] = remaining[selectedJobIndex] - 1;
                if (remaining[selectedJobIndex] == 0)
                {
                    minimumPosition[selectedJobIndex] = Int32.MaxValue;
                }
                else
                {
                    if (minimumPosition[selectedJobIndex] <= orderedUnitloads.Count)
                    {
                        minimumPosition[selectedJobIndex] = minimumPosition[selectedJobIndex] + frequency[selectedJobIndex];
                    }
                }
                totalRelease--;
                UnitloadList jobList = unitloads[jobTypes[selectedJobIndex].Name];
                orderedUnitloads.Add(jobList[0]);
                jobList.RemoveAt(0);
            }
            queueContent.RemoveRange(queueContent.Count - orderedUnitloads.Count, orderedUnitloads.Count);
            foreach (Unitload unitload in orderedUnitloads)
            {
                queueContent.Add(unitload);
            }
        }