Exemple #1
0
        public void Resolve()
        {
            FMM currentModule = null;

            for (int i = 0; i < DetailsCount; i++)
            {
                Details[i].CurrentModule.Bag.Add(Details[i]);
            }

            do
            {
                float currentTime = float.MaxValue;
                foreach (var module in Modules)
                {
                    if (module.Bag.Any())
                    {
                        if (module.CurrentDetail == null)
                        {
                            module.SetDetail();
                        }

                        if (module.CurrentDetail != null)
                        {
                            if (module.CurrentDetail.CurrentEndTime <= currentTime)
                            {
                                currentTime   = module.CurrentDetail.CurrentEndTime;
                                currentModule = module;
                            }
                        }
                    }
                }

                if (currentModule == null || currentModule.CurrentDetail == null)
                {
                    break;
                }
                currentModule.CurrentDetail.StartTimes[currentModule.CurrentDetail.OpNumber] = currentTime -
                                                                                               currentModule
                                                                                               .CurrentDetail
                                                                                               .CurrentDuration;
                currentModule.AddToQueue();
                currentModule.CurrentDetail.RemoveFromBag();
                currentModule.CurrentDetail.ToNextOperation();
                currentModule.CurrentDetail = null;
            } while (true);

            TotalTime = 0;
            foreach (var module in Modules)
            {
                var lastDetail = module.DetailQueue.LastOrDefault();
                if (lastDetail != null)
                {
                    var moduleFinishTime = lastDetail.StartTime + lastDetail.Duration;
                    if (moduleFinishTime > TotalTime)
                    {
                        TotalTime = moduleFinishTime;
                    }
                }
            }
        }
Exemple #2
0
        public float ResolveTransport(FMM module, float time, out float transportTime)
        {
            bool linearFlag = false;

            int to    = module.Index,
                @from = module.CurrentDetail.OpNumber == 0
                ? 0
                : module.CurrentDetail.Route[module.CurrentDetail.OpNumber - 1].Index;
            int routeLength = TransportLengths[@from, to];

            if (to == 6 || to == 5)
            {
                linearFlag = true;
            }
            if (to == 4 || to == 3)
            {
                linearFlag = true;
            }

            transportTime = Tpid * routeLength + Tpost;
            if (to == 0)
            {
                transportTime += Tpost;
            }
            else
            {
                transportTime += Tz;
            }
            if (linearFlag)
            {
                transportTime += Tvz + Tpost;
            }
            if (@from == 0)
            {
                transportTime += Tvz;
            }
            else
            {
                transportTime += Tr;
            }

            DetailPos current, idle, linearPos, linearIdle;

            switch (to)
            {
            case 3:
                current = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = time,
                    Duration  = transportTime - Tvz - Tz
                };
                //module.CurrentDetail.StartTimes[module.CurrentDetail.OpNumber] += transportTime;
                Atm1.AddToQueue(current, module);

                idle = new DetailPos
                {
                    Index     = 15,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tpid * routeLength
                };
                Atm1.AddToQueue(idle, module);

                linearPos = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tvz + Tz
                };
                Atm2.AddToQueue(linearPos, module);

                break;

            case 4:
                current = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = time,
                    Duration  = transportTime - Tvz - Tz
                };
                //module.CurrentDetail.StartTimes[module.CurrentDetail.OpNumber] += transportTime;
                Atm1.AddToQueue(current, module);

                idle = new DetailPos
                {
                    Index     = 15,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tpid * routeLength
                };
                Atm1.AddToQueue(idle, module);

                linearPos = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tvz + Tz
                };
                Atm3.AddToQueue(linearPos, module);

                break;

            case 5:
                current = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = time,
                    Duration  = transportTime - Tvz - Tz - Tpid
                };
                //module.CurrentDetail.StartTimes[module.CurrentDetail.OpNumber] += transportTime - Tvz - Tz - Tpid;
                Atm1.AddToQueue(current, module);

                idle = new DetailPos
                {
                    Index     = 15,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tpid * (routeLength - 1)
                };
                Atm1.AddToQueue(idle, module);

                linearPos = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tvz + Tz + Tpid
                };
                Atm3.AddToQueue(linearPos, module);

                linearIdle = new DetailPos
                {
                    Index     = 15,
                    StartTime = linearPos.StartTime + linearPos.Duration,
                    Duration  = Tpid
                };
                Atm3.AddToQueue(linearIdle, module);
                break;

            case 6:
                current = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = time,
                    Duration  = transportTime - Tvz - Tz - Tpid
                };
                //module.CurrentDetail.StartTimes[module.CurrentDetail.OpNumber] += transportTime - Tvz - Tz - Tpid;
                Atm1.AddToQueue(current, module);

                idle = new DetailPos
                {
                    Index     = 15,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tpid * (routeLength - 1)
                };
                Atm1.AddToQueue(idle, module);

                linearPos = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tvz + Tz + Tpid
                };
                Atm2.AddToQueue(linearPos, module);

                linearIdle = new DetailPos
                {
                    Index     = 15,
                    StartTime = linearPos.StartTime + linearPos.Duration,
                    Duration  = Tpid
                };
                Atm2.AddToQueue(linearIdle, module);

                break;

            case 0:
                break;

            default:
                current = new DetailPos
                {
                    Index     = module.CurrentDetail.Index,
                    StartTime = time,
                    Duration  = transportTime
                };
                //module.CurrentDetail.StartTimes[module.CurrentDetail.OpNumber] += transportTime - Tvz - Tz - Tpid;
                Atm1.AddToQueue(current, module);
                idle = new DetailPos
                {
                    Index     = 15,
                    StartTime = current.StartTime + current.Duration,
                    Duration  = Tpid * routeLength
                };
                Atm1.AddToQueue(idle, module);

                break;
            }

            return(module.CurrentDetail.CurrentEndTime - module.CurrentDetail.CurrentDuration);
        }