Code to run on the charger board (used to charge the car from the mains).

Dependencies:   mbed CUER_CAN

Committer:
DasSidG
Date:
Sun Jul 30 22:59:37 2017 +0000
Revision:
5:756fae795d37
Parent:
3:a7626dffb64a
Child:
7:70cf5bff23f9
Made it calculate the voltage error itself.; Made it reset the relevant part of the CAN buffer each time it reads it so that it uses fresh data each time; ; Ready for testing.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DasSidG 3:a7626dffb64a 1 #ifndef CHARGER_H
DasSidG 3:a7626dffb64a 2 #define CHARGER_H
DasSidG 3:a7626dffb64a 3
drajan 0:6d930d0d13a1 4 #include "mbed.h"
drajan 0:6d930d0d13a1 5
DasSidG 5:756fae795d37 6 #define DEBUG 1
DasSidG 5:756fae795d37 7
DasSidG 1:0c77e20b4d4c 8 #define MAX_VOLTAGE 155000.0
DasSidG 1:0c77e20b4d4c 9 #define MAX_CURRENT 10000.0
DasSidG 5:756fae795d37 10 #define RISING_BALANCE_THRESHOLD 4150 //DUMMY VALUE FOR NOW, THINK ABOUT THE ACTUAL VALUE
DasSidG 5:756fae795d37 11 #define KI_CHARGE 2.5
DasSidG 5:756fae795d37 12 #define KI_BALANCE 0.6
drajan 0:6d930d0d13a1 13 #define TIME_STEP 500
DasSidG 5:756fae795d37 14 #define PACK_CAPACITY 24 //in Ah
DasSidG 5:756fae795d37 15 //#define TEMP_RAMP_START -5.0
DasSidG 5:756fae795d37 16 //#define TEMP_RAMP_FINISH -1.5
drajan 0:6d930d0d13a1 17
DasSidG 1:0c77e20b4d4c 18 #define CHARGER_MSG_TIMEOUT_MS 6000
DasSidG 1:0c77e20b4d4c 19 #define BMS_MSG_TIMEOUT_MS 2000
DasSidG 1:0c77e20b4d4c 20
DasSidG 5:756fae795d37 21 //Macros for charging to avoid confusion and potentioal errors
DasSidG 5:756fae795d37 22 #define START_CHARGING 0
DasSidG 5:756fae795d37 23 #define STOP_CHARGING 1
DasSidG 1:0c77e20b4d4c 24
DasSidG 1:0c77e20b4d4c 25 #define CAN_BUFFER_SIZE 255 //Setting this to be quite large, should be equal to max # of ids expected to receive
drajan 0:6d930d0d13a1 26
DasSidG 1:0c77e20b4d4c 27 // CAN pins
DasSidG 1:0c77e20b4d4c 28 #define CAR_CAN_WRITE_PIN p29
DasSidG 1:0c77e20b4d4c 29 #define CAR_CAN_READ_PIN p30
DasSidG 1:0c77e20b4d4c 30 #define CHARGER_CAN_WRITE_PIN p10
DasSidG 1:0c77e20b4d4c 31 #define CHARGER_CAN_READ_PIN p9
drajan 0:6d930d0d13a1 32
DasSidG 1:0c77e20b4d4c 33
DasSidG 3:a7626dffb64a 34
DasSidG 3:a7626dffb64a 35 #endif
drajan 0:6d930d0d13a1 36