Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/traffic_engineering.py @ 1262:f10e84505443
modif for highway level of service
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 17 Apr 2024 16:46:23 -0400 |
parents | 3bfdb2ffd29d |
children |
comparison
equal
deleted
inserted
replaced
1261:28aeec1f2788 | 1262:f10e84505443 |
---|---|
237 volumes = [v/(1+(etrucks-1)*p/100) for v,p in zip(volumes, hgvProportions)] | 237 volumes = [v/(1+(etrucks-1)*p/100) for v,p in zip(volumes, hgvProportions)] |
238 else: | 238 else: |
239 hgvProportions = None | 239 hgvProportions = None |
240 return speeds, volumes, hgvProportions | 240 return speeds, volumes, hgvProportions |
241 | 241 |
242 higwayMaxDensityLOS = {'A':7, 'B':11, 'C':16, 'D':22, 'E': 28} | |
243 | |
242 def highwayLOS(k): | 244 def highwayLOS(k): |
243 'returns the highway level of service for density k in veh/km' | 245 'returns the highway level of service for density k in veh/km' |
244 if k>=28: return 'F' | 246 for los, kmax in higwayMaxDensityLOS.items(): |
245 elif k>=22: return 'E' | 247 if k<kmax: return los |
246 elif k>=16: return 'D' | 248 return 'F' |
247 elif k>=11: return 'C' | 249 |
248 elif k>=7: return 'B' | |
249 else: return 'A' | |
250 | |
251 ######################### | 250 ######################### |
252 # intersection | 251 # intersection |
253 ######################### | 252 ######################### |
254 | 253 |
255 class FourWayIntersection(object): | 254 class FourWayIntersection(object): |