## 4 Analysis
### Cellular Automata Model for Dar es Salaam Port Traffic Flow
#### 4.2.4 Solving the Equations and Results  
Using the above equations, the traffic flow is simulated. Below is a process and the corresponding results:  
Initialization:  
A truck is placed at position \(x_{1}\) = 150 cells (1.125 km) with an initial speed of \(v_{1}(0)\) = 4 cells per time step  
A car is placed at \(x_{2}\) =160 cells (1.2 km) with \(v_{2}(0)\) = 100 cells per time step  
Acceleration:  
In the next time step, both the truck and car attempt to accelerate by 1 cell per time step:  
\(v_{1}\;(1)=min(4+1,8)=5(truck^{\prime}s\;updated\;speed)\)  
\(v_{2}\;(1)=min(10+1,14)=11(car^{\prime}s\;updated\;speed)\)  
Deceleration (if the gap between the truck and the car closes):  
Suppose the car is now close to the truck with only 6 cells between them. The car will decelerate to avoid a collision:  
\(v_{2}\;(1)=min(11,6)=6(car\;decelerates)\)  
Random Slowdown:  
If the road condition worsens, with probability \(p\) = 0.3, the truck randomly slows down:  
\(v_{1}\;(1)=max(5-1,0)=4(truck\;slows\;down\;randomly\;due\;to\;road\; conditions)\)  
Movement:  
The truck moves to a new position:  
\(x_{1}\;(1)=150+4=154(truck^{\prime}s\;new\;position)\)  
The car moves to a new position:  
\(x_{2}\;(1)=160+6=166(car^{\prime}s\;new\;position)\)  
Results from the Simulation:  
After running the simulation, the following results were obtained:  
1. Average Travel Times:* Heavy trucks: The average travel time for trucks over the 20 km stretch is 45 min, primarily due to delays caused by random slowdowns, poor road conditions, and the presence of construction zones.
* Cars and smaller trucks: The average travel time is 30 min, though frequent lane changes to overtake slower trucks contribute to stop-and-go traffic.  
2. Traffic Density and Congestion:
* Traffic density peaked at 200 vehicles per km in the first 5 km (near the port entrance) where congestion from loading trucks and poor infrastructure is the highest.
* In sections with construction zones, the density increased further, creating significant bottlenecks.  
3. Stop-and-Go Traffic and Jams:
* Stop-and-go waves were observed in sections with high random slowdowns (due to potholes or bad weather). These waves created traffic jams up to 500 m long, especially near construction areas and intersections.  
4. Lane-Changing Behavior:
* Lane changes occurred frequently in areas where the road had two lanes. On average, vehicles changed lanes 2 times per km, with most changes happening as cars attempted to pass slower trucks.  
5. Impact of Environmental Factors:
* During the rainy season, travel times increased by an average of 10 min for both trucks and smaller vehicles due to increased random slowdowns (from \(p=0.3\)\(p=0.3\)\(p=0.3\) to \(p=0.5\)\(p=0.5\)).
* Accidents and flooded roads further reduced the road capacity by 20%, exacerbating delays.  
The cellular automata model, incorporating Dar es Salaam Port-specific data and the environmental challenges typical of African ports, effectively captures the dynamics of traffic flow, congestion, and delays. The simulation results highlight key areas where infrastructure improvements, better traffic management, and weather-related adaptations could significantly reduce congestion and improve cargo transit times.