Implemented maximum voltage check for DC/DC

This commit is contained in:
Martin Jaeger
2019-03-19 10:11:52 +01:00
parent 6c9ea2ee84
commit e94fd88a5e
2 changed files with 14 additions and 6 deletions
+10 -2
View File
@@ -28,8 +28,8 @@ void dcdc_init(dcdc_t *dcdc)
dcdc->mode = DCDC_MODE_INIT;
dcdc->ls_current_max = DCDC_CURRENT_MAX;
dcdc->ls_current_min = 0.05; // A if lower, charger is switched off
dcdc->hs_voltage_max = 55.0; // V
dcdc->ls_voltage_max = 30.0; // V
dcdc->hs_voltage_max = HIGH_SIDE_VOLTAGE_MAX; // V
dcdc->ls_voltage_max = LOW_SIDE_VOLTAGE_MAX; // V
//dcdc->offset_voltage_start = 4.0; // V charging switched on if Vsolar > Vbat + offset
//dcdc->offset_voltage_stop = 1.0; // V charging switched off if Vsolar < Vbat + offset
dcdc->restart_interval = 60; // s --> when should we retry to start charging after low solar power cut-off?
@@ -109,8 +109,16 @@ void dcdc_control(dcdc_t *dcdc, power_port_t *hs, power_port_t *ls)
dcdc->off_timestamp = time(NULL);
printf("DC/DC stop.\n");
}
if (ls->voltage > dcdc->ls_voltage_max || hs->voltage > dcdc->hs_voltage_max) {
half_bridge_stop();
dcdc->off_timestamp = time(NULL);
printf("DC/DC emergency stop (voltage limits exceeded).\n");
}
}
else {
if (ls->voltage > dcdc->ls_voltage_max || hs->voltage > dcdc->hs_voltage_max) {
return;
}
if (_dcdc_check_start_conditions(dcdc, ls, hs)) {
// Vmpp at approx. 0.8 * Voc --> take 0.9 as starting point for MPP tracking
half_bridge_start(ls->voltage / (hs->voltage * 0.9));
+4 -4
View File
@@ -46,11 +46,11 @@ enum dcdc_control_mode
* actual measurements and calibration parameters.
*/
typedef struct {
dcdc_control_mode mode;
dcdc_control_mode mode; ///< DC/DC mode (buck, boost or nanogrid)
// actual measurements
float ls_current; ///< Low-side (inductor) current
float temp_mosfets;
float temp_mosfets; ///< MOSFET temperature measurement (if existing)
// current state
float power; ///< Power at low-side (calculated by dcdc controller)
@@ -60,8 +60,8 @@ typedef struct {
// maximum allowed values
float ls_current_max; ///< Maximum low-side (inductor) current
float ls_current_min; ///< Minimum low-side current (if lower, charger is switched off)
float hs_voltage_max;
float ls_voltage_max;
float hs_voltage_max; ///< Maximum high-side voltage
float ls_voltage_max; ///< Maximum low-side voltage
// calibration parameters
//float offset_voltage_start; // V charging switched on if Vsolar > Vbat + offset