itstools.connectv2x package

Submodules

itstools.connectv2x.carfollow module

Car following model

class itstools.connectv2x.carfollow.CarFollowLaw(x0: float, v0: float, l0: float, veh_type: str = 'HDV', veh_lead=None, behavior: str = None, **kwargs)[source]

Bases: itstools.connectv2x.vehicles.Vehicle

Generic Car Following Behavior

property T

Reaction time

a
a_t
control
property dv

Determine current delta of speed

idx
property k_x

Jam density

l_t
register_control_speed(control)[source]

This registers an external control signal into the vehicle behavior

property s

Determine current spacing (X_n-1 - X_n)

property s0

Minimum spacing

set_traffic(**kwargs)[source]
step_evolution(control: float = 0) → None[source]

Use this method to a single step in the simulation

type
property u

Free flow speed

v_t
property vd

Vehicle desired speed

property vl

Leader speed

property w

Shockwave speed

x_t
property xl

Leader position

class itstools.connectv2x.carfollow.IDM(x0: float, v0: float, veh_lead=None, **kwargs)[source]

Bases: itstools.connectv2x.carfollow.CarFollowLaw

Intelligent Driver’s Model Car Following

property a_max

Comfortable decceleration

acel(vd) → float[source]

Vehicle acceleration

property b

Comfortable decceleration

break_strategy() → float[source]

BS: v * dv / (2 (a*b)^(1/2))

car_following(vd: float) → None[source]

Acceleration car following

Note:
if leader

min(cong_acc, free_acc) -> Tampere

else

manual acceleration

property delta

Acceleration exponent

property s0

Minimum distance

s_d() → float[source]

s0 + max(vT+BS)

set_parameters(a_max=3, b=1.67, delta=4) → None[source]

Set default parameters

t1(vd: float = 25) → float[source]

(v/vd)^d

t2() → float[source]

(sd(v,dv)/s)^2

class itstools.connectv2x.carfollow.Tampere(x0: float, v0: float, veh_type: str, l0: float = 0, veh_lead=None, **kwargs)[source]

Bases: itstools.connectv2x.carfollow.CarFollowLaw

Tampere Car Following Model

acel() → float[source]

Acceleration term

property c1

Speed difference coefficient

property c2

Spacing coefficient

property c3

Tampere coefficient

car_following() → None[source]

Acceleration car following

Note:
if leader

min(cong_acc, free_acc) -> Tampere

else

manual acceleration

cong_acc() → float[source]

Breaking term c_1 (D V) + c_2 (s - s_d)

free_acc() → float[source]

Acceleration term (Tampere) c_3 (v_d - v)

property s_d

Determine desired spacing (d + gamma * v )

set_parameters(c1=0.5, c2=0.5, c3=0.5) → None[source]

Set default parameters

itstools.connectv2x.connectv2x module

Main module.

itstools.connectv2x.controller module

itstools.connectv2x.demand module

Demand Generator

class itstools.connectv2x.demand.Demand(flow_values_vh=2880.0, flow_duration_m=1, sim_time: int = 12)[source]

Bases: object

Demand for a single link not lane

compute_headwayspace(flow_vh, time_min) → numpy.array[source]

Find headway space from a time gap

compute_x0(flow_vh, time_min) → numpy.array[source]

Find intial positions for vehicles

create_demand_pattern()[source]
find_times_exponential(flow_vh: float = 60, time_min: int = 1) → numpy.array[source]

Find the times of emission of x vehicles

plot_demand_elements() → None[source]

A plot to illustrate the demand behavior created

class itstools.connectv2x.demand.TrafficDemand(lks: tuple = 0, demands: tuple = Demand(2880.0, 1))[source]

Bases: collections.abc.MutableMapping

Demand for a traffic network

itstools.connectv2x.messages module

Sent messages

class itstools.connectv2x.messages.Msg1(distance)[source]

Bases: object

Creates a random message 1 for a vehicle

class itstools.connectv2x.messages.Msg2(distance)[source]

Bases: object

Creates a random message 2 for a vehicle

