# ποΈHigh Level Blocks

The following blocks are submodels composed of primitive blocks. Their time_mode may be Discrete, Continuous, or Hybrid.

More about time_modes.

## Chassis - Axle

Implements one axle system of an automobile. Has the following features:

Computes a longitudinal force as a function of the applied propulsion and/or braking torque to its wheels.

Accounts for effects of rotating inertia.

Calculates drag from rolling resistance.

More information about the block.

Parameters

`whl_radius_m`

. The rolling radius of the wheels in meters.`axel_rotation_inertia_kgm2`

. The rotational inertia of one axle in kg-m^2.

Inputs

`axle_trq_Nm`

. The propulsion and/or braking torque to its wheels in Newton-meters.`axle_linear_spd_mps`

. The longitudinal speed that the axle is traveling at in meters per second. e.g. the speed of the vehicle the axle is connected to.`axle_vertical_load_N`

. The force pushing the axle down on to the ground in Newtons. i.e. normal force used for rolling resistance calculation.

Outputs

`force_N`

. The longitudinal force applied to the vehicle body it is connected to, in Newtons.`whl_rotational_spd_radps`

. The rotational speed of the axle wheels in radians per second.

Time mode. Continuous

## Chassis - Longitudinal Body Two Axle

Implements a automotive vehicle chassis with the following features:

Front and Rear Axles. See Chassis - Axle block.

Aerodynamic drag force. https://en.wikipedia.org/wiki/Drag_(physics)#The_drag_equation

Dynamic Front / Rear weight distribution. Uses

`veh_cg_rear_ratio`

and`veh_cg_height`

.Longitudinal dynamics. e.g. integration of a = F/m.

More information about the block.

Parameters

`mass`

. The mass of eth vehicle body and all components and cargo assumed to be fixed to it.`Rho`

. Density of air in kg/m^3.`frontal_area`

. The "cross sectional area" in m^2 as defined in https://en.wikipedia.org/wiki/Drag_(physics)#The_drag_equation`whl_radius_m`

. The rolling radius of the wheels in meters.`axel_rotation_inertia_kgm2`

. The rotational inertia of one axle in kg-m^2.`veh_cg_rear_ratio`

. Fraction of mass over the rear axle when vehicle is at rest. Must be between 0 and 1, where 1 is all mass on rear axle.`veh_wheel_base`

. The distance between the front and rear axles in meters.`veh_cg_height`

. The distance that the center of gravity is above the road level in meters.

Inputs

`front_axle_trq_Nm`

. Torque applied to front axle in Newton-meters.`rear_axle_trq_Nm`

. Torque applied to rear axle in Newton-meters.

Outputs

`veh_spd_mps`

. The longitudinal speed of the vehicle in meters per second.`front_whl_spd_radps`

. The rotational speed of the front axle wheels in radians per second.`rear_whl_spd_radps`

. The rotational speed of the rear axle wheels in radians per second.`veh_distance_km`

. The total distance travelled by the vehicle in kilometers.

Time mode. Continuous

## Combustion Engine

Implements a basic internal combustion engine as a simplified torque source with the following features:

Peak torque curve. Implemented using 1D lookup table.

Engine efficiency. Implemented using a 2D lookup table.

More information about the block.

Parameters

`eng_spd_vector_radps`

. The speed break points for the peak torque curve in radians per second.`eng_peak_trq_vector_Nm`

. The torque values of the peak torque curve.`eng_fuel_consumption_trq_vector_Nm`

. Fuel consumption map torque break points in Newton meters`eng_fuel_consumption_map_gps`

. Fuel consumption table data in grams per second`fuel_density_gpL`

. Fuel density in grams per liter`fuel_energy_density_MJpL`

. Fuel energy density in Mega Joules per liter

Inputs

`eng_spd_radps`

. Engine speed in radians per second.`eng_throttle_norm`

. Normalized engine throttle, e.g. fractional request for available torque.

Outputs

`eng_trq_Nm`

. Engine torque in Newton meters`eng_heat_gen_pwr`

. Engine heat generation in Watts`eng_fuel_consumption_gps`

. Engine fuel consumption in gram per second

Time mode. Continuous

## Electric Motor

Implements a generic 4 quadrant electric motor with the following features:

Parametrized peak torque map. Using the

`peak_power_watts`

and`peak_torque_Nm`

parameters, and the`mot_spd_radps`

(rotational speed), it computes the instantanous peak torque available. This peak torque is assumed available to in all 4 torque-speed quadrants.Speed based torque derating. Decreases the available torque to zero. Start decreasing at

`peak_spd1_radps`

, and reaches zero at`peak_spd2_radps`

.Operational voltage limits. Defines an operating range of the input voltage using

`max_voltage`

and`min_voltage`

. Using a hysteresis of`reenable_voltage_offset`

, will set available torque to zero when out of range, and back to`available torque`

when back in range.Motor efficiency effects. Employs a 2D lookup table to model efficiency as a function of speed and torque. Parameters

`eff_spd_vector`

,`eff_torque_vector`

, and`eff_table`

define the lookup table. Both electric current consumed and waste heat generated are computed using this lookup table at the operating point (i.e. speed and torque).Rotational inertia effects. Computes the torque needed to accelerate/decelerate the motor armature inertia, and removes/adds it from/to the shaft torque.

