CUER
/
charger_code
Code to run on the charger board (used to charge the car from the mains).
Diff: charger.h
- Revision:
- 7:70cf5bff23f9
- Parent:
- 5:756fae795d37
- Child:
- 10:839e8f984d28
--- a/charger.h Sun Jul 30 23:01:15 2017 +0000 +++ b/charger.h Sun Sep 10 11:10:54 2017 +0000 @@ -5,15 +5,14 @@ #define DEBUG 1 -#define MAX_VOLTAGE 155000.0 -#define MAX_CURRENT 10000.0 -#define RISING_BALANCE_THRESHOLD 4150 //DUMMY VALUE FOR NOW, THINK ABOUT THE ACTUAL VALUE -#define KI_CHARGE 2.5 -#define KI_BALANCE 0.6 -#define TIME_STEP 500 -#define PACK_CAPACITY 24 //in Ah -//#define TEMP_RAMP_START -5.0 -//#define TEMP_RAMP_FINISH -1.5 +#define MAX_PACK_VOLTAGE 138600.0 // 33 * 4.2 +#define MAX_CURRENT 10000.0 //limited by charger +#define MAX_CELL_VOLTAGE 4250 +#define CHARGING_FINISHED_THRESHOLD_VOLTAGE 4200 +#define DEEP_DISCHARGE_THRESHOLD_VOLTAGE 3000 +#define CHARGING_FINISHED_THRESHOLD_CURRENT 800 +#define DEEP_DISCHARGE_MAX_CURRENT 2000 +#define PACK_CAPACITY 42 //in Ah #define CHARGER_MSG_TIMEOUT_MS 6000 #define BMS_MSG_TIMEOUT_MS 2000 @@ -30,7 +29,26 @@ #define CHARGER_CAN_WRITE_PIN p10 #define CHARGER_CAN_READ_PIN p9 +extern uint8_t charger_status; //status packet given by charger, see Elcon CAN Specification in google drive +extern bool precharge_status; +extern bool comms_timeout; +extern bool charger_failure; +extern bool charge_finished; +extern bool bms_error; +extern bool charging; +extern float min_cell_voltage; //mV +extern float max_cell_voltage;//mV + +extern float charger_current; //mA +extern float charger_voltage; //mV + +extern float desired_current; //mA +extern float desired_voltage; //mV + +extern float voltage_error; //mV //This = RISING_BALANCE_THRESHOLD - max_cell_voltage + +extern uint8_t charger_control; #endif \ No newline at end of file