/// <summary> /// Generates the phone calls for the simulation /// </summary> /// <returns> /// The phone calls. /// </returns> /// <param name='context'> /// Context. /// </param> /// <param name='numberOfCalls'> /// Number of calls. /// </param> /// <param name='level1CallTime'> /// Level1 call time. /// </param> /// <param name='level2CallTime'> /// Level2 call time. /// </param> /// <param name='callTimeVariability'> /// Call time variability. /// </param> /// <param name='callStartTimeRange'> /// Call start time range. /// </param> private static IEnumerable <Call> GeneratePhoneCalls(SimulationContext context, int numberOfCalls, int level1CallTime, int level2CallTime, double callTimeVariability, int callStartTimeRange) { var rand = new Random(); List <Call> calls = new List <Call>(); for (int i = 0; i < numberOfCalls; i++) { CallCharacteristics characteristics = new CallCharacteristics(); characteristics.TimeBeforeCallStarts = rand.Next(callStartTimeRange); // for half the calls, force them to be in a peak period in the middle of the range if (i < numberOfCalls / 2) { characteristics.TimeBeforeCallStarts = (int)((characteristics.TimeBeforeCallStarts / 3.0) + (callStartTimeRange / 3.0)); } characteristics.CallDurationAtLevel1 = (int)(level1CallTime + rand.Next((int)(level1CallTime * callTimeVariability)) - ((level1CallTime * callTimeVariability) / 2.0)); characteristics.CallIsEscalatedToLevel2 = (rand.Next(1000) > 500); if (characteristics.CallIsEscalatedToLevel2) { characteristics.CallDurationAtLevel2 = (int)(level1CallTime + rand.Next((int)(level1CallTime * callTimeVariability)) - ((level1CallTime * callTimeVariability) / 2.0)); } var newCall = new Call(characteristics); calls.Add(newCall); } return(calls); }
/// <summary> /// Generates the phone calls for the simulation /// </summary> /// <returns> /// The phone calls. /// </returns> /// <param name='context'> /// Context. /// </param> /// <param name='numberOfCalls'> /// Number of calls. /// </param> /// <param name='level1CallTime'> /// Level1 call time. /// </param> /// <param name='level2CallTime'> /// Level2 call time. /// </param> /// <param name='callTimeVariability'> /// Call time variability. /// </param> /// <param name='callStartTimeRange'> /// Call start time range. /// </param> private static IEnumerable<Call> GeneratePhoneCalls(SimulationContext context, int numberOfCalls, int level1CallTime, int level2CallTime, double callTimeVariability, int callStartTimeRange) { var rand = new Random(); List <Call> calls = new List<Call>(); for(int i =0;i<numberOfCalls;i++){ CallCharacteristics characteristics = new CallCharacteristics(); characteristics.TimeBeforeCallStarts = rand.Next(callStartTimeRange); // for half the calls, force them to be in a peak period in the middle of the range if (i < numberOfCalls / 2){ characteristics.TimeBeforeCallStarts = (int)((characteristics.TimeBeforeCallStarts/3.0) + (callStartTimeRange / 3.0)); } characteristics.CallDurationAtLevel1 = (int)(level1CallTime + rand.Next((int)(level1CallTime*callTimeVariability)) - ((level1CallTime* callTimeVariability)/2.0)); characteristics.CallIsEscalatedToLevel2 = (rand.Next(1000)>500); if (characteristics.CallIsEscalatedToLevel2){ characteristics.CallDurationAtLevel2 = (int)(level1CallTime + rand.Next((int)(level1CallTime*callTimeVariability)) - ((level1CallTime* callTimeVariability)/2.0)); } var newCall = new Call(characteristics); calls.Add(newCall); } return calls; }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Example.Call"/> class. /// </summary> /// <param name='characteristics'> /// Characteristics that drive behaviour for the call /// </param> public Call(CallCharacteristics characteristics) { Characteristics = characteristics; Statistics = new CallStatistics(); }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Example.Call"/> class. /// </summary> /// <param name='characteristics'> /// Characteristics that drive behaviour for the call /// </param> public Call(SimulationContext context, CallCharacteristics characteristics) : base(context) { Characteristics = characteristics; Statistics = new CallStatistics(); }