示例#1
0
        private IEnumerable <Event> EndWarmupPhase(double time)
        {
            yield return(_env.TimeoutD(time));

            for (var b = 0; b < Backlog.Length; b++)
            {
                Backlog[b].Reset(Backlog[b].Current);
            }
            SystemUtilization.Reset(SystemUtilization.Current);
            for (var u = 0; u < StationUtilization.Length; u++)
            {
                StationUtilization[u].Reset(StationUtilization[u].Current);
            }
            WIPInventory.Reset(WIPInventory.Current);
            FGIInventory.Reset(FGIInventory.Current);
            WorkerUtilization.Reset(WorkerUtilization.Current);
            for (var w = 0; w < WorkerUtilizations.Length; w++)
            {
                WorkerUtilizations[w].Reset(WorkerUtilizations[w].Current);
            }
            Backorders.Reset(Backorders.Current);
            WIPLeadTime.Reset();
            FGILeadTime.Reset();
            Tardiness.Reset();
            ServiceLevel.Reset();
        }
示例#2
0
        private IEnumerable <Event> JobFlow(int[] route)
        {
            WIPInventory.Increase();
            for (var step = 0; step < route.Length; step++)
            {
                var station = route[step];
                Backlog[station].Increase();
                var s = _stations[station].Request();
                yield return(s); // wait until next station in route is available

                var req = GetWorker(station);
                if (req == null)
                {
                    throw new InvalidOperationException($"There is no worker qualified to work at station {station}");
                }
                yield return(req); // wait until worker request

                var worker      = (int)req.Value;
                var lastStation = _lastStationByWorker[worker];
                if (lastStation >= 0 && _changeTimeMean[lastStation, station] > 0)
                {
                    yield return(_env.TimeoutD(_changeTimeMean[lastStation, station])); // wait until worker has changed station
                }
                _lastStationByWorker[worker] = station;
                _activeStations[station]++;
                _activeWorkers++;

                SystemUtilization.UpdateTo(_activeStations.Sum() / (double)_capacity.Sum());
                StationUtilization[station].UpdateTo(_activeStations[station] / (double)_capacity[station]);
                Backlog[station].Decrease();
                WorkerUtilization.UpdateTo(_activeWorkers / (double)_workforce.Workers);
                WorkerUtilizations[worker].UpdateTo(1);

                //var procTime = _env.RandExponential(_processTimes * _orderAmount);
                var procTime    = GetLogNormal(_randProc, ProcessingTimeStations * OrderAmount, CV_ProcessingTime);
                var workerTime  = procTime * ProcessingRatioWorker;
                var machineTime = procTime - workerTime;

                yield return(_env.TimeoutD(workerTime)); // wait until worker has finished set-up at station

                yield return(_pool.Release(req));        // release the worker

                _activeWorkers--;

                WorkerUtilization.UpdateTo(_activeWorkers / (double)_workforce.Workers);
                WorkerUtilizations[worker].UpdateTo(0);

                yield return(_env.TimeoutD(machineTime));    // wait until station has finished processing

                yield return(_stations[station].Release(s)); // release station

                _activeStations[station]--;

                SystemUtilization.UpdateTo(_activeStations.Sum() / (double)_capacity.Sum());
                StationUtilization[station].UpdateTo(_activeStations[station] / (double)_capacity[station]);
            }
            WIPInventory.Decrease();
        }