In: Computer Science
Dilemma zone is a real world problem existed at signalized intersections. The zone boundary is defined by two measures, maximum passing distance (Xp) and minimum stopping distance (Xs). Xp is the maximum distance that the driver travels from the onset of yellow light to clear the intersection. Xs is the minimum distance that the driver brings the vehicle to a complete stop at or before the stop line. If Xs>Xp, the dilemma zone type I is presented where the driver at this zone has no option. If the driver decides to go, will run red light violating the traffic signal. If deciding to stop, the driver would stop the vehicle after the stop line, again violating the traffic rules. The vehicle at this zone should be Xs> vehicle distance to stop line> Xp If Xp>Xs, Option zone is presented where the driver at this zone has two options either to go or stop but they are equal which caused a hesitation for the driver. This hesitation delays the decision taken by the driver. The vehicle at this zone should be Xp> vehicle distance to stop line> Xs. Xs and Xp is described by the following equations: Xp= 0.278VY+ 0.5a(Y-t) 2 Xs= 0.278Vt+ (0.278V) 2 / 2d Where, V= Vehicle’s speed at the yellow light onset in km/h. Y= Yellow interval in seconds assumed 3s. a= Acceleration in meter per squared second, assumed, 0 m/s2 t= Perception reaction time in seconds, assumed 1s d= Deceleration in meter per squared second, assumed, 5 m/s2. 1- You are asked to create a script file in MATLAB that graphs these two equations at the same plot with distance to stop line on x-axis and speed on y-axis including labels. Note: the speed must be ranging from 40 to 110 km/h increasing at 10 km/h. (5 pints) 2- Given the vehicle speed, 50 km/h and the distance to stop line, 36 m at the yellow light onset, plot this point at the same figure and identify whether or not in dilemma zone and which type; type I or option zone. Note: write the answer in the script file as documented line. (2.5 Points) 3- Given the vehicle speed, 100 km/h and the distance to stop line, 95 m at the yellow light onset, plot this point at the same figure and identify whether or not in dilemma zone and which type; type I or option zone. Note: write the answer in the script file as documented line. (2.5 Points)
The code has been written in Matlab with the required comments.
%%
%1
%The velocity sequence
V = 110:-10:40;
% Maximum distance for travel once yellow
% light onsets to clear intersection
Xp = 0.278*V*3 + 0.5*0*(3-1)^2;
% Minimum Stopping distance
Xs = 0.278*V*1 + (0.278*V).^2/(2*5);
f = figure();
%Plot for both lines
plot(Xp,V,'b-',Xs,V,'r-');
% legend for the graph
% Limit of the Velocity axis
ylim([40,110]);
hold on;
% 2
plot(36,50,'*');
text(36,50,"Option Zone (Q2)");
hold on;
% Answer : The point lies in the range for Xp>Point>Xs.
% Thus according to the definition, the point lies in the dilemma zone
% specifically the option zone.
%3
plot(95,100,'*');
text(95,100,"Type I zone (Q3)");
% Answer: The point lies in the region for Xs>Point>Xp.
% Thus according to the definition, the point lies in the dilemma zone
% specifically the type I zone.
legend("Intersection clearance distance","Maximum Stopping Distance");
grid on;
title("Dilemma Zone graph");
xlabel("Distance to stop line (m)");
ylabel("Velocity (km/h)");