Assumptions:

Friction losses of all kinds are neglected.

Peak torque is only defined for one quadrant, but it is assumed it applies equally to all 4 quadrants.

Efficiency map is only defined for one quadrant, but it is assumed it applies equally to all 4 quadrants.

Motor and controller are considered a single unit in terms of efficiency losses and waste heat generation.

More information about the block.

Parameters:

`peak_power_watts`

. Peak power in Watts.`peak_torque_Nm`

. Peak torque in Newton meters.`peak_spd1_radps`

. Speed at which available starts decreasing to zero in radians per second.`peak_spd2_raps`

. Speed at which available starts reaches zero in radians per second.`min_voltage`

. System shuts down below this voltage..`max_voltage`

. System shuts down above this voltage..`reenable_voltage_offset`

. Hysteresis value for voltage threshold to prevent rapid switching..`eff_spd_vector`

. Efficiency map speed break points in radians per second`eff_trq_vector`

. Efficiency map torque break points in newton meters.`eff_table`

. Efficiency map table data.inertia_kgm2. Rotational inertia of the motor armature in kg m^2.

see parameter descriptions in the model.

Inputs

`mot_spd_radps`

. The instantaneous speed operating point of the motor, in radians per second.`mot_trq_req_norm`

. The requested torque to be produced by the motor.`norm`

means normalized, so -1 <=`mot_trq_req_norm`

<= 1.`mot_dc_voltage`

. The instantaneous direct current (DC) voltage applied to the motor input terminals, in Volts.

Outputs

`mot_trq_Nm`

. The instantaneous torque produced by the motor at its shaft, in Newton-meters.`mot_current_A`

. The instantaneous electric current consumed by the motor in Amps.`mot_heat_gen_pwr`

. The instantaneous thermal heat power being generated inside the motor and controller bodies. In units of Watts.

Time mode: Hybrid. Continuous for everything except voltage limits, which is modeled as discrete behavior.

## Gain Scheduling PID

Implements a discrete time PID controller with the following features:

Feedforward port

Inputs for gains Kp, Ki, Kd used for scheduling the gain as needed

Initialize from external initial condition

Reset to external initial condition

Hold

Anti-wind up

Output limiting from external limits

More information about the block.

Parameters

`dt`

: The discrete step that the block is being executed at. Needed for correct calculation of integral and derivative.

Inputs

`ffwd`

. Feedforward inport`err`

. The measured error that the controller is meant to correct. e.g. X_target - X_measured.`kp`

,`ki`

,`kd`

. The gains`upper_limit`

,`lower_limit`

. The external limits for output limiting.`reset`

. Boolean signal to trigger reset feature. If kept`True`

, reset is continuously applied.`hold`

. Boolean signal to enable hold feature. Keep`True`

to maintain hold.`ic`

. External initial condition.

## Gearbox

Implements a fixed ratio mechanical gear box.

Parameters

`ratio`

. The conversion ration of the gearbox.

Inputs

`trq_in`

. Input or upstream torque.`spd_in`

. Input or upstream speed.

Outputs

`trq_out`

. Output or downstream torque.`spd_out`

. Output or downstream speed

Time mode. Agnostic

## High Voltage Battery

Implements a basic electro-chemical battery by means of coulomb counting, with the following features:

Open circuit voltage (OCV) defined by 1D lookup table as function of SOC (state of charge).

Closed loop voltage (CCV) computed as OCV -

`voltage_drop`

. Where`voltage_drop`

is V=I*R, and R is the`battery_internal_resistance`

in Ohms.Capacity parameter in kWh.

More information about the block.

Parameters

`battery_capacity_kWh`

. Energy capacity of the battery in kilo-Watt-hours.`battery_internal_resistance`

. Internal resistance in Ohms.`battery_initial_SOC`

. Initial state of charge.`soc2ocv_soc_vector`

. State of charge break points for SOC based open circuit voltage model.`soc2ocv_ocv_vector`

. Open circuit voltage data points for SOC based open circuit voltage model

Inputs

`pack_current_A`

. Electrical current flowing through the battery in Amps.

Outputs

`pack_V`

. The DC voltage of the battery.

Time mode. Continuous

## Multi Speed Transmission

Implements an automotive 5-speed automatic transmission. Controller modeled as basic input speed based state machine with debounced shift events to prevent rapid gear switching.

More information about the block.

Parameters

`ratio_1st`

, ... ,`ratio_5th`

. Ratios of the gears.`upshift_spd_thr`

. Input speed threshold causing upshift event.`downshift_spd_thr`

. Input speed threshold causing downshift event.`shift_action_debounce_thr`

. Minimum time between shift events in controller computation cycles.`gear_ratio_state_max`

. Upper limit of gear state variable.`gear_ratio_state_min`

. Lower limit of gear state variable.

Inputs

`input_trq_Nm`

. Input torque to the transmission in Newton meters.`output_spd_radps`

. Output speed of the transmission in radians per second.

Outputs

`output_trq_Nm`

. Output torque of the transmission in Newton meters.`input_spd_radps`

. Input speed of the transmission in radians per second.

Time mode. Hybrid. The controller is modeled as discrete.

Last updated