itstools.connectv2x.messages.msg_pls(x, delay)[source]

Sent message to specific CAV vehicle (Pulse) Initial speed: 25 m/s Drop: 7m/s Position: 14Km Span: 400m

itstools.connectv2x.messages.msg_spd(x, delay)[source]

Sent message to specific CAV vehicle Initial speed: 25 m/s Drop: 7m/s Position: 14Km Span: 400m

itstools.connectv2x.network module

itstools.connectv2x.plottools module

itstools.connectv2x.plottools.get_mapper(data_mapper)[source]

Color mapper

itstools.connectv2x.plottools.plot_histogram(data_x, var_name=None)[source]

Plots histogram of data

itstools.connectv2x.plottools.plot_multiple_trajectories(data_x, data_y, data_color, title=None, xlabel=None, ylabel=None, x_range=0, 800, y_range=0, 20000)[source]

Draw multiple trajectories

itstools.connectv2x.plottools.plot_single_trace(data_x, data_y, title=None, xlabel=None, ylabel=None, p_height=500, p_width=500)[source]

Plots a single trace

itstools.connectv2x.plottools.plot_single_trajectory(p, x, y, c, mapper, size=2)[source]

Daraws a single trajectory

itstools.connectv2x.plottools.plot_stairs(data_x, data_y, title=None, xlabel=None, ylabel=None)[source]

Plot stairs plot

itstools.connectv2x.plottools.plot_xva(time, x, v, a, y_range, titles)[source]

Plots all trajectories pos, speed acceleration

itstools.connectv2x.plottools.post_decoration(p, mapper, xlabel, ylabel)[source]

add colorbar + labels

itstools.connectv2x.simulatorinf2veh module

Main module.

itstools.connectv2x.support module

Support functionalities

itstools.connectv2x.support.acceleration_pulse(x, v0=25, drop: float = 1, delay: int = 250, duration: float = 1000)[source]

Create a decreasing acceleration pulse

itstools.connectv2x.support.deriv_pulse_sigmoid(x, A: float = 1, a: float = 50, d: int = 250, duration: float = 1000)[source]

Sigmoid pulse derivative

itstools.connectv2x.support.deriv_sigmoid(x, A: float = 1, a: float = 50, d: int = 250)[source]

Sigmoid derivative function

itstools.connectv2x.support.pulse_sigmoid(x, A: float = 1, d: int = 250, duration: float = 1000)[source]

Sigmoid pulse minimum duration 1000 meters

itstools.connectv2x.support.sigmoid(x, A: float = 1, a: float = 50, d: int = 250)[source]

Sigmoid function

itstools.connectv2x.support.speed_drop(x, v0=25, drop: float = 1, delay: int = 250)[source]

Create a decreasing jump on speed

itstools.connectv2x.support.speed_pulse(x, v0=25, drop: float = 1, delay: int = 250, duration: float = 1000)[source]

Create a decreasing speed pulse

itstools.connectv2x.traffic module

Traffic information

class itstools.connectv2x.traffic.FundamentalDiagram(w=6.25, u=25, k_x=0.16)[source]

Bases: object

property C

Capacity

compute_flow(k)[source]
property k_c

Critical density

plot_diagram()[source]
property s_x

Critical spacing

itstools.connectv2x.vehicles module

Vehicle behavior

class itstools.connectv2x.vehicles.Vehicle(init_pos: float, init_spd: float, init_lane: float, veh_type: str = 'HDV', veh_lead=None)[source]

Bases: object

This data implements the Car Following Law.

To initialize a vehicle

Vehicle(x0,v0)

a
a_t
control
idx
l_t
lid = 0
classmethod reset() → None[source]

This is a reset vehicle id.

set_leader(veh_lead) → None[source]

Set the leader of a vehicle

shift_state() → None[source]

Shift state

type
property v

Dynamic equation speed

v_t
property veh_lead

Retrieve the pointer towards this vehicle’s leader

property x

Dynamic equation position

x_t

Module contents

Top-level package for connectv2x.