Пример #1
0
            protected virtual void GenerateCustomers(IExecutive exec)
            {
                DateTime when = Executive.Now;

                for (int i = 0; i < NCustomers; i++)
                {
                    when += TimeSpan.FromMinutes(InterarrivalTime.GetNext());
                    Executive.RequestEvent((exec2, data) => { new Customer().Start(TellerPool); }, when, 0.0, null,
                                           ExecEventType.Detachable);
                    Console.WriteLine("Customer {0} will arrive at {1}.", i, when);
                }
            }
Пример #2
0
        private void _TestTimeSpanHistogram(IDoubleDistribution dist, int nDataPoints, long low, long high, int nBins)
        {
            TimeSpan[] rawData = new TimeSpan[nDataPoints];
            for (int x = 0; x < nDataPoints; x++)
            {
                rawData[x] = TimeSpan.FromTicks((long)dist.GetNext());
            }

            IHistogram hist = new Histogram1D_TimeSpan(rawData, TimeSpan.FromTicks(low), TimeSpan.FromTicks(high), nBins, "Test Histogram");

            hist.Recalculate();

            int[] bins = (int[])hist.Bins;
            for (int i = 0; i < bins.Length; i++)
            {
                Debug.WriteLine(hist.GetLabel(new int[] { i }) + ", " + bins[i]);
            }
        }
Пример #3
0
        private void _TestDoubleHistogram(IDoubleDistribution dist, int nDataPoints, double low, double high, int nBins)
        {
            double[] rawData = new double[nDataPoints];
            for (int x = 0; x < nDataPoints; x++)
            {
                rawData[x] = dist.GetNext();
            }

            IHistogram hist = new Histogram1D_Double(rawData, low, high, nBins, "Test Histogram");

            hist.LabelProvider = new LabelProvider(((Histogram1D_Double)hist).DefaultLabelProviderWithError);
            hist.Recalculate();

            int[] bins = (int[])hist.Bins;
            for (int i = 0; i < bins.Length; i++)
            {
                Debug.WriteLine(hist.GetLabel(new int[] { i }) + ", " + bins[i]);
            }
        }
Пример #4
0
        public TimeSpan GetNext()
        {
            double d = m_distribution.GetNext();

            return(TimeSpan.FromSeconds(d * m_seconds));
        }
Пример #5
0
 internal void DoService(Customer customer)
 {
     TellerState.ToState(Basic.TellerState.Busy);
     m_model.Executive.CurrentEventController.SuspendFor(TimeSpan.FromMinutes(ServiceTime.GetNext()));
     TellerState.ToState(Basic.TellerState.Idle);
 }