pysim models - power model

Simulation model : Power

Description

  • Simulate power source of EV

Modules summary

  • Motor module - calculate mechanical loss and efficiency of motor
    • Motor_config - configure motor parameters
    • Motor_init_config - configure initial motor state
    • Motor_Power_system - calculate power loss based on motor efficiency
      • Motor_Elec_system - calculate required motor current for generated torque
  • Battery module - calculate battery power consumption
    • Battery_config - configure battery parameters
    • Battery_init_config - configure initial battery state
    • Calc_EnergyCons - calculate battey consumption current
      • Calc_Voc - calculate open circuit voltage (Voc)
      • Calc_SOC - calculate battery SOC
    • Calc_Vterm - calculate battery termination voltage (Vterm)
  • Power module - contain motor module and battery module
    • Motor_driven - calculate motor driven and battery consumption (include Mod_Power(Motor_Power_system), Mod_Battery(Calc_Current))

Update

  • [18/05/31] - Initial release - kyunghan
  • [18/06/01] - Add battery class - seungeon
  • [18/06/01] - Modulization - kyuhwan - Powertrain class -> Divide into motor, battery classes - Powertrain class has composition relationship with motor, battery
  • [18/06/11] - Modification - kyunghan - Modify drivetrain module to body module - Modify model configurations
  • [18/10/08] - Modification - kyunghan - Move the motor_driven function to power module - Battery module restructure
class pysim.models.model_power.Mod_Battery[source]

Bases: object

  • Battery module
Battery_config(Voc_base_voltage=356.0, E_tot=230400000.0, MaxPower=150000.0, R0=0.0016, R1_a=76.5218, R1_b=-7.9563, R1_c=23.8375, C1_a=-649.835, C1_b=-64.2924, C1_c=12692.1946, R2_a=5.2092, R2_b=-35.2367, R2_c=124.9467, C2_a=-78409.2788, C2_b=-0.0131, C2_c=30802.62582, Int_E=161280000.0)[source]

Configure battery parameters

Parameter:
  • Base open circuit voltage
  • Total energy
  • Maximum power
  • Internal resistance
  • SOC table
Battery_init_config(SOC_init=70, power_additional_set=500)[source]

Configure initial battery states

State:
  • Open circuit voltage
  • Termination voltage
  • Internal voltage, currentm, energy
Calc_EnergyCons(Motor_Net_Power)[source]

Calculate energy consumption according to desired motor torque

Args:
  • Motor_Net_Power: motor required power [W]
Return:
  • Current: battery current consumption [A]
Include:
  • Mod_Battery(Calc_Voc): Calculate battery open circuit voltage
  • Mod_Battery(Calc_SOC): Calculate battery SOC
Calc_SOC(current)[source]

Calculate battery state of charge

Args:
  • current: battery current consumption [A]
Return:
  • SOC: State of charge [%]
Calc_Voc(input_soc)[source]

Calculate open circuit voltage using interpolation table

Args:
  • input_soc: current SOC [%]
Return:
  • Voc: battery open circuit voltage [V]
Calc_Vterm(V1, V2)[source]

Calculate battery termination voltage

Arg:
  • V1: battery internal voltage 1 [V]
  • V1: battery internal voltage 2 [V]
Return:
  • Vterm: termination voltage [V]
class pysim.models.model_power.Mod_Motor[source]

Bases: object

  • Motor module
Motor_Elec_system(p_mot_elec)[source]

Calculate motor electric current according to motor power

Args:
  • p_mot_elec: electric requried motor power [W]
Return:
  • i_mot: electric current [A]
Motor_Power_system(t_mot, w_mot)[source]

Calculate required motor power with motor power loss

Args:
  • t_mot: motor torque [Nm]
  • w_mot: motor rotational speed [rad/s]
Return:
  • p_mot_elec: electric requried motor power [W??]
Include:
  • Mod_Motor(Motor_Elec_system): Calculate motor electric current according to motor power
Motor_config(loss_mech_C0=0.0206, loss_mech_C1=-2.135e-05, loss_copper_C0=0.2034, loss_stray_C0=3.352e-06, loss_stray_C1=-2.612e-09, loss_iron_C0=1e-06, loss_iron_C1=1.55)[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
...
Parameters:
Motor parameter values, default values are setted
Motor_init_config()[source]

Initialize motor state

State:
  • Motor voltage and current
  • Motor rotational speed
  • Motor torque
  • Motor power loss
class pysim.models.model_power.Mod_Power(Mod_Motor_loc=<pysim.models.model_power.Mod_Motor object>, Mod_Battery_loc=<pysim.models.model_power.Mod_Battery object>)[source]

Bases: object

  • Power module: Set the motor and battery model when initialization
Motor_driven(torque_set=0, w_drivtrain=0)[source]

Simulate motor driven function Calculate battery power consumption and regeneration according to current motor torque and rotational speed Include motor and battery modules

Args:
  • torque_set: generated motor torque set [Nm]
  • 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]
Include:
  • Mod_Motor(Motor_Power_system): Calculate required electric power for desired torque
  • Mod_Battery(Calc_EnergyCons): Calculate electric power consumption
pysim.models.model_power.Ts = 0.01

global vairable: simulation sampling timeself.

you can declare other sampling time in application as vairable Ts