PER Firmware
Loading...
Searching...
No Matches
cooling_fsm.c File Reference
#include "cooling_fsm.h"
#include "can_library/generated/PDU.h"
#include "common/bangbang/bangbang.h"
#include "common/phal_F4/pwm/pwm.h"
#include "common/utils/max.h"
#include "cooling_callbacks.h"
#include "main.h"
Include dependency graph for cooling_fsm.c:

Macros

#define FAN_PWM_TIM   (TIM1)
 

Enumerations

enum  cooling_state_t { COOLING_STATE_INIT = 0 , COOLING_STATE_AUTO = 1 , COOLING_STATE_MANUAL = 2 , COOLING_STATE_DEBUG = 3 }
 

Functions

 INIT_BANG_BANG (powertrain_pumps, POWERTRAIN_PUMPS_UPPER_LIMIT, POWERTRAIN_PUMPS_LOWER_LIMIT, powertrain_pumps_on, powertrain_pumps_off, POWERTRAIN_PUMPS_INTERVAL)
 
 INIT_BANG_BANG (hx_fan, HX_FAN_UPPER_LIMIT, HX_FAN_LOWER_LIMIT, hx_fan_on, hx_fan_off, HX_FAN_INTERVAL)
 
 INIT_BANG_BANG (battery_fans, BATTERY_FAN_UPPER_LIMIT, BATTERY_FAN_LOWER_LIMIT, battery_fans_on, battery_fans_off, BATTERY_FAN_INTERVAL)
 
static void update_bangbang (void)
 
void cooling_fsm_periodic (void)
 

Variables

static cooling_state_t cooling_state = COOLING_STATE_INIT
 
static cooling_state_t next_cooling_state = COOLING_STATE_INIT
 
static constexpr uint32_t PWM_FREQUENCY_HZ = 25'000
 
static constexpr uint8_t NUM_BATTERY_FANS = 4
 
static constexpr uint8_t FANS_PWM_DUTY = 50
 
static constexpr float POWERTRAIN_PUMPS_UPPER_LIMIT = 40.0f
 
static constexpr float POWERTRAIN_PUMPS_LOWER_LIMIT = 35.0f
 
static constexpr uint32_t POWERTRAIN_PUMPS_INTERVAL = 5000
 
static constexpr float HX_FAN_UPPER_LIMIT = 35.0f
 
static constexpr float HX_FAN_LOWER_LIMIT = 25.0f
 
static constexpr uint32_t HX_FAN_INTERVAL = 1000
 
static constexpr float BATTERY_FAN_UPPER_LIMIT = 35.0f
 
static constexpr float BATTERY_FAN_LOWER_LIMIT = 25.0f
 
static constexpr uint32_t BATTERY_FAN_INTERVAL = 1000
 

Macro Definition Documentation

◆ FAN_PWM_TIM

#define FAN_PWM_TIM   (TIM1)

Enumeration Type Documentation

◆ cooling_state_t

Enumerator
COOLING_STATE_INIT 
COOLING_STATE_AUTO 
COOLING_STATE_MANUAL 
COOLING_STATE_DEBUG 

Function Documentation

◆ cooling_fsm_periodic()

void cooling_fsm_periodic ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ INIT_BANG_BANG() [1/3]

◆ INIT_BANG_BANG() [2/3]

◆ INIT_BANG_BANG() [3/3]

◆ update_bangbang()

static void update_bangbang ( void )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ BATTERY_FAN_INTERVAL

uint32_t BATTERY_FAN_INTERVAL = 1000
staticconstexpr

◆ BATTERY_FAN_LOWER_LIMIT

float BATTERY_FAN_LOWER_LIMIT = 25.0f
staticconstexpr

◆ BATTERY_FAN_UPPER_LIMIT

float BATTERY_FAN_UPPER_LIMIT = 35.0f
staticconstexpr

◆ cooling_state

cooling_state_t cooling_state = COOLING_STATE_INIT
static

◆ FANS_PWM_DUTY

uint8_t FANS_PWM_DUTY = 50
staticconstexpr

◆ HX_FAN_INTERVAL

uint32_t HX_FAN_INTERVAL = 1000
staticconstexpr

◆ HX_FAN_LOWER_LIMIT

float HX_FAN_LOWER_LIMIT = 25.0f
staticconstexpr

◆ HX_FAN_UPPER_LIMIT

float HX_FAN_UPPER_LIMIT = 35.0f
staticconstexpr

◆ next_cooling_state

cooling_state_t next_cooling_state = COOLING_STATE_INIT
static

◆ NUM_BATTERY_FANS

uint8_t NUM_BATTERY_FANS = 4
staticconstexpr

◆ POWERTRAIN_PUMPS_INTERVAL

uint32_t POWERTRAIN_PUMPS_INTERVAL = 5000
staticconstexpr

◆ POWERTRAIN_PUMPS_LOWER_LIMIT

float POWERTRAIN_PUMPS_LOWER_LIMIT = 35.0f
staticconstexpr

◆ POWERTRAIN_PUMPS_UPPER_LIMIT

float POWERTRAIN_PUMPS_UPPER_LIMIT = 40.0f
staticconstexpr

◆ PWM_FREQUENCY_HZ

uint32_t PWM_FREQUENCY_HZ = 25'000
staticconstexpr