Esempio n. 1
0
        public void MoveInTimeTest2()
        {
            SinkSourceBoundary b1 = new SinkSourceBoundary(100);

            b1.WaterSample = new WaterPacket(1, 1);

            SinkSourceBoundary b2 = new SinkSourceBoundary(300);

            b2.WaterSample = new WaterPacket(2, 1);

            var Network = NetworkBuilder.CreateSortedYBranch(5, b1, b2);

            Model target = new Model();

            target._waterBodies.AddRange(Network.Cast <IWaterBody>());


            DateTime Start    = new DateTime(2010, 1, 1);
            DateTime End      = new DateTime(2010, 1, 3);
            TimeSpan TimeStep = new TimeSpan(1, 0, 0, 0);

            target.SetState("Initial", Start, new WaterPacket(1));
            target.MoveInTime(End, TimeStep);
            Assert.AreEqual(Network.First().Output.Outflow.Items.Last().Value * 4, Network.Last().Output.Outflow.Items.Last().Value, 0.0001);
            Assert.AreEqual(End, Network.First().CurrentTime);

            Assert.AreEqual(0.25, Network.Last().CurrentStoredWater.Composition[b1.WaterSample.Composition.Keys.First()], 0.0001);
            Assert.AreEqual(0.75, Network.Last().CurrentStoredWater.Composition[b2.WaterSample.Composition.Keys.First()], 0.0001);
        }