Exemple #1
0
        public void DetectorRequestRedNonGuaranteed_PresenceSetToTrue_RequestAfterRedGuaranteedDone()
        {
            var c    = ControllerProvider.GetsimpleController1();
            var m    = new ControllerManager(c);
            var sg02 = c.SignalGroups.First(x => x.Name == "02");
            var d021 = sg02.Detectors.First(x => x.Name == "021");

            m.ExecuteStep(100);
            d021.Presence = true;
            m.ExecuteStep(2000);

            Assert.IsTrue(sg02.HasGreenRequest);
        }
Exemple #2
0
        public void DetectorWithOccupiedTimerZero_PresenceSetToTrue_SetsRequestOnNextStep()
        {
            var c    = ControllerProvider.GetsimpleController1();
            var m    = new ControllerManager(c);
            var sg02 = c.SignalGroups.First(x => x.Name == "02");
            var d021 = sg02.Detectors.First(x => x.Name == "021");

            m.ExecuteStep(5000);
            d021.Presence = true;
            m.ExecuteStep(1);

            Assert.IsTrue(sg02.HasGreenRequest);
        }
Exemple #3
0
        public void DetectorWithOccupiedTimerNonZero_PresenceSetToTrue_NoRequestBeforeOccupiedTimerEnd()
        {
            var c    = ControllerProvider.GetsimpleController1();
            var m    = new ControllerManager(c);
            var sg02 = c.SignalGroups.First(x => x.Name == "02");
            var d021 = sg02.Detectors.First(x => x.Name == "021");

            d021.OccupiedTimer.SetMaximum(3, TimerTypeEnum.Seconds);

            m.ExecuteStep(5000);
            d021.Presence = true;
            m.ExecuteStep(2999);

            Assert.IsFalse(sg02.HasGreenRequest);
        }
Exemple #4
0
        public void DuurtestController1_4Controllers1HourPerController2_NoMaxWaitingTimeExceeded()
        {
            var fault = false;
            var dts   = new List <Thread>(4);

            for (var i = 0; i < 4; ++i)
            {
                var i1 = i;
                dts.Add(new Thread(() =>
                {
                    var c = ControllerProvider.GetsimpleController1();
                    var m = new ControllerManager(c);
                    var s = new SimpleControllerSim(c, 42 + 4 + i1);
                    c.MaximumWaitingTimeExceeded += (o, e) => fault = true;
                    s.SimulationInit(c.Clock.CurrentTime);
                    for (long i2 = 0; i2 < 36000; ++i2)
                    {
                        s.SimulationStep(100);
                        m.ExecuteStep(100);
                    }
                }));
            }

            dts.ForEach(x => x.Start());
            dts.ForEach(x => x.Join());

            Assert.IsFalse(fault);
        }