用于epa移动项目级分析的简单python工具
movesp的Python项目详细描述
movespy简化了与 MOVES和用于项目级分析的交通微观模拟。
安装
下载installer并运行它。
同时编辑movespy_settings.py文件:
- ^{tt4}$: a string that is the path to you MOVES installation directory
- ^{tt5}$: a string that is the name of your MOVES database (assumed to be local)
用法
以下代码 执行完整的移动运行并计算总的CO排放量:
>>> links = {1: {'grade': -1.2, ... 'length': 0.25, ... 'road_type': 5, ... 'source_distr': {21: 1.0}, ... 'speed': 34, ... 'volume': 400}} >>> activity = {'age_distr': {21: {5: 1.0}}, ... 'county': 50027, ... 'day_type': 5, ... 'hour': 16, ... 'month': 6, ... 'year': 2015, ... 'links': links} >>> options = {'detail': 'average'} >>> import movespy.moves >>> moves = movespy.moves.Moves(activity, options) >>> emissions_out = moves.run() running MOVES ... >>> total_CO = sum([row['quantity'] for row in emissions_out if row['pollutant'] == 2]) >>> print total_CO 102.772
此代码计算车辆轨迹的VSP和工作模式 数据集:
>>> veh = [1,1,1,1,2,2,2,3,3,3,3,3] >>> speed = [3.,6.,1.,3.,8.,5.,6.,3.,9.,1.,3.,9.] >>> grade = [1.,2.,-3.,1.,2.,1.,3.,1.,-2.,3.,-4.,-2.] >>> mass, mass_factor, alpha, beta, gamma = 2., 1.5, 0.16, 0.0020, 0.00049 >>> import movespy.trajectory >>> vsp, opmode = movespy.trajectory.getVSPOpMode(veh, speed, grade, mass, ... mass_factor, alpha, beta, gamma) >>> print vsp[:3] [ 0.1462389 5.79980985 -1.45965811] >>> print opmode[:3] [12 13 0]
有关详细说明和示例,请参见user manual。