def mainroad_newveh(self, vehid, *args): cf_p, lc_p = IDM_parameters() kwargs = { 'route': ['exit'], 'maxspeed': cf_p[0] - 1e-6, 'relax_parameters': 15, 'shift_parameters': [-1.5, 1.5] } self.newveh = hs.Vehicle(vehid, self, cf_p, lc_p, **kwargs)
def mainroad_newveh(self, vehid, *args): cf_p, lc_p = IDM_parameters() kwargs = { 'route': ['exit'], 'maxspeed': cf_p[0] - 1e-6, 'relax_parameters': 8.7, 'shift_parameters': [-2, 2], 'hdbounds': (cf_p[2] + 1e-6, 1e4) } self.newveh = hs.Vehicle(vehid, self, cf_p, lc_p, **kwargs)
platoon=platoon, speed_limit=[0, 50], show_ID=False) #%% havsim.plotting.animatetvhd(meas, None, platooninfo, [998, 1013]) #%% FD plots import havsim.simulation as hs from havsim.simulation.simulation_models import OVMVehicle import math import numpy as np import matplotlib.pyplot as plt from havsim.simulation.models import IDM_parameters #IDM spd-hd, flow-density cf_p, unused = IDM_parameters() tempveh = hs.Vehicle(-1, None, cf_p, None, maxspeed=cf_p[0] - 1e-6) spds = np.arange(0, cf_p[0], .01) hds = np.array([tempveh.get_eql(i, input_type='v') for i in spds]) fig, ax = plt.subplots() plt.plot(hds, spds, 'C0') plt.ylabel('speed (m/s)') plt.xlabel('headway (m)') flows = np.array([tempveh.get_flow(i) for i in spds]) density = np.divide(flows, spds) fig, ax2 = plt.subplots() plt.plot(density * 1000, flows * 3600) plt.ylabel('flow (veh/hr)') plt.xlabel('density (veh/km)')