## 如何在静态模型中按车辆类别定义限速

#### 在某些情况下，限速可以根据车辆类型而不同；例如，在英国的单车道公路上，7.5吨以上的车辆只能以每小时50英里的速度行驶，但其它车辆可以每小时60英里的速度行驶。 你可以在宏观模型的延迟函数中进行编码，或者通过使用微观和中观模型的交通管理进行编码，如第一部分所解释的。

```				```
vehicle = context.userClass.getVehicle()
```
```

```				```
SectionSpeed=section.getSpeed()
```
```

```				```
NbLanes=section.getNbFullLanes()
```
```

```				```
def freeFlowTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
vehicleName = context.userClass.getVehicle().getName()
SectionSpeed=section.getSpeed()
NbLanes=section.getNbFullLanes()
if vehicleName==”HGV” and SectionSpeed==96 and NbLanes==1: #If its a HGV on a single carriageway road with a 96kph/60mph limit
speed=80
else:
speed=SectionSpeed
distance=section.length3D() / 1000.0          # Km
t0 = distance/speed                                 # hour
return t0
```
```

```				```
def freeFlowVehicleTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
vehicleName = context.userClass.getVehicle().getName()
SectionSpeed=section.getSpeed()
NbLanes=section.getNbFullLanes()
if vehicleName==”HGV” and SectionSpeed==96 and NbLanes==1: #If its a HGV on a single carriageway road with a 96kph/60mph limit
speed=80
else:
speed=SectionSpeed
distance=section.length3D() / 1000.0          # Km
t0 = distance/speed                                 # hour
return t0
def freeFlowTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
speed=SectionSpeed
distance=section.length3D() / 1000.0          # Km
t0 = distance/speed                                 # hour
return t0
def vdf( context, section, funcVolume ):
#coefficients alpha and beta must be modified accordingly
alpha = 0.15
beta = 4.0
freeFlowVehicleTravelTime = freeFlowVehicleTravelTime(context, section, funcVolume)
freeFlowTravelTime=freeFlowTravelTime(context, section, funcVolume)
volume = funcVolume.getVolume()
capacity = section.getCapacity()
cost = max(freeFlowTravelTime * (1 + alpha * ((volume + addVolume) / capacity ) ** beta), freeFlowVehicleTravelTime)
return cost
```
```

### 路网配置第1部分 – 工作流程

2015年12月：Andreu Tarrida向您介绍关于“路网配置”功能的四部分系列的第1部分，这篇注解介绍了这个主题，并让你简单了解了工作流程。