Rename src/sink_voltage_bound to _intercept
These variables define the voltage at zero current, which is the y axis intercept of the droop curve (voltage vs. current). As they do not always specifiy minimum or maximum boundary depending on the sign of the droop resistance, intercept is a more suitable name.
This commit is contained in:
+6
-6
@@ -19,7 +19,7 @@ static void init_structs_buck(int num_batteries = 1)
|
||||
dev_stat.error_flags = 0;
|
||||
hv_terminal.init_solar();
|
||||
hv_terminal.bus->voltage = 20 * num_batteries;
|
||||
hv_terminal.bus->src_voltage_bound = 18 * num_batteries;
|
||||
hv_terminal.bus->src_voltage_intercept = 18 * num_batteries;
|
||||
hv_terminal.bus->series_multiplier = 1;
|
||||
hv_terminal.current = 0;
|
||||
hv_terminal.update_bus_current_margins();
|
||||
@@ -57,7 +57,7 @@ static void init_structs_boost(int num_batteries = 1)
|
||||
|
||||
hv_terminal.init_solar();
|
||||
dcdc_lv_port.bus->voltage = 20;
|
||||
dcdc_lv_port.bus->src_voltage_bound = 18;
|
||||
dcdc_lv_port.bus->src_voltage_intercept = 18;
|
||||
dcdc_lv_port.bus->series_multiplier = 1;
|
||||
dcdc_lv_port.current = 0;
|
||||
dcdc_lv_port.power = 0;
|
||||
@@ -213,7 +213,7 @@ void buck_derating_output_voltage_too_high()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
dcdc_lv_port.bus->voltage = dcdc_lv_port.bus->sink_voltage_bound + 0.1;
|
||||
dcdc_lv_port.bus->voltage = dcdc_lv_port.bus->sink_voltage_intercept + 0.1;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after < pwm_before); // less duty cycle = higher voltage
|
||||
@@ -235,7 +235,7 @@ void buck_derating_input_voltage_too_low()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->src_voltage_bound - 0.1;
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->src_voltage_intercept - 0.1;
|
||||
dcdc_lv_port.current = 0.2;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
@@ -314,7 +314,7 @@ void boost_derating_output_voltage_too_high()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->sink_voltage_bound + 0.5;
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->sink_voltage_intercept + 0.5;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after > pwm_before); // higher duty cycle = less power
|
||||
@@ -334,7 +334,7 @@ void boost_derating_input_voltage_too_low()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
dcdc_lv_port.bus->voltage = dcdc_lv_port.bus->src_voltage_bound - 0.1;
|
||||
dcdc_lv_port.bus->voltage = dcdc_lv_port.bus->src_voltage_intercept - 0.1;
|
||||
hv_terminal.current = 0.2;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
|
||||
+4
-4
@@ -33,8 +33,8 @@ static void load_init(LoadOutput *l, bool on = false, int num_batteries = 1)
|
||||
l->pos_current_limit = 10;
|
||||
l->bus->series_multiplier = num_batteries;
|
||||
l->bus->voltage = 14 * num_batteries;
|
||||
l->bus->sink_voltage_bound = 14.4;
|
||||
l->bus->src_voltage_bound = 12;
|
||||
l->bus->sink_voltage_intercept = 14.4;
|
||||
l->bus->src_voltage_intercept = 12;
|
||||
l->bus->sink_current_margin = 10;
|
||||
l->bus->src_current_margin = -10;
|
||||
l->junction_temperature = 25;
|
||||
@@ -93,7 +93,7 @@ void control_on_to_off_overvoltage()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init);
|
||||
load_init(&load_out, true);
|
||||
|
||||
bus.voltage = bus.sink_voltage_bound + 0.6;
|
||||
bus.voltage = bus.sink_voltage_intercept + 0.6;
|
||||
|
||||
// increase debounce counter to 1 before limit
|
||||
for (int i = 0; i < CONFIG_CONTROL_FREQUENCY; i++) {
|
||||
@@ -114,7 +114,7 @@ void control_on_to_off_overvoltage_dual_battery()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init);
|
||||
load_init(&load_out, true, 2);
|
||||
|
||||
bus.voltage = (bus.sink_voltage_bound + 0.6) * bus.series_multiplier;
|
||||
bus.voltage = (bus.sink_voltage_intercept + 0.6) * bus.series_multiplier;
|
||||
|
||||
// increase debounce counter to 1 before limit
|
||||
for (int i = 0; i < CONFIG_CONTROL_FREQUENCY; i++) {
|
||||
|
||||
Reference in New Issue
Block a user