DC/DC test function and dead time config added

- The DC/DC test function slowly ramps up the duty cycle to 50% to allow defined measurements of gate driver, switch node etc. with an oscilloscope (without disturbance by the MPPT algorithm)

- The dead-time between HS and LS gate on/off is now configurable for each PCB and not fixed to 300 ns for all PCBs anymore.
This commit is contained in:
Martin Jaeger
2019-07-05 11:01:35 +02:00
parent 7ee248cf81
commit 7300406b94
9 changed files with 49 additions and 5 deletions
+36
View File
@@ -181,6 +181,42 @@ void dcdc_control(dcdc_t *dcdc, dc_bus_t *hs, dc_bus_t *ls)
}
}
void dcdc_test(dcdc_t *dcdc, dc_bus_t *hs, dc_bus_t *ls)
{
if (half_bridge_enabled()) {
if (half_bridge_get_duty_cycle() > 0.5) {
half_bridge_duty_cycle_step(-1);
}
}
else {
static int startup_delay_counter = 0;
static const int num_wait_calls = (CONTROL_FREQUENCY / 10 >= 1) ? (CONTROL_FREQUENCY / 10) : 1; // wait at least 100 ms for voltages to settle
if (_dcdc_check_start_conditions(dcdc, ls, hs) && ls->voltage < dcdc->ls_voltage_max) {
if (startup_delay_counter >= num_wait_calls) {
// Don't start directly at Vmpp (approx. 0.8 * Voc) to prevent high inrush currents and stress on MOSFETs
half_bridge_start(ls->voltage / (hs->voltage - 1));
printf("DC/DC buck mode start (HS: %.2fV, LS: %.2fV, PWM: %.1f).\n", hs->voltage, ls->voltage, half_bridge_get_duty_cycle() * 100);
}
else {
startup_delay_counter++;
}
}
else if (_dcdc_check_start_conditions(dcdc, hs, ls) && hs->voltage < dcdc->hs_voltage_max) {
if (startup_delay_counter >= num_wait_calls) {
// will automatically start with max. duty (0.97) if connected to a nanogrid not yet started up (zero voltage)
half_bridge_start(ls->voltage / (hs->voltage + 1));
printf("DC/DC boost mode start (HS: %.2fV, LS: %.2fV, PWM: %.1f).\n", hs->voltage, ls->voltage, half_bridge_get_duty_cycle() * 100);
}
else {
startup_delay_counter++;
}
}
else {
startup_delay_counter = 0; // reset counter
}
}
}
void dcdc_self_destruction()
{
printf("Charge controller self-destruction called!\n");