Example #1
0
 private IEnumerator <DesTask> Jobsiterator(Process process, object brd, Job job)
 {
     foreach (var sub in job.Subjobs)
     {
         yield return(process.Delay((long)sub.Distribution.NextDouble()));
     }
 }
Example #2
0
        protected IEnumerator <DesTask> Breakdown(Process proc, object brd)
        {
            while (proc.Simulation.State == SimulationState.Running)
            {
                var d = breakdown.Nextulong();
                yield return(proc.Delay(d));

                _machine.OutOfService++;
                SetState("Breakdown", "Down");
                d = repair.Nextulong();

                var copy = currentstatus.Select(ti => new Pair <string, ulong>(ti.Key, ti.Value)).ToArray();
                currentstatus.Clear();
                foreach (var current in copy)
                {
                    current.Value += d;
                    currentstatus.Add(current.Key, current.Value);
                }

                yield return(proc.Delay(d));

                SetState("Breakdown", "Idle");
                _machine.OutOfService--;
            }
        }
Example #3
0
        protected IEnumerator <DesTask> Breakdown(Process proc, object brd)
        {
            while (proc.Simulation.State == SimulationState.Running)
            {
                var d = (long)breakdown.NextDouble();
                var u = proc.Simulation.Now;
                yield return(proc.Delay(d));

                //yield return _machine.Acquire(proc);
                _machine.OutOfService++;
                var  p = proc.Simulation.Now - u;
                long t = proc.Simulation.Now;
                d = (long)repair.NextDouble();
                yield return(proc.Delay(d));

                long v = proc.Simulation.Now - t;
                _machine.OutOfService--;
                //yield return _machine.Release(proc);
            }
            yield break;
        }
Example #4
0
        public IEnumerator <DesTask> GetProcessSteps(Process process, DESProduct product, Job job, DESMachine nextMachine)
        {
            DESMachine p = parentDES;

            while (p != null)
            {
                while (!p.Machine.IsOwner(process))
                {
                    yield return(p.Machine.Acquire(process));
                }
                p.RegisterAcquire(product);
                var t = p as DESTransport;
                if (t != null)
                {
                    yield return(t.FirstTransport(process));
                }
                p = p.parentDES;
            }

            if (!SetState(product.ProductID + "", product.ProductID + ""))
            {
                Debug.Assert(true, "Foulty");
            }
            ulong time = Simulation.Now;

            foreach (var subjob in job.Subjobs)
            {
                var d = subjob.Distribution.Nextulong();
                yield return(new Delay(Simulation, d));
            }
            var tp = parentDES as DESTransport;

            if (tp != null)
            {
                tp.TransportProduct(process, Name);
            }
            //HALT here if brokendown!!!
            var checkdowntime = time;

            while (currentstatus[product.ProductID + ""] > checkdowntime)
            {
                checkdowntime = currentstatus[product.ProductID + ""];
                yield return(process.Delay(checkdowntime - time));
            }


            (Simulation as SimulationModel).AddProductEvent(new ProductResult()
            {
                ProductType = product.Name,
                Start       = time,
                Productid   = product.ProductID,
                ModelNode   = Name,
                Total       = Simulation.Now - time
            });

            NrofProductsProcessed++;
            SetState(product.ProductID + "", "Idle");
            p = parentDES;
            DESMachine next = nextMachine;

            while (p != null && (next == null || !next.parents.Contains(p)))
            {
                while (p.Machine.IsOwner(process))
                {
                    yield return(p.Machine.Release(process));
                }
                p.RegistrerRelease(product);
                p = p.parentDES;
            }
            yield break;
        }