1#ifndef __AMSINTERFACE_H__
2#define __AMSINTERFACE_H__
52 void init(SysTick_s &initial_tick);
176 template <
typename U>
177 void enqueue_new_CAN(U *structure, uint32_t (*pack_function)(U *, uint8_t *, uint8_t *, uint8_t *));
187 const float VOLTAGE_LOOKUP_TABLE[101] = {3.972, 3.945, 3.918, 3.891, 3.885, 3.874, 3.864, 3.858, 3.847, 3.836, 3.82, 3.815, 3.815, 3.798, 3.788,
188 3.782, 3.771, 3.755, 3.744, 3.744, 3.733, 3.728, 3.723, 3.712, 3.701, 3.695, 3.69, 3.679, 3.679, 3.668, 3.663, 3.657, 3.647,
189 3.647, 3.636, 3.625, 3.625, 3.625, 3.614, 3.609, 3.603, 3.603, 3.592, 3.592, 3.592, 3.581, 3.581, 3.571, 3.571, 3.571, 3.56,
190 3.56, 3.56, 3.549, 3.549, 3.549, 3.549, 3.538, 3.538, 3.551, 3.546, 3.535, 3.535, 3.535, 3.53, 3.524, 3.524, 3.524, 3.513,
191 3.513, 3.513, 3.503, 3.503, 3.492, 3.492, 3.492, 3.487, 3.481, 3.481, 3.476, 3.471, 3.46, 3.46, 3.449, 3.444, 3.428, 3.428,
192 3.417, 3.401, 3.39, 3.379, 3.363, 3.331, 3.299, 3.267, 3.213, 3.149, 3.041, 3, 3, 0};
Circular_Buffer< uint8_t,(uint32_t) 128, sizeof(CAN_message_t)> CANBufferType
this class is for interfacing with the AMS (accumulator management system)
float get_acc_derate_factor()
bool has_initialized_charge_
void enqueue_state_of_charge_CAN()
void tick(const SysTick_s &tick)
BMS_VOLTAGES_t bms_voltages_
float filtered_min_cell_voltage
void retrieve_current_shunt_CAN(const CAN_message_t &can_msg)
void set_heartbeat(unsigned long curr_millis)
BMS_temperatures bms_temperatures_
float get_filtered_min_cell_voltage()
ACU_SHUNT_MEASUREMENTS_t acu_shunt_measurements_
bool is_below_pack_charge_critical_total_thresh()
void init(SysTick_s &initial_tick)
void retrieve_status_CAN(unsigned long curr_millis, CAN_message_t &recvd_msg)
void retrieve_temp_CAN(CAN_message_t &recvd_msg)
void enqueue_new_CAN(U *structure, uint32_t(*pack_function)(U *, uint8_t *, uint8_t *, uint8_t *))
unsigned long last_heartbeat_time_
bool heartbeat_received(unsigned long curr_millis)
void calculate_SoC_acu(const SysTick_s &tick)
float get_filtered_max_cell_temp()
unsigned long timestamp_start_
EM_MEASUREMENT_t get_em_measurements()
void set_state_ok_high(bool ok_high)
bool is_using_em_for_soc()
bool has_received_bms_voltage_
BMS_VOLTAGES_t get_bms_voltages()
bool is_below_pack_charge_critical_low_thresh()
void retrieve_voltage_CAN(CAN_message_t &recvd_msg)
EM_MEASUREMENT_t em_measurements_
ACU_SHUNT_MEASUREMENTS_t get_acu_shunt_measurements()
AMSInterface(CANBufferType *msg_output_queue, int sw_ok_pin, float init_temp, float init_volt, float temp_alpha, float volt_alpha)
CANBufferType * msg_queue_
float initialize_charge()
float filtered_max_cell_temp
void retrieve_em_measurement_CAN(CAN_message_t &can_msg)
const float VOLTAGE_LOOKUP_TABLE[101]
AMSInterface(CANBufferType *msg_output_queue, int sw_ok_pin)
void set_use_em_for_soc(bool new_use_em_for_soc)
bool pack_charge_is_critical()
void calculate_acc_derate_factor()
void calculate_SoC_em(const SysTick_s &tick)
const float DEFAULT_VOLTAGE_ALPHA
const float DEFAULT_INIT_VOLTAGE
const unsigned long PACK_CHARGE_CRIT_LOWEST_CELL_THRESHOLD
const float DEFAULT_INIT_TEMP
const uint16_t MAX_PACK_CHARGE
const float DEFAULT_TEMP_ALPHA
const unsigned long PACK_CHARGE_CRIT_TOTAL_THRESHOLD
const unsigned long DEFAULT_INITIALIZATION_WAIT_INTERVAL
const unsigned long HEARTBEAT_INTERVAL
const float DEFAULT_VOLTAGE_ALPHA
const float DEFAULT_INIT_VOLTAGE
const float DEFAULT_INIT_TEMP
const float DEFAULT_TEMP_ALPHA