50 #ifndef __BALANCER_H__
51 #define __BALANCER_H__
64 #define BALANCER_TASK_RATE 250
92 #define BALANCER_ACTIVE_STATE_COMMAND_BITS 1
93 #define BALANCER_ACTIVE_STATE_COMMAND_SHIFT 15
94 #define BALANCER_ACTIVE_STATE_COMMAND_MASK MASK(BALANCER_ACTIVE_STATE_COMMAND_BITS, BALANCER_ACTIVE_STATE_COMMAND_SHIFT)
95 #define BALANCER_ACTIVE_STATE_TIME_BITS 15
96 #define BALANCER_ACTIVE_STATE_TIME_SHIFT 0
97 #define BALANCER_ACTIVE_STATE_TIME_MASK MASK(BALANCER_ACTIVE_STATE_TIME_BITS, BALANCER_ACTIVE_STATE_TIME_SHIFT)
98 #define BALANCER_ACTIVE_STATE_CHARGE 0
99 #define BALANCER_ACTIVE_STATE_DISCHARGE 1
100 #define BALANCER_ACTIVE_STATE_COMMAND_SET(command, time) ((command << BALANCER_ACTIVE_STATE_COMMAND_SHIFT) + (time << BALANCER_ACTIVE_STATE_TIME_SHIFT))
117 #define BALANCER_AB_CURRENT_CHARGE_12CELL 2600
118 #define BALANCER_AB_CURRENT_DISCHARGE_12CELL 2400
119 #define BALANCER_AB_CURRENT_CHARGE_6CELL 2200
120 #define BALANCER_AB_CURRENT_DISCHARGE_6CELL 2400
121 #define BALANCER_CD_CURRENT_CHARGE_12CELL 4000
122 #define BALANCER_CD_CURRENT_DISCHARGE_12CELL 4300
123 #define BALANCER_CD_CURRENT_CHARGE_6CELL 3400
124 #define BALANCER_CD_CURRENT_DISCHARGE_6CELL 4000
125 #define BALANCER_CURRENT_SCALE_FACTOR (1L << BALANCER_CURRENT_SCALE_FACTOR_SHIFT)
126 #define BALANCER_CURRENT_SCALE_FACTOR_SHIFT 8
127 #define BALANCER_CURRENT_SCALE_CALC(desired_current, base_current) ((BALANCER_CURRENT_SCALE_FACTOR*(desired_current - base_current) + base_current/2) / base_current)
int16 BALANCER_PASSIVE_STATE_TYPE
Bitmap for LTC6804_NUM_CELLV_ADC passive balancers on one DC2100A, 1 = ON and 0 = Off...
void Balancer_Start(void)
Places Balancer Control Task in the BALANCER_CONTROL_ON state.
void Balancer_Max_and_Nextstop_Find(void)
Forces recalculation of the longest and shortest (yet non-zero) active balance times in the DC2100A s...
BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Next_Stop
The shortest, yet non-zero, active balance time in the DC2100A system.
BALANCER_ACTIVE_STATE_TYPE Balancer_Active_State[DC2100A_MAX_BOARDS][DC2100A_NUM_CELLS]
The state of each active cell balancer on each DC2100A in the system.
BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Max
The longest active balance time in the DC2100A system.
Balancing commands are suspended.
void Balancer_Control_Task(void)
Executes the Balancer Control task.
BOOLEAN Balancer_Synchronous_Mode_Get(void)
Returns if Balancer Control Task is configured for synchronous mode.
int16 BALANCER_ACTIVE_STATE_TYPE
Size of structure used for balancer active state.
Balancing commands are being executed for a timed value for each cell.
BALANCER_PASSIVE_STATE_TYPE Balancer_Passive_State[DC2100A_MAX_BOARDS]
Bitmap for LTC6804_NUM_CELLV_ADC passive balancers on one DC2100A, 1 = ON and 0 = Off...
void Balancer_Synchronous_Mode_Set(BOOLEAN synchronous_mode)
Sets Balancer Control Task for synchronous or asynchronous mode.
BOOLEAN Balancer_Wakeup_Init(void)
Initializes the parts of the Balancer Module, that need to be initialized upon wakeup of the LTC3300-...
int8 Balancer_Active_Board_Max
The board with the longest remaining balance time.
Watchdog is being activated to prevent LTC3300s from going to sleep, but raw commands are being sent ...
BALANCER_CONTROL_STATE_TYPE
int8 Balancer_Active_Board_Next_Stop
The cell with the shortest, yet non-zero, remaining balance time.
void Balancer_Stop(void)
Places Balancer Control Task in the BALANCER_CONTROL_OFF state immediately, as it's possible there's ...
void Balancer_Set(void)
Places Balancer Control Task in the BALANCER_CONTROL_SETUP state.
Balancing commands are being loaded.
signed int32 BALANCER_DELTA_Q_TYPE
Data Type for amount of charge to move from a cell in mAs.
void Balancer_Suspend(void)
Places Balancer Control Task in the BALANCER_CONTROL_SUSPEND state immediately as it's possible there...
void Balancer_GUI(void)
Places Balancer Control Task in the BALANCER_CONTROL_GUI state, stopping all control of balancers by ...
BOOLEAN Balancer_Is_Balancing(void)
Returns if any balancer is actively balancing.
void Balancer_Init(void)
Initializes the parts of the Balancer Module, that need to be initialized upon power-up of the PIC...