Esempio n. 1
0
        public void GetTimeSeriesForCoverageOnLocation()
        {
            var network = CreateNetwork();
            //set up  a coverage on one location for three moments
            INetworkCoverage networkCoverage = new NetworkCoverage {
                Network = network, IsTimeDependent = true
            };
            var networkLocation = new NetworkLocation(network.Branches[0], 0);

            for (var i = 1; i < 4; i++)
            {
                networkCoverage[new DateTime(2000, 1, i), networkLocation] = i;
            }

            //filter the function for the networkLocation
            IFunction filteredCoverage = networkCoverage.GetTimeSeries(networkLocation);

            Assert.AreEqual(3, filteredCoverage.Components[0].Values.Count);
            Assert.AreEqual(1, filteredCoverage.Arguments.Count);
            Assert.AreEqual(filteredCoverage.Arguments[0].Values, networkCoverage.Time.Values);
        }
Esempio n. 2
0
        [Test] //TOOLS-6471
        public void GetTimeSeriesForEmptyCoverage()
        {
            var network = CreateNetwork();
            //set up  a coverage on one location for three moments
            INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true };
            
            networkCoverage.Locations.AddValues(new[]
                                                    {
                                                        new NetworkLocation(network.Branches[0], 0),
                                                        new NetworkLocation(network.Branches[0], 100),
                                                        new NetworkLocation(network.Branches[1], 0),
                                                        new NetworkLocation(network.Branches[1], 200)
                                                    });

            var networkLocation = networkCoverage.Locations.Values[0];

            //filter the function for the networkLocation
            var timeseries = networkCoverage.GetTimeSeries(networkLocation);

            Assert.IsNull(timeseries);
        }
Esempio n. 3
0
        public void GetTimeSeriesForCoverageOnCoordinate()
        {
            var network = CreateNetwork();

            //set up  a coverage on one location for three moments
            INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true };
            var networkLocation = new NetworkLocation(network.Branches[0], 0);

            for (int i = 1; i < 4; i++)
            {
                networkCoverage[new DateTime(2000, 1, i), networkLocation] = (double)i;
            }

            //filter the function for the networkLocation
            IFunction filteredCoverage = networkCoverage.GetTimeSeries(networkLocation.Geometry.Coordinate);

            Assert.AreEqual(3, filteredCoverage.Components[0].Values.Count);
            Assert.AreEqual(1, filteredCoverage.Arguments.Count);
            Assert.AreEqual(filteredCoverage.Arguments[0].Values, networkCoverage.Time.Values);
        }
Esempio n. 4
0
        public void GetTimeSeriesForCoverageOnNearestLocationUsingBranchFeature()
        {
            var network = CreateNetwork();
            INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true };

            // set values
            for (var i = 1; i < 4; i++)
            {
                networkCoverage[new DateTime(2000, 1, i), new NetworkLocation(network.Branches[0], 0)] = (double)i;
                networkCoverage[new DateTime(2000, 1, i), new NetworkLocation(network.Branches[0], 50)] = (double)i;
            }

            // create branch feature
            var branchFeature = mocks.Stub<IBranchFeature>();
            branchFeature.Geometry = new Point(0, 25);
            branchFeature.Branch = network.Branches[0];
            branchFeature.Chainage = 25;
            
            // get time series
            var timeSeries = networkCoverage.GetTimeSeries(branchFeature);

            Assert.AreEqual(3, timeSeries.Components[0].Values.Count);
            Assert.AreEqual(1, timeSeries.Arguments.Count);
            Assert.AreEqual(timeSeries.Arguments[0].Values, networkCoverage.Time.Values);
        }