ensemble.control.operational package

Submodules

ensemble.control.operational.TestOperationalLayerEnsembleVissim module

ensemble.control.operational.basic_test module

ensemble.control.operational.basic_test.runtime_op_layer(initial_condition: numpy.ndarray, scenario: str = 'platoon')[source]

Basic test runtime operational layer

ensemble.control.operational.operational module

This module contains objects that implement the operational control layer for an individual truck by calling the the compiled shared library OperationalDLL

class ensemble.control.operational.operational.CACC(path_library: str = '/home/docs/checkouts/readthedocs.org/user_builds/ensemble-docs/checkouts/latest/ensemble/libs/linux/OperationalDLL.so')[source]

Bases: ensemble.metaclass.controller.AbsController

Operational layer class for containing specific library execution

Parameters
  • ID (int) – EGO Vehicle id

  • HMI_control_mode (double) – ACC or CACC to be used, from tactical layer ACC=1; CACC =2

  • HMI_t_headway (double) – Desired time gap from tactical layer [s]

  • HMI_setSpeed (double) – Desired speed from tactical layer [m/s]

  • EGO_lon_velocity (double) – EGO vehicle longitudinal velocity [m/s]

  • EGO_lon_acceleration (double) – EGO vehicle longitudinal acceleration [m/s^2]

  • MIO_dv_limit (Double) – Front target relative velocity: target velocity – ego velocity [m/s]

  • MIO_lon_distance (Double) – Longitudinal distance gap [m]

  • MIO_objectID (double) – Target ID [int]

  • MIO_acceleration (double) – Leader’s actual current acceleration [m/s^2]

  • MIO_datamodeA (double) – Data resource. No target = 0, detected with wifi + radar + camera = 7 (choose either 0 or 7)

  • MIO_u_ffA (double) – Communicated target desired acceleration [m/s^2] Acceleration output of the target’s operational layer, not the output of vehicle model. Also: Leader’s desired acceleration. If leader not platoon vehicle or not leader set value to zero.

EGO_lon_acceleration: ctypes.c_double = c_double(0.0)
EGO_lon_velocity: ctypes.c_double = c_double(0.0)
HMI_control_mode: ctypes.c_double = c_double(1.0)
HMI_t_headway: ctypes.c_double = c_double(1.4)
ID: ctypes.c_double = c_int(1)
MIO_acceleration: ctypes.c_double = c_double(0.0)
MIO_datamodeA: ctypes.c_double = c_double(0.0)
MIO_dv_limit: ctypes.c_double = c_double(0.0)
MIO_lon_distance: ctypes.c_double = c_double(0.0)
MIO_objectID: ctypes.c_double = c_double(0.0)
MIO_u_ffA: ctypes.c_double = c_double(0.0)
__call__(vgc: ensemble.metaclass.coordinator.AbsSingleGapCoord, reference: ensemble.control.operational.reference.ReferenceHeadway, t: float, T: float)[source]

This performs a multiple step call of the operational layer per vehicle.

Parameters
  • vgc (AbsSingleGapCoord) – vgc vehicle gap coordinator

  • reference (ReferenceHeadway) – Reference object

  • t (float) – simulation current time

  • T (float) – operational time step

  • dynamics (AbsDynamics) – Dynamics object to compute vehicle’s model

Returns

[description]

Return type

[type]

load_library(path_library)[source]

Loads the control library into the controller

single_call_control(leader: dict, ego: dict, r_ego: dict, t: float, T: float)[source]

Asumes 0 index for lead 1 for follower

  • a: real acceleration

  • x: postition

  • v: speed

  • s: spacing

  • u: control

  • D: delta

  • P: past

Parameters
  • leader (dict) – vehicle 0 keys, a,x,v,Dv,Pu,Ps

  • ego (dict) – vehicle 1, keys, a,x,v,Dv,Pu,Ps

  • r_ego (dict) – reference 1 keys, v,s

  • t (float) – current time

  • T (float) – sampling time

u_control: ctypes.c_double = c_double(0.0)
update_value(**kwargs)[source]

Update values to compute control

ensemble.control.operational.operationalLayerTest module

ensemble.control.operational.operationalLayerTest.main()[source]
class ensemble.control.operational.operationalLayerTest.oem[source]

Bases: object

class ensemble.control.operational.operationalLayerTest.operationalLayerTest[source]

Bases: object

call()[source]
defineLeaderProfile(scenario='stop-go')[source]
initializePars()[source]
loadLib()[source]
printOutput()[source]
run()[source]
runFullScenario()[source]
setAloneScenario()[source]
setMetaPars()[source]
setPars(scenario='stop-go')[source]
timeEvolveEgo(leader)[source]

ensemble.control.operational.operationalLayerTest_usage_example module

ensemble.control.operational.reference module

Reference Control

This model is here to create the reference for the operational controller based on a specific time window.

class ensemble.control.operational.reference.ReferenceHeadway(sim_step: float = 1.0, time_step: float = 0.1, interval: float = 3600, gap0: float = 1.4, gapT: float = 1.4, v0: float = 25, VT: float = 25, current_gap: float = 1.4, current_speed: float = 25, current_time: float = 0)[source]

Bases: object

This is a class to model the reference for a controller, consume, regenerate trajectory, plot trajectory.

The maneuvers are planned on a horizon of 60 seconds and the references are created on streams of 1 second. Each stream once consummed exams the status before generating a new sequence.

VT: float = 25
static change_time_gap(time_vector: numpy.ndarray, T0: float = 1.4, TF: float = 1.4) numpy.ndarray[source]

Create a decreasing jump on speed

create_time_gap_hwy(state: ensemble.metaclass.state.AbsState)[source]

Creates an array containing the time gap reference for an interval of time based on the state of the vehicle gap.

Parameters

state (AbsState) – State of the platoon

Returns

Iterable array containing time gap values.

Return type

Iterable

current_gap: float = 1.4
current_speed: float = 25
current_time: float = 0
gap0: float = 1.4
gapT: float = 1.4
interval: float = 3600
plot_case(state: ensemble.metaclass.state.AbsState)[source]
static sigmoid(x, A: float = 1, a: float = 5, d: int = 30) numpy.ndarray[source]

Sigmoid function

sim_step: float = 1.0
time_step: float = 0.1
v0: float = 25

Module contents