MCU
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DrivetrainSystem< InverterType > Class Template Reference

#include <DrivetrainSystem.h>

Collaboration diagram for DrivetrainSystem< InverterType >:
Collaboration graph

Public Member Functions

 DrivetrainSystem (const std::array< InverterType *, 4 > &inverters, MCUInterface *mcu_interface, int init_time_limit_ms, uint16_t min_hv_voltage=60, int min_cmd_period_ms=1, float max_torque_setpoint_nm=21.42)
 order of array: 0: FL, 1: FR, 2: RL, 3: RR More...
 
void tick (const SysTick_s &tick)
 
void setup_retry ()
 
bool handle_inverter_startup (unsigned long curr_time)
 
void command_drivetrain_no_torque ()
 
void command_drivetrain_debug ()
 
bool inverter_init_timeout (unsigned long curr_time)
 
bool hv_over_threshold_on_drivetrain ()
 
void disable ()
 
void disable_no_pins ()
 
bool drivetrain_error_occured ()
 
void reset_drivetrain ()
 
void command_drivetrain (const DrivetrainCommand_s &data)
 
void enable_drivetrain_reset ()
 
void check_reset_condition ()
 
DrivetrainDynamicReport_s get_dynamic_data ()
 

Private Member Functions

void enable_drivetrain_hv_ (unsigned long curr_time)
 
void request_enable_ ()
 
bool drivetrain_ready_ ()
 
bool check_drivetrain_quit_dc_on_ ()
 
bool drivetrain_enabled_ ()
 

Private Attributes

std::array< InverterType *, 4 > inverters_
 
MCUInterfacemcu_interface_
 
int init_time_limit_ms_
 
uint16_t min_hv_voltage_
 
int motor_pole_pairs_
 
float lambda_magnetic_flux_wb_
 
float L_d_inductance_H_
 
bool hv_en_requested_
 
bool enable_requested_
 
bool reset_requested_
 
unsigned long last_reset_pressed_time_
 
unsigned long reset_interval_
 
unsigned long curr_system_millis_
 
unsigned int min_cmd_period_
 
unsigned long last_no_torque_cmd_time_
 
unsigned long last_reset_cmd_time_
 
unsigned long last_disable_cmd_time_
 
unsigned long last_general_cmd_time_
 
unsigned long drivetrain_initialization_phase_start_time_
 
DrivetrainCommand_s current_drivetrain_command_
 
DrivetrainDynamicReport_s dynamic_data_
 
float max_torque_setpoint_nm_
 

Detailed Description

template<typename InverterType>
class DrivetrainSystem< InverterType >

Definition at line 13 of file DrivetrainSystem.h.

Constructor & Destructor Documentation

◆ DrivetrainSystem()

template<typename InverterType >
DrivetrainSystem< InverterType >::DrivetrainSystem ( const std::array< InverterType *, 4 > &  inverters,
MCUInterface mcu_interface,
int  init_time_limit_ms,
uint16_t  min_hv_voltage = 60,
int  min_cmd_period_ms = 1,
float  max_torque_setpoint_nm = 21.42 
)
inline

order of array: 0: FL, 1: FR, 2: RL, 3: RR

Parameters
invertersinverter pointers

Definition at line 18 of file DrivetrainSystem.h.

19 : inverters_(inverters), init_time_limit_ms_(init_time_limit_ms), min_hv_voltage_(min_hv_voltage), min_cmd_period_(min_cmd_period_ms), max_torque_setpoint_nm_(max_torque_setpoint_nm)
20 {
21 // values from: https://www.amk-motion.com/amk-dokucd/dokucd/en/content/resources/pdf-dateien/fse/motor_data_sheet_a2370dd_dd5.pdf
24 hv_en_requested_ = false;
25 enable_requested_ = false;
26 reset_requested_ = false;
28 reset_interval_ = 5000; // ms
33 last_general_cmd_time_ = 0; // ms
34 mcu_interface_ = mcu_interface;
35 dynamic_data_ = {};
36 }
MCUInterface * mcu_interface_
unsigned long last_disable_cmd_time_
DrivetrainDynamicReport_s dynamic_data_
unsigned long last_reset_cmd_time_
float lambda_magnetic_flux_wb_
uint16_t min_hv_voltage_
unsigned long last_general_cmd_time_
std::array< InverterType *, 4 > inverters_
unsigned long last_reset_pressed_time_
unsigned long reset_interval_
unsigned long curr_system_millis_
unsigned long last_no_torque_cmd_time_
unsigned int min_cmd_period_

Member Function Documentation

◆ check_drivetrain_quit_dc_on_()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::check_drivetrain_quit_dc_on_ ( )
private

◆ check_reset_condition()

template<typename InverterType >
void DrivetrainSystem< InverterType >::check_reset_condition ( )

◆ command_drivetrain()

template<typename InverterType >
void DrivetrainSystem< InverterType >::command_drivetrain ( const DrivetrainCommand_s data)

◆ command_drivetrain_debug()

template<typename InverterType >
void DrivetrainSystem< InverterType >::command_drivetrain_debug ( )

◆ command_drivetrain_no_torque()

template<typename InverterType >
void DrivetrainSystem< InverterType >::command_drivetrain_no_torque ( )

◆ disable()

template<typename InverterType >
void DrivetrainSystem< InverterType >::disable ( )

◆ disable_no_pins()

template<typename InverterType >
void DrivetrainSystem< InverterType >::disable_no_pins ( )

◆ drivetrain_enabled_()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::drivetrain_enabled_ ( )
private

◆ drivetrain_error_occured()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::drivetrain_error_occured ( )

