|
MCU
|
this class is for interfacing with the AMS (accumulator management system) More...
#include <AMSInterface.h>

Public Member Functions | |
| AMSInterface (CANBufferType *msg_output_queue, int sw_ok_pin, float init_temp, float init_volt, float temp_alpha, float volt_alpha) | |
| AMSInterface (CANBufferType *msg_output_queue, int sw_ok_pin) | |
| void | init (SysTick_s &initial_tick) |
| void | set_start_state () |
| bool | heartbeat_received (unsigned long curr_millis) |
| bool | pack_charge_is_critical () |
| void | set_state_ok_high (bool ok_high) |
| void | set_heartbeat (unsigned long curr_millis) |
| float | get_filtered_max_cell_temp () |
| float | get_filtered_min_cell_voltage () |
| float | get_acc_derate_factor () |
| float | initialize_charge () |
| void | calculate_SoC_em (const SysTick_s &tick) |
| void | calculate_SoC_acu (const SysTick_s &tick) |
| float | get_SoC () |
| void | tick (const SysTick_s &tick) |
| void | retrieve_status_CAN (unsigned long curr_millis, CAN_message_t &recvd_msg) |
| void | retrieve_temp_CAN (CAN_message_t &recvd_msg) |
| void | retrieve_voltage_CAN (CAN_message_t &recvd_msg) |
| void | calculate_acc_derate_factor () |
| void | retrieve_em_measurement_CAN (CAN_message_t &can_msg) |
| void | retrieve_current_shunt_CAN (const CAN_message_t &can_msg) |
| bool | is_using_em_for_soc () |
| void | set_use_em_for_soc (bool new_use_em_for_soc) |
| void | enqueue_state_of_charge_CAN () |
| template<typename U > | |
| void | enqueue_new_CAN (U *structure, uint32_t(*pack_function)(U *, uint8_t *, uint8_t *, uint8_t *)) |
| BMS_VOLTAGES_t | get_bms_voltages () |
| EM_MEASUREMENT_t | get_em_measurements () |
| ACU_SHUNT_MEASUREMENTS_t | get_acu_shunt_measurements () |
| AMSInterface (CANBufferType_mock *msg_output_queue, int sw_ok_pin, float init_temp, float init_volt, float temp_alpha, float volt_alpha) | |
| AMSInterface (CANBufferType_mock *msg_output_queue, int sw_ok_pin) | |
| void | init (SysTick_s &initial_tick) |
| void | set_start_state () |
| bool | heartbeat_received (unsigned long curr_millis) |
| bool | pack_charge_is_critical () |
| void | set_state_ok_high (bool ok_high) |
| void | set_heartbeat (unsigned long curr_millis) |
| float | get_filtered_max_cell_temp () |
| float | get_filtered_min_cell_voltage () |
| float | get_acc_derate_factor () |
| float | initialize_charge () |
| void | calculate_SoC_em (const SysTick_s &tick) |
| void | calculate_SoC_acu (const SysTick_s &tick) |
| float | get_SoC () |
| void | tick (const SysTick_s &tick) |
| void | retrieve_status_CAN (unsigned long curr_millis, CAN_message_t_mock &recvd_msg) |
| void | retrieve_temp_CAN (CAN_message_t_mock &recvd_msg) |
| void | retrieve_voltage_CAN (CAN_message_t_mock &recvd_msg) |
| void | calculate_acc_derate_factor () |
| void | retrieve_em_measurement_CAN (CAN_message_t_mock &can_msg) |
| void | retrieve_current_shunt_CAN (const CAN_message_t_mock &can_msg) |
| bool | is_using_em_for_soc () |
| void | set_use_em_for_soc (bool new_use_em_for_soc) |
| void | enqueue_state_of_charge_CAN () |
Private Member Functions | |
| bool | is_below_pack_charge_critical_low_thresh () |
| bool | is_below_pack_charge_critical_total_thresh () |
| bool | is_below_pack_charge_critical_low_thresh () |
| bool | is_below_pack_charge_critical_total_thresh () |
Private Attributes | |
| const float | VOLTAGE_LOOKUP_TABLE [101] |
| CANBufferType * | msg_queue_ |
| int | pin_software_ok_ |
| BMS_status | bms_status_ |
| BMS_temperatures | bms_temperatures_ |
| ACU_SHUNT_MEASUREMENTS_t | acu_shunt_measurements_ |
| EM_MEASUREMENT_t | em_measurements_ |
| BMS_VOLTAGES_t | bms_voltages_ |
| unsigned long | last_heartbeat_time_ |
| float | bms_high_temp |
| float | bms_low_voltage |
| float | filtered_max_cell_temp |
| float | filtered_min_cell_voltage |
| float | cell_temp_alpha |
| float | cell_voltage_alpha |
| float | acc_derate_factor |
| bool | use_em_for_soc_ = true |
| float | charge_ |
| float | SoC_ |
| SysTick_s | last_tick_ |
| bool | has_initialized_charge_ |
| bool | has_received_bms_voltage_ |
| unsigned long | timestamp_start_ |
| CANBufferType_mock * | msg_queue_ |
this class is for interfacing with the AMS (accumulator management system)
Definition at line 26 of file AMSInterface.h.
|
inline |
Constructor for the AMS Interface
| sw_ok_pin | The software ok pin number. This pin is connected to the shutdown line and will go low if the AMS times out |
Definition at line 34 of file AMSInterface.h.
|
inline |
Definition at line 48 of file AMSInterface.h.
|
inline |
Definition at line 29 of file AMSInterface.h.
|
inline |
Definition at line 42 of file AMSInterface.h.
| void AMSInterface::calculate_acc_derate_factor | ( | ) |
Definition at line 180 of file AMSInterface.cpp.
|
inline |
Definition at line 69 of file AMSInterface.h.
| void AMSInterface::calculate_SoC_acu | ( | const SysTick_s & | tick | ) |
Calculates SoC based on the ACU_SHUNT_MEASUREMENTS CAN message. Calling calculate_SoC_acu() will update the SoC_ and charge_ member variables.
| The | current tick that the calculate_SoC_em function should use for integration. |
Definition at line 103 of file AMSInterface.cpp.
|
inline |
Definition at line 62 of file AMSInterface.h.
| void AMSInterface::calculate_SoC_em | ( | const SysTick_s & | tick | ) |
Calculates SoC based on the energy meter CAN message. Calling calculate_SoC_em() will update the SoC_ and charge_ member variables.
| The | current tick that the calculate_SoC_em function should use for integration. |
Definition at line 92 of file AMSInterface.cpp.
|
inline |
Definition at line 61 of file AMSInterface.h.
| void AMSInterface::enqueue_new_CAN | ( | U * | structure, |
| uint32_t(*)(U *, uint8_t *, uint8_t *, uint8_t *) | pack_function | ||
| ) |
Helper function to enqueue CAN messages using the new CAN library
Definition at line 6 of file AMSInterface.cpp.
| void AMSInterface::enqueue_state_of_charge_CAN | ( | ) |
Puts the current value of SoC_ and charge_ onto msg_queue_.
|
inline |
Definition at line 77 of file AMSInterface.h.
| float AMSInterface::get_acc_derate_factor | ( | ) |
Definition at line 204 of file AMSInterface.cpp.
|
inline |
Definition at line 58 of file AMSInterface.h.
|
inline |
Definition at line 182 of file AMSInterface.h.
|
inline |
Definition at line 180 of file AMSInterface.h.
|
inline |
Definition at line 181 of file AMSInterface.h.
| float AMSInterface::get_filtered_max_cell_temp | ( | ) |
Definition at line 67 of file AMSInterface.cpp.
|
inline |
Definition at line 56 of file AMSInterface.h.
| float AMSInterface::get_filtered_min_cell_voltage | ( | ) |
Definition at line 73 of file AMSInterface.cpp.
|
inline |
Definition at line 57 of file AMSInterface.h.
|
inline |
Retrieves the value of the SoC member variable. This function does NOT recalculate the SoC_ variable, it only returns the value that is stored.
Definition at line 113 of file AMSInterface.h.
|
inline |
Definition at line 63 of file AMSInterface.h.
| bool AMSInterface::heartbeat_received | ( | unsigned long | curr_millis | ) |
Definition at line 50 of file AMSInterface.cpp.
|
inline |
Definition at line 48 of file AMSInterface.h.
| void AMSInterface::init | ( | SysTick_s & | initial_tick | ) |
Definition at line 14 of file AMSInterface.cpp.
|
inline |
Definition at line 46 of file AMSInterface.h.
| float AMSInterface::initialize_charge | ( | ) |
Initializes the charge member variable from the voltage of the minimum cell using the VOLTAGE_LOOKUP_TABLE.
Definition at line 79 of file AMSInterface.cpp.
|
inline |
Definition at line 60 of file AMSInterface.h.
|
private |
Definition at line 54 of file AMSInterface.cpp.
|
private |
|
private |
Definition at line 58 of file AMSInterface.cpp.
|
private |
|
inline |
Retrieves the current state of the use_em_for_soc member variable.
Definition at line 160 of file AMSInterface.h.
|
inline |
Definition at line 73 of file AMSInterface.h.
| bool AMSInterface::pack_charge_is_critical | ( | ) |
Definition at line 62 of file AMSInterface.cpp.
|
inline |
Definition at line 49 of file AMSInterface.h.
| void AMSInterface::retrieve_current_shunt_CAN | ( | const CAN_message_t & | can_msg | ) |
Reads this CAN message into the acu_shunt_measurements_ member variable. This function does NOT apply the fromS() functions on the data. This function uses the NEW CAN library.
Definition at line 176 of file AMSInterface.cpp.
|
inline |
Definition at line 72 of file AMSInterface.h.
| void AMSInterface::retrieve_em_measurement_CAN | ( | CAN_message_t & | can_msg | ) |
Reads this CAN message into the em_measurements_ member variable. This function does NOT apply the fromS() functions on the data. This function uses the NEW CAN library.
Definition at line 172 of file AMSInterface.cpp.
|
inline |
Definition at line 71 of file AMSInterface.h.
| void AMSInterface::retrieve_status_CAN | ( | unsigned long | curr_millis, |
| CAN_message_t & | recvd_msg | ||
| ) |
Reads this CAN message into the bms_status_ member variable. This function uses the OLD CAN library.
Definition at line 152 of file AMSInterface.cpp.
|
inline |
Definition at line 66 of file AMSInterface.h.
| void AMSInterface::retrieve_temp_CAN | ( | CAN_message_t & | recvd_msg | ) |
Reads this CAN message into the bms_temperatures_ member variable. This function uses the OLD CAN library.
Definition at line 157 of file AMSInterface.cpp.
|
inline |
Definition at line 67 of file AMSInterface.h.
| void AMSInterface::retrieve_voltage_CAN | ( | CAN_message_t & | recvd_msg | ) |
Reads this CAN message into the bms_voltages_ member variable. This function does NOT apply the fromS() functions on the data. This function uses the NEW CAN library.
Definition at line 161 of file AMSInterface.cpp.
|
inline |
Definition at line 68 of file AMSInterface.h.
| void AMSInterface::set_heartbeat | ( | unsigned long | curr_millis | ) |
Definition at line 46 of file AMSInterface.cpp.
|
inline |
Definition at line 53 of file AMSInterface.h.
| void AMSInterface::set_start_state | ( | ) |
Definition at line 32 of file AMSInterface.cpp.
|
inline |
Definition at line 47 of file AMSInterface.h.
| void AMSInterface::set_state_ok_high | ( | bool | ok_high | ) |
Definition at line 39 of file AMSInterface.cpp.
|
inline |
Definition at line 52 of file AMSInterface.h.
|
inline |
Setter function for the use_em_for_soc_ member variable.
| new_use_em_for_soc | The new value for the variable. |
Definition at line 166 of file AMSInterface.h.
|
inline |
Definition at line 74 of file AMSInterface.h.
| void AMSInterface::tick | ( | const SysTick_s & | tick | ) |
This is AMSInterface's tick() function. It behaves correctly regardless of the since the functions calculate the elapsed time between the given tick and the stored last_tick_.
| tick | The current system tick. |
Definition at line 119 of file AMSInterface.cpp.
|
inline |
Definition at line 64 of file AMSInterface.h.
|
private |
Definition at line 220 of file AMSInterface.h.
|
private |
Definition at line 205 of file AMSInterface.h.
|
private |
Definition at line 213 of file AMSInterface.h.
|
private |
Definition at line 214 of file AMSInterface.h.
|
private |
Definition at line 203 of file AMSInterface.h.
|
private |
Definition at line 204 of file AMSInterface.h.
|
private |
Definition at line 207 of file AMSInterface.h.
|
private |
Definition at line 217 of file AMSInterface.h.
|
private |
Definition at line 218 of file AMSInterface.h.
|
private |
The charge stored on the accumulator. Stored in coulombs, ranging from zero to MAX_PACK_CHARGE.
Definition at line 233 of file AMSInterface.h.
|
private |
Definition at line 206 of file AMSInterface.h.
|
private |
Definition at line 215 of file AMSInterface.h.
|
private |
Definition at line 216 of file AMSInterface.h.
|
private |
Stores whether or not this AMSInterface has initialized SoC_ or not.
Definition at line 250 of file AMSInterface.h.
|
private |
Stores whether or not this AMSInterface has properly received a bms_voltage CAN message.
Definition at line 256 of file AMSInterface.h.
|
private |
Definition at line 210 of file AMSInterface.h.
|
private |
Stores the last Sys_Tick_s struct from the last time the tick() function is called.
Definition at line 245 of file AMSInterface.h.
|
private |
CAN line that this AMSInterface should write to. This should be the Telemetry CAN line.
Definition at line 197 of file AMSInterface.h.
|
private |
Definition at line 98 of file AMSInterface.h.
|
private |
Definition at line 200 of file AMSInterface.h.
|
private |
Stores the current state of charge of the accumulator. SoC is stored as a percentage of MAX_PACK_CHARGE. In every location, this is calculated as SoC = (charge / MAX_PACK_CHARGE) * 100;
Definition at line 240 of file AMSInterface.h.
|
private |
Stores the time, in milliseconds, when this AMSInterface first received a bms voltages CAN message.
Definition at line 261 of file AMSInterface.h.
|
private |
If set to TRUE, then SoC will use EM. If set to FALSE, then SoC will use ACU SHUNT. Set to TRUE in constructor by default.
Definition at line 227 of file AMSInterface.h.
|
private |
Helper function to enqueue CAN messages using the new CAN library
Definition at line 187 of file AMSInterface.h.