You are on page 1of 5

IRC SIGNAL

DESIGN
USING PYTHON PROGRAMMING

SUBMITTED BY-
SATYA PRAKASH (2023TR15)
GAURAV VISHWAKARMA (2023TR09)
RAJNISH RAJ (2023TR14)
IRC SIGNAL DESIGN USING PYTHON PROGRAMMING
class IRC_signal_design:
#some default values are defined here which is required in this code
later.
pedestrian_walking_speed = 1.2
intial_walking_time = 7.0
amber_time = 2.0
inter_green_time = 2.0
time_first_vehicle = 6.0

#here I'm defining variables for the IRC signal design


def __init__(self,width_road1, width_road2, lanes_road1, lanes_road2,
vol_road1_direction1, vol_road1_direction2,
vol_road2_direction1, vol_road2_direction2):
self.wR1 = width_road1
self.wR2 = width_road2
self.lR1 = lanes_road1
self.lR2 = lanes_road2
self.vR11 = vol_road1_direction1
self.vR12 = vol_road1_direction2
self.vR21 = vol_road2_direction1
self.vR22 = vol_road2_direction2

#traffic signal is designed for highest of approaching volume of each


road
def design_traffic(self):
design_traffic_R1 = max(self.vR11/(self.lR1/2),self.vR12/(self.lR1/2))
design_traffic_R2 = max(self.vR21/(self.lR2/2),self.vR22/(self.lR2/2))
return design_traffic_R1,design_traffic_R2

#Pedestrian green time for any road= (total road width/ walking speed)+
7 sec (initial walking time)
def Pedestrian_crossing_time(self):
P_greentime_R1 = round(self.wR1/1.2 + 7, 2)
P_greentime_R2 = round(self.wR2/1.2 + 7, 2)
return P_greentime_R1,P_greentime_R2

#For minimum greentime for minor road, max of pedestrian time is


considered.
#For minimum greentime for major road, calculate using minor road min
greentime & design traffic.

def Minimum_greentime_traffic(self):
M_greentime_road2 =
max(self.Pedestrian_crossing_time()[0],self.Pedestrian_crossing_time()[1])
M_greentime_road1 =
round(M_greentime_road2*(self.design_traffic()[0]/self.design_traffic()[1]),1)
return M_greentime_road1,M_greentime_road2

#Adding 2 sec for clearing camber and 2 sec for inter green period
def Calculate_cycle(self):
Total_cycle = (self.amber_time + self.Minimum_greentime_traffic()[0] +
self.inter_green_time + self.amber_time + self.Minimum_greentime_traffic()[1]
+ self.inter_green_time)

CycleTime = 0

if Total_cycle % 5 == 0:
CycleTime = Total_cycle
else:
val = 5 - (Total_cycle % 5)
CycleTime = Total_cycle + val

ExtraTime = (CycleTime - Total_cycle)

# adjustment of extra time(cycle time - total cycle) according to the


volume of lanes
z =
(self.design_traffic()[0]/(self.design_traffic()[0]+self.design_traffic()[1]))
Rev_greentime_road1 = round((self.Minimum_greentime_traffic()[0] +
(z * ExtraTime)))
Rev_greentime_road2 = round((self.Minimum_greentime_traffic()[1] +
((1-z) * ExtraTime)))
return Rev_greentime_road1, Rev_greentime_road2, CycleTime

#For calculating the minimum green time required for clearing vehicles for
each lane of approach road, we assume that first vehicle take 6 sec and
remaining will clear at rate of 1PCU in 2 sec.
def ReqMinGreenTime(self):
vehicle_arriving_road1 = (self.design_traffic()[0]/
self.Calculate_cycle()[2])
min_green_time_per_cycle_road1 = self.time_first_vehicle +
(vehicle_arriving_road1 - 1) * 2

vehicle_arriving_road2 = (self.design_traffic()[1]/
self.Calculate_cycle()[2])
min_green_time_per_cycle_road2 = self.time_first_vehicle +
(vehicle_arriving_road2 - 1) * 2

return "Output data are perfectly fine." if


(min_green_time_per_cycle_road1 <= self.Calculate_cycle()[0]) and
(min_green_time_per_cycle_road2 <= self.Calculate_cycle()[1]) else "These
output data needs to be modified."
print('Please enter the values of road having higher volume as Road 1')
w1 = float(input("Enter Width of Road 1 (in meters) : "))
w2 = float(input("Enter Width of Road 2 (in meters) : "))
n1 = int(input("No. of lanes of Road 1 : "))
n2 = int(input("No. of lanes of Road 2 : "))
v1_1 = float(input("Enter First Volume of Road 1 (in PCU/hr) : "))
v1_2 = float(input("Enter Second Volume of Road 1 (in PCU/hr) : "))
v2_1 = float(input("Enter First Volume of Road 2 (in PCU/hr) : "))
v2_2 = float(input("Enter Second Volume of Road 2 (in PCU/hr) : "))

irc = IRC_signal_design(w1,w2,n1,n2,v1_1,v1_2,v2_1,v2_2)

design = irc.design_traffic()
print('Traffic volume of each road for which Signal will design :',design,'in
PCU/hr')

pgt = irc.Pedestrian_crossing_time()
print('Pedestrian crossing time for each road : ',pgt,' in seconds')

mgt = irc.Minimum_greentime_traffic()
print('Minimun greentime for each road : ',mgt,' in seconds')

rgt = irc.Calculate_cycle()[0],irc.Calculate_cycle()[1]
print('Revised greentime for each road : ',rgt,' in seconds')

ct = irc.Calculate_cycle()[2]
print('Cycle time for given data is :',ct,' in seconds')

crosscheck = irc.ReqMinGreenTime()
print(crosscheck)
EXAMPLE-1
INPUT:-
Please enter the values of road having higher volume as Road 1
Enter Width of Road 1 (in meters) : 12
Enter Width of Road 1 (in meters): 6.6
No. of lanes of Road 1 : 4
No. of lanes of Road 2 : 2
Enter First Volume of Road 1 (in PCU/hr): 900
Enter Second Volume of Road 1 (in PCU/hr): 743
Enter First Volume of Road 2 (in PCU/hr): 278
Enter Second Volume of Road 2 (in PCU/hr): 280

OUTPUT:-
Traffic volume of each road for which Signal will design : (450.0, 278.0) in
PCU/hr
Pedestrian crossing time for each road : (17.0, 12.5) in seconds
Minimun greentime for each road : (27.5, 17.0) in seconds
Revised greentime for each road : (29, 18) in seconds
Cycle time for given data is : 55.0 in seconds
Output data are perfectly fine.

EXAMPLE-2
INPUT:-
Please enter the values of road having higher volume as Road 1
Enter Width of Road 1 (in meters) : 14
Enter Width of Road 1 (in meters): 8
No. of lanes of Road 1 : 4
No. of lanes of Road 2 : 2
Enter First Volume of Road 1 (in PCU/hr): 1000
Enter Second Volume of Road 1 (in PCU/hr): 900
Enter First Volume of Road 2 (in PCU/hr): 300
Enter Second Volume of Road 2 (in PCU/hr): 250

OUTPUT:-
Traffic volume of each road for which Signal will design : (500.0, 300.0) in
PCU/hr
Pedestrian crossing time for each road : (18.67, 13.67) in seconds
Minimun greentime for each road : (31.1, 18.67) in seconds
Revised greentime for each road : (32, 20) in seconds
Cycle time for given data is : 60.0 in seconds
Output data are perfectly fine.

You might also like