Beispiel #1
0
 public Process ProcessJob(DESMachine machine, DESProduct product, Job job, DESMachine nextDesMachine)
 {
     if (machine != null || job != null)
     {
         var p = new Process(Simulation, (process, o) => machine.GetProcessSteps(process, product, job, nextDesMachine));
         return(p);
     }
     return(null);
 }
Beispiel #2
0
 private void RegistrerRelease(DESProduct product)
 {
     (Simulation as SimulationModel).AddProductEvent(new ProductResult()
     {
         ProductType = product.Name,
         Start       = timeDictionary[product],
         Productid   = product.ProductID,
         ModelNode   = Name,
         Total       = Simulation.Now - timeDictionary[product]
     });
     timeDictionary.Remove(product);
 }
Beispiel #3
0
        private IEnumerator <DesTask> GetTasks(Process process, object data)
        {
            do
            {
                //start one process for each product!
                foreach (var product in products)
                {
                    var jobdesmachine = product.Value.FirstOrDefault();
                    if (jobdesmachine != null)
                    {
                        if (jobdesmachine.Key != null)
                        {
                            if (jobdesmachine.Key.Machine.BlockCount <= 1)
                            {
                                var c = new DESProduct(this, product.Key, product.Value);
                                c.Activate(this, 0L);
                            }
                            else
                            {
                                yield return(jobdesmachine.Key.Machine.Acquire(process));

                                yield return(jobdesmachine.Key.Machine.Release(process));
                            }
                            yield return(process.Delay(1));

                            RunStatus = ((Now * 1.0) / (_closingTime * 1.0));
                        }
                    }
                }
            } while (Now < _closingTime);
            Stop();
            _mashinStates.Add(new MachineState()
            {
                Machine = "BaseModel", State = "BaseTime", Total = Now
            });
        }
Beispiel #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;
        }
Beispiel #5
0
 private void RegisterAcquire(DESProduct product)
 {
     timeDictionary.Add(product, Now);
 }