Пример #1
0
 private void GetFlowConservationList()
 {
     NodeFlowConservations.Clear();
     GetPhysicalNodes();
     foreach (int n in PhysicalNodes)
     {
         NodeFlowConservation nodeConservation = new NodeFlowConservation();
         GetNodeConservation(n, nodeConservation);
         NodeFlowConservations.Add(nodeConservation);
     }
 }
Пример #2
0
        private void GetNodeConservation(int node, NodeFlowConservation nodeConservation)
        {
            nodeConservation.Node = node;
            List <int> ConnectedLinks = new List <int>();
            double     LinkFlow       = 0;
            double     ODFlow         = 0;

            foreach (LinkResult result in UEresults[TimePeriodIndex].LinkResults)
            {
                if (result.PhysLink == true)
                {
                    if (result.FromNode == node)
                    {
                        nodeConservation.ConnectedLinks.Add(result.ID);
                        LinkFlow -= result.Volume;
                    }
                    else if (result.ToNode == node)
                    {
                        nodeConservation.ConnectedLinks.Add(result.ID);
                        LinkFlow += result.Volume;
                    }
                }
            }
            nodeConservation.FlowLink = LinkFlow;
            int numZones      = (FirstPhysicalNode - 1) / 2;
            int connectedZone = 0;

            foreach (FreewayData link in FreewayFacilities)
            {
                if (link.FromNode == node || link.ToNode == node)
                {
                    if (link.FromNode <= numZones || link.ToNode <= numZones)
                    {
                        if (link.FromNode <= numZones)
                        {
                            nodeConservation.Type = 1; //1: OD node
                            connectedZone         = link.FromNode;
                            break;
                        }
                        else if (link.ToNode <= numZones)
                        {
                            nodeConservation.Type = 1; //1: OD node
                            connectedZone         = link.ToNode;
                            break;
                        }
                    }
                }
            }
            if (nodeConservation.Type == 1)
            {
                foreach (ODdata od in ODs)
                {
                    if (od.OrigZone == connectedZone || od.DestZone == connectedZone)
                    {
                        int[] zonePair = new int[2];
                        zonePair[0] = od.OrigZone;
                        zonePair[1] = od.DestZone;
                        nodeConservation.ConnectedZones.Add(zonePair);
                        if (od.OrigZone == connectedZone)
                        {
                            ODFlow -= od.NumTrips;
                        }
                        else
                        {
                            ODFlow += od.NumTrips;
                        }
                    }
                }
            }
            nodeConservation.FlowOD = ODFlow;
        }