In my code i included undervoltage safety so that car would notify the driver of inverter nearing to low battery voltage. I thought to setup two phases. The first phase is when battery would pass the mark of 3.3V per cell (316Vdc). The second phase is when cells pass the 3V per cell (288Vdc).
I made a mistake of simply turning ON Error and Voltage light for first phase. The second phase would trip inverter into error state.
So for testing i was driving for quite some time under 316Vdc (i removed one battery module for testing) and suddenly at 288Vdc i got to a point where it tripped! This is not a good option as those lights give you false sense of security and that trip in the end comes as a real surprise.
Second iteration works to put the VCU into "Turtle mode". I formed a pedal map 2 so it only provides about 50A worth of torque. That should be something the driver would notice but it would still allow them to drive to nearby EVSE.
Code: Select all
bool turtlemode = false; //turtle mode because of low voltage
....
void turtle_mode(); //declare a function
....
const int pedal_map_two[21][22] = { //pedal map for turtle mode
// Backup
// map 2..
/*250*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*500*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*625*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*750*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*1000*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*1250*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*1500*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*2000*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*2500*/ {0, 0, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*3000*/ {0, 0, 3, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*3500*/ {0, 0, 3, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*4000*/ {0, 0, 3, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*4500*/ {0, 0, 3, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*5000*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*5500*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*6000*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*6500*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*7000*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*7500*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*8000*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
/*10000*/ {0, 0, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8},
};
....
void turtle_mode() { // function itself
if (turtlemode == true) { // put the car in turtle mode if active
active_map = 2; // set the active throttle map to no. 2
if (timer1000_1.check() == 1)
{
digitalWrite(OUT11, !digitalRead(OUT11)); // Flash the Error LED at 1s interval
}
}
}
....
void canRX_389(const CAN_message_t &msg)
{
chargerHVbattryVolts = msg.buf[0] * 2; // Charger HV Battery Voltage
chargerACvolts = msg.buf[1];
chargerHVcurrent = msg.buf[2] * 0.1;
chargerTempCH = msg.buf[4] - 40;
}
....
void loop() //main function
...
turtle_mode(); // run the function inside main function
...
case driveForward: //when in forward mode you need turtle mode the most
...
// See if voltage is enough
if (( chargerHVbattryVolts < 316) && (chargerHVbattryVolts > 288) ) { // take information from charger and DCDC to observe HV voltage value
turtlemode = true; // Turtle mode, alowed motor torque is reduced!
}
else if ( chargerHVbattryVolts <= 288) { // stop with error if you are pushing it...
VCUstatusChangeCounter = 0;
VCUstatus = 7; //Error state ON!
}
else {
turtlemode = false;
}