Пример #1
0
        public void TestMethod1()
        {
            var c = new SimContext();

            c.Process(Clock(c, 2.Seconds()));
            c.Process(Clock(c, 3.Seconds()));
            c.Step();
            Assert.True(_val == 2.Seconds().From(new DateTime(0)));
            c.Step();
            Assert.True(_val == 3.Seconds().From(new DateTime(0)));
            c.Step();
            Assert.True(_val == 4.Seconds().From(new DateTime(0)));
            c.Step();
            Assert.True(_val == 6.Seconds().From(new DateTime(0)));
            c.Step();
            Assert.True(_val == 6.Seconds().From(new DateTime(0)));
        }
Пример #2
0
        private IEnumerable <IEvent> CustomerGenerator(double everySeconds, int total)
        {
            for (int i = 0; i < total; i++)
            {
                yield return(new Timeout(_context.Random.Exponential(1 / everySeconds).Seconds()));

                Trace.WriteLine("Generated customer " + i + " at " + _context.Now);
                _context.Process(Customer(i));
            }
        }
Пример #3
0
        public void A()
        {
            _context = new SimContext();
            _counter = new SimpleResource(2);
            _context.Process(CustomerGenerator(2, 100));

            for (int i = 0; i < 30; i++)
            {
                _context.Step();
            }

            //todo
        }