◆ drivetrain_ready_()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::drivetrain_ready_ ( )
private

◆ enable_drivetrain_hv_()

template<typename InverterType >
void DrivetrainSystem< InverterType >::enable_drivetrain_hv_ ( unsigned long  curr_time)
private
Parameters
curr_timecurrent system tick time (millis()) that sets the init phase start time

◆ enable_drivetrain_reset()

template<typename InverterType >
void DrivetrainSystem< InverterType >::enable_drivetrain_reset ( )

◆ get_dynamic_data()

template<typename InverterType >
DrivetrainDynamicReport_s DrivetrainSystem< InverterType >::get_dynamic_data ( )

◆ handle_inverter_startup()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::handle_inverter_startup ( unsigned long  curr_time)

◆ hv_over_threshold_on_drivetrain()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::hv_over_threshold_on_drivetrain ( )

◆ inverter_init_timeout()

template<typename InverterType >
bool DrivetrainSystem< InverterType >::inverter_init_timeout ( unsigned long  curr_time)

◆ request_enable_()

template<typename InverterType >
void DrivetrainSystem< InverterType >::request_enable_ ( )
private

◆ reset_drivetrain()

template<typename InverterType >
void DrivetrainSystem< InverterType >::reset_drivetrain ( )

◆ setup_retry()

template<typename InverterType >
void DrivetrainSystem< InverterType >::setup_retry ( )
inline

Definition at line 39 of file DrivetrainSystem.h.

40 {
42 hv_en_requested_ = false;
43 enable_requested_ = false;
44 }
void reset_drivetrain()

◆ tick()

template<typename InverterType >
void DrivetrainSystem< InverterType >::tick ( const SysTick_s &  tick)

Member Data Documentation

◆ curr_system_millis_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::curr_system_millis_
private

Definition at line 90 of file DrivetrainSystem.h.

◆ current_drivetrain_command_

template<typename InverterType >
DrivetrainCommand_s DrivetrainSystem< InverterType >::current_drivetrain_command_
private

Definition at line 95 of file DrivetrainSystem.h.

◆ drivetrain_initialization_phase_start_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::drivetrain_initialization_phase_start_time_
private

Definition at line 94 of file DrivetrainSystem.h.

◆ dynamic_data_

template<typename InverterType >
DrivetrainDynamicReport_s DrivetrainSystem< InverterType >::dynamic_data_
private

Definition at line 96 of file DrivetrainSystem.h.

◆ enable_requested_

template<typename InverterType >
bool DrivetrainSystem< InverterType >::enable_requested_
private

Definition at line 73 of file DrivetrainSystem.h.

◆ hv_en_requested_

template<typename InverterType >
bool DrivetrainSystem< InverterType >::hv_en_requested_
private

Definition at line 73 of file DrivetrainSystem.h.

◆ init_time_limit_ms_

template<typename InverterType >
int DrivetrainSystem< InverterType >::init_time_limit_ms_
private

Definition at line 68 of file DrivetrainSystem.h.

◆ inverters_

template<typename InverterType >
std::array<InverterType *, 4> DrivetrainSystem< InverterType >::inverters_
private

Definition at line 66 of file DrivetrainSystem.h.

◆ L_d_inductance_H_

template<typename InverterType >
float DrivetrainSystem< InverterType >::L_d_inductance_H_
private

Definition at line 71 of file DrivetrainSystem.h.

◆ lambda_magnetic_flux_wb_

template<typename InverterType >
float DrivetrainSystem< InverterType >::lambda_magnetic_flux_wb_
private

Definition at line 71 of file DrivetrainSystem.h.

◆ last_disable_cmd_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::last_disable_cmd_time_
private

Definition at line 92 of file DrivetrainSystem.h.

◆ last_general_cmd_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::last_general_cmd_time_
private

Definition at line 92 of file DrivetrainSystem.h.

◆ last_no_torque_cmd_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::last_no_torque_cmd_time_
private

Definition at line 92 of file DrivetrainSystem.h.

◆ last_reset_cmd_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::last_reset_cmd_time_
private

Definition at line 92 of file DrivetrainSystem.h.

◆ last_reset_pressed_time_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::last_reset_pressed_time_
private

Definition at line 76 of file DrivetrainSystem.h.

◆ max_torque_setpoint_nm_

template<typename InverterType >
float DrivetrainSystem< InverterType >::max_torque_setpoint_nm_
private

Definition at line 97 of file DrivetrainSystem.h.

◆ mcu_interface_

template<typename InverterType >
MCUInterface* DrivetrainSystem< InverterType >::mcu_interface_
private

Definition at line 67 of file DrivetrainSystem.h.

◆ min_cmd_period_

template<typename InverterType >
unsigned int DrivetrainSystem< InverterType >::min_cmd_period_
private

Definition at line 91 of file DrivetrainSystem.h.

◆ min_hv_voltage_

template<typename InverterType >
uint16_t DrivetrainSystem< InverterType >::min_hv_voltage_
private

Definition at line 69 of file DrivetrainSystem.h.

◆ motor_pole_pairs_

template<typename InverterType >
int DrivetrainSystem< InverterType >::motor_pole_pairs_
private

Definition at line 70 of file DrivetrainSystem.h.

◆ reset_interval_

template<typename InverterType >
unsigned long DrivetrainSystem< InverterType >::reset_interval_
private

Definition at line 77 of file DrivetrainSystem.h.

◆ reset_requested_

template<typename InverterType >
bool DrivetrainSystem< InverterType >::reset_requested_
private

Definition at line 75 of file DrivetrainSystem.h.


The documentation for this class was generated from the following file: