Beispiel #1
0
        public void PrintResult()
        {
            Console.WriteLine("\n-------------RESULTS-------------");
            double sumFailure      = 0.0;
            double creatorQuantity = 0.0;

            foreach (Element e in list)
            {
                e.PrintResult();
                Console.WriteLine();
                if (e.GetType() == typeof(AutoBankMassServiceSystem))
                {
                    AutoBankMassServiceSystem p = (AutoBankMassServiceSystem)e;
                    Console.WriteLine("Name        Average loading         Dispose interval average        Average queue");
                    Console.WriteLine(p.Name + "    " + (long)p.DeltaTR / p.FinishTime + "       " + p.DisposeIntervalSum / p.Quantity + "         " + p.SumQueue / systemChangeCount);
                    Console.WriteLine();
                    sumFailure = sumFailure + p.Failure;
                }
                else
                {
                    creatorQuantity = e.Quantity;
                }
            }
            Console.WriteLine("Average bank clients count: " + GetAverageClientsCount(list) / systemChangeCount);
            Console.WriteLine("Percent of failure: " + (sumFailure * 100) / creatorQuantity);
            Console.WriteLine("Change line count: " + changeLineCount);
        }
Beispiel #2
0
        override public void OutAct()
        {
            SetTCurrForChannels();
            base.OutAct();
            GetChannelByTNext().OutAct();

            base.TNext = GetTNext();

            if (CheckFreeChannels() == true)
            {
                base.State = 0;
            }

            if (this.Queue > 0 && CheckFreeChannels() == true)
            {
                Queue--;
                GetFreeChannel().InAct();
                if (CheckFreeChannels() == false)
                {
                    base.State = 1;
                }
                base.TNext = GetTNext();
            }

            if (NextMss.Count > 0)
            {
                Random random = new Random();
                int    index  = 0;
                if (NextDespose)
                {
                    index = random.Next(0, NextMss.Count + 1);
                }
                else
                {
                    index = random.Next(0, NextMss.Count);
                }

                if (index == NextMss.Count)
                {
                    DisposeIntervalSum = DisposeIntervalSum + (TCurr - LastDispose);
                    LastDispose        = TCurr;
                    Console.WriteLine("--------Dispose--------");
                }
                else
                {
                    AutoBankMassServiceSystem nextProcess = NextMss[index];
                    nextProcess.InAct();
                }
            }
            else
            {
                DisposeIntervalSum = DisposeIntervalSum + (TCurr - LastDispose);
                LastDispose        = TCurr;
                Console.WriteLine("--------Dispose--------");
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            AutoBankCreate create = new AutoBankCreate(0.5)
            {
                Name = "Creator"
            };

            AutoBankMassServiceSystem window1 = new AutoBankMassServiceSystem(0.3)
            {
                Name         = "Window1",
                NextDespose  = true,
                Maxqueue     = 3,
                Distribution = "exp",
            };
            AutoBankMassServiceSystem window2 = new AutoBankMassServiceSystem(0.3)
            {
                Name         = "Window2",
                NextDespose  = true,
                Maxqueue     = 3,
                Distribution = "exp",
            };

            window1.Channels = new List <Channel>
            {
                new Channel
                {
                    Name = "Cashier1"
                }
            };
            window2.Channels = new List <Channel>
            {
                new Channel
                {
                    Name = "Cashier2"
                }
            };

            create.NextElements.Add(window1);
            create.NextElements.Add(window2);

            List <Element> list = new List <Element> {
                create, window1, window2
            };
            AutoBankModel model = new AutoBankModel(list);

            model.Simulate(1000.0);
        }