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); } }
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]); } }
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]); } }
public TimeSpan GetNext() { double d = m_distribution.GetNext(); return(TimeSpan.FromSeconds(d * m_seconds)); }
internal void DoService(Customer customer) { TellerState.ToState(Basic.TellerState.Busy); m_model.Executive.CurrentEventController.SuspendFor(TimeSpan.FromMinutes(ServiceTime.GetNext())); TellerState.ToState(Basic.TellerState.Idle); }