Microscopic Traffic Simulator

- Main Page
- Packages
- Classes
- Files

- File List

CellularTopologyBuilder.cs
Go to the documentation of this file.
1 using Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.GeneralParameters;
2 using Microscopic_Traffic_Simulator___Model.GeometricObjects;
3 using Microscopic_Traffic_Simulator___Model.GeometricObjects.Lanes;
4 using Microscopic_Traffic_Simulator___Model.GeometricObjects.Nodes;
5 using Microscopic_Traffic_Simulator___Model.TrafficObjects;
6 using System.Windows;
7
8 namespace Microscopic_Traffic_Simulator___Model.CellularTopologyObjects
9 {
13 class CellularTopologyBuilder
14 {
18 private GeometricTopology geometricTopology;
19
23 private CellularTopologyParameters cellularTopologyParameters;
24
31 internal CellularTopologyBuilder(GeometricTopology geometricTopology,
32 CellularTopologyParameters cellularTopologyParameters)
33 {
34 this.geometricTopology = geometricTopology;
35 this.cellularTopologyParameters = cellularTopologyParameters;
36 }
37
41 internal void Build()
42 {
43 foreach (Lane lane in geometricTopology.Lanes)
44 {
45 Cell previousCell = null;
46 int cellCounter = 0;
47 foreach (Point lanePoint in lane.LanePoints(cellularTopologyParameters.P1_CellLength))
48 {
49 Cell cell = new Cell(lanePoint);
50 if (previousCell == null)
51 {
52 if (lane.StartNode.ContainsGenerator)
53 {
54 Generator generator = lane.StartNode.Generator;
55 generator.ConnectedCell = cell;
56 }
57 }
58 else
59 {
60 if (cellCounter == 100)
61 {
62 Sensor sensor = (lane.InnerNodes[0] as SensorNode).Sensor;
63 sensor.ConnectedCell = cell;
64 cell.Sensor = sensor;
65 }
66 previousCell.FollowingCell = cell;
67 cell.PreviousCell = previousCell;
68 previousCell.NormalizedDirectionVector = cell.Location - previousCell.Location;
69 }
70 previousCell = cell;
71 cellCounter++;
72 }
73 }
74 }
75 }
76 }
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.Cell.NormalizedDirectionVector
Vector NormalizedDirectionVector
Normalized direction vector.
Definition: Cell.cs:28
Microscopic_Traffic_Simulator___Model.GeometricObjects.GeometricTopology
Class representing geometric topology of road network.
Definition: GeometricTopology.cs:14
Microscopic_Traffic_Simulator___Model.GeometricObjects.Nodes
Definition: EndNode.cs:4
System
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.Cell
Class representing cell.
Definition: Cell.cs:9
Microscopic_Traffic_Simulator___Model.TrafficObjects.Generator
Represents generator of cars.
Definition: Generator.cs:13
Microscopic_Traffic_Simulator___Model.GeometricObjects.Lanes.Lane.StartNode
StartNode StartNode
Node on the input end of lane.
Definition: Lane.cs:23
Microscopic_Traffic_Simulator___Model.TrafficObjects.Sensor
Class representing sensor.
Definition: Sensor.cs:14
Microscopic_Traffic_Simulator___Model.GeometricObjects.Nodes.SensorNode
Node containing sensor.
Definition: SensorNode.cs:11
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.CellularTopologyBuilder
Class for building cellular topology from geometric topology.
Definition: CellularTopologyBuilder.cs:13
Microscopic_Traffic_Simulator___Model.TrafficObjects
Definition: Generator.cs:7
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.Cell.Location
Point Location
Location of cell.
Definition: Cell.cs:18
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.GeneralParameters.CellularTopologyParameters
Class containing parameters related to cellular topology.
Definition: CellularTopologyParameters.cs:9
Microscopic_Traffic_Simulator___Model.GeometricObjects.Nodes.StartNode.Generator
Generator Generator
Generator connected to node.
Definition: StartNode.cs:16
Microscopic_Traffic_Simulator___Model.GeometricObjects.GeometricTopology.Lanes
ReadOnlyCollection< Lane > Lanes
Lanes in geometric topology. </summary
Definition: GeometricTopology.cs:23
Microscopic_Traffic_Simulator___Model.GeometricObjects.Lanes.Lane
Represent single lane.
Definition: Lane.cs:14
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.GeneralParameters
Definition: CellularTopologyParameters.cs:3
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.GeneralParameters.CellularTopologyParameters.P1_CellLength
double P1_CellLength
Cell length parameter.
Definition: CellularTopologyParameters.cs:14
Microscopic_Traffic_Simulator___Model.GeometricObjects.Lanes.Lane.InnerNodes
ReadOnlyCollection< InnerNode > InnerNodes
Inner nodes on the lane.
Definition: Lane.cs:41
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects
Definition: Car.cs:6
Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.Cell.PreviousCell
Cell PreviousCell
Link to previous cell.
Definition: Cell.cs:48
Microscopic_Traffic_Simulator___Model.GeometricObjects.Lanes
Definition: BezierLane.cs:5
Microscopic_Traffic_Simulator___Model.GeometricObjects
Definition: GeometricTopology.cs:8
Microscopic_Traffic_Simulator___Model
Microscopic_Traffic_Simulator___Model.GeometricObjects.Nodes.StartNode.ContainsGenerator
bool ContainsGenerator
Determines whether the node contains generator.
Definition: StartNode.cs:21