コード例 #1
0
        public void Step()
        {
            service serv = s.min();

            if (serv.t == -1 || serv.t > q.t)
            {
                this.t = q.t;
                q.getNextEvent();
                if (s.busy() == n)
                {
                    q.add();
                }
                else
                {
                    s.setBusy(this.t);
                }
            }
            else
            {
                this.t = serv.t;
                if (q.count == 0)
                {
                    serv.t = -1;
                }
                else
                {
                    q.count--;
                    serv.setTime(this.t);
                }
            }
            this.chart1.Series[0].Points.Clear();
            this.chart2.Series[0].Points.Clear();
            this.chart1.Series[0].Points.AddXY(0, q.count);
            for (int i = 0; i < n; i++)
            {
                double ti = s[i].t - t;
                if (ti < 0)
                {
                    ti = 0;
                }
                this.chart2.Series[0].Points.AddXY(i, ti);
            }
        }