Simulation model: Vehicle

Simulation model : Vehicle

Author

Description

  • Powertrain model
  • Body model
  • Vehicle model

Update

  • [18/05/31] - Initial release - kyunghan
class py_sim.model_vehicle.Mod_Body[source]

Bases: object

Module description here

ConfigVariables:
  • conf_rw_wheel
  • conf_jw_body
  • conf_brk_coef
  • conf_acc_coef
  • conf_veh_len
Submodules:
  • Body_config:
  • Dyn_config:
  • Lon_driven_in:
Operation:

Description operation here:

!!!Make operation diagram here!!!
# Module_name(in//out)
Motor_control(t_mot, w_mot // des_torque)
    >> Motor_driven(t_mot, w_mot // v_mot)
        >> Motor_elec_dynamics, Motor_mech_dynamics, Drive_shaft_dynamics
    >> Motor_torque_system(v_mot // des_torque)
Acc_system(u_acc)[source]
Body_config(conf_rw_wheel=0.3, conf_jw_body=2, conf_brk_coef=100, conf_acc_coef=100, conf_veh_len=2)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Brake_system(u_brake)[source]
Drag_system(veh_vel)[source]
Dyn_config(conf_airdrag=4, conf_add_weight=0)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Lat_driven(u_steer)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Lat_dynamics(the_wheel, u_steer)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Lon_driven_in(u_acc, u_brake, veh_vel=0)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Lon_driven_out(t_load, t_brake, t_drag)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Tire_dynamics(w_wheel, t_load, t_brake=0, t_drag=0)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
class py_sim.model_vehicle.Mod_PowerTrain[source]

Bases: object

Electric vhielc powertrain model

ConfigVariables:
  • conf_rm_mot: motor registance [ohm].
  • conf_lm_mot: motor electric induction [Hennry]
  • conf_kb_mot: motor back emp coeff [-]
  • conf_kt_mot: motor torque constant [Nm/A]
  • conf_jm_mot: motor inertia [kg*m^2/rad..?]
  • conf_trq_gain: torque efficiency [-]
  • conf_rd_gear: reduction gear ratio [-]
  • conf_ks_shaft: shaft stifness [Nm/rad]
Submodules:
  • Motor_config: set config variables
  • DriveTrain_config: set config variables
  • Motor_driven: Driven motor
  • Motor_control: Control motor torque
  • Motor_elect_dynamics: 1st order dynamics for motor electric system
  • Motor_mech_dynamics: 1st order dynamics for motor mechanical system
  • Drive_shaft_dynamics: 1st order dynamics for shaft rotational system
  • Motor_torque_system: set motor voltage
Operation:

Motor_control module can control the motor to desired torque:

# Module_name(in//out)
Motor_control(t_mot, w_mot, t_load // des_torque)
    >> Motor_driven(t_mot, w_mot, t_load // v_mot)
        >> Motor_elec_dynamics, Motor_mech_dynamics, Drive_shaft_dynamics
    >> Motor_torque_system(v_mot // des_torque)
DriveTrain_config(conf_rd=8, conf_ks=0.01)[source]

Drivetrain parameter configuration

Parameters not specified are declared as default values

If you want set a specific parameter don’t use this function, just type:

>>> Mod_PowerTrain.conf_rd_gear = 7
...
Args:
  • Driver shaft parameter values, default values are setted
Drive_shaft_dynamics(t_load, w_mot, w_shaft)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Motor_config(conf_rm=0.1, conf_lm=0.1, conf_kb=0.00065, conf_kt=0.1, conf_jm=0.001, conf_trq_gain=1)[source]

Motor parameter configuration

Parameters not specified are declared as default values

If you want set a specific parameter don’t use this function, just type:

>>> Mod_PowerTrain.conf_rm_mot = 0.2
...
Args:
Motor parameter values, default values are setted
Motor_control(t_mot_des=0, w_shaft=0)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Motor_driven(v_in=0, w_shaft=0)[source]

Motor driven function

Generate motor output(torque, speed) and load torque according to input voltage and wheel speed (shaft speed = wheel speed)

Contain theree modules Elecic dynamics, Menahicla dynamics, Shaft dynamics

Args:
  • v_in: motor input voltage [V]
  • w_shaft: rotational speed of drive shaft from body model [rad/s]
returns:
  • t_mot: motor torque [Nm]
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Motor_elec_dynamics(t_mot, v_in, w_mot)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Motor_mech_dynamics(w_mot, t_mot, t_load)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
Motor_torque_system(t_mot_des)[source]

Function overview here

Functional description

Code example wirght follows:

>>> [w_mot, t_mot, t_load] = Motor_control(t_mot_des)
...
Args:
  • Input parameters here
  • t_mot_des:
  • w_shaft:
returns:
  • Return of function here
  • w_mot: motor rotational speed [rad/s]
  • t_load: load torque from body model [Nm]
class py_sim.model_vehicle.Mod_Veh(powertrain_model, body_model)[source]

Bases: object

Module description here

ConfigVariables:
  • conf_rw_wheel
  • conf_jw_body
  • conf_brk_coef
  • conf_acc_coef
  • conf_veh_len
Submodules:
  • Body_config:
  • Dyn_config:
  • Lon_driven_in:
Initialization:
  • Include powertrain, body models
Operation:

Description operation here:

!!!Make operation diagram here!!!
# Module_name(in//out)
Motor_control(t_mot, w_mot // des_torque)
    >> Motor_driven(t_mot, w_mot // v_mot)
        >> Motor_elec_dynamics, Motor_mech_dynamics, Drive_shaft_dynamics
    >> Motor_torque_system(v_mot // des_torque)
Set_initState(x_veh=0, y_veh=0, s_veh=0, n_veh=0, psi_veh=0)[source]
Veh_driven(u_acc=0, u_brake=0, u_steer=0)[source]
Veh_position_update(vel_veh=0, the_wheel=0)[source]
py_sim.model_vehicle.Ts = 0.01

global vairable: simulation sampling timeself.

you can declare other sampling time in application as vairable Ts