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:
+10
-10
@@ -462,7 +462,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
&& bat_temperature < bat_conf->charge_temp_max - 1
|
||||
&& bat_temperature > bat_conf->charge_temp_min + 1)
|
||||
{
|
||||
port->bus->sink_voltage_bound = bat_conf->topping_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->topping_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
port->pos_current_limit = bat_conf->charge_current_max;
|
||||
full = false;
|
||||
@@ -475,7 +475,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
}
|
||||
case CHG_STATE_BULK: {
|
||||
// continuously adjust voltage setting for temperature compensation
|
||||
port->bus->sink_voltage_bound = bat_conf->topping_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->topping_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
|
||||
if (port->bus->voltage > port->bus->sink_control_voltage()) {
|
||||
@@ -486,7 +486,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
}
|
||||
case CHG_STATE_TOPPING: {
|
||||
// continuously adjust voltage setting for temperature compensation
|
||||
port->bus->sink_voltage_bound = bat_conf->topping_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->topping_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
|
||||
if (port->bus->voltage >= port->bus->sink_control_voltage() - 0.05F) {
|
||||
@@ -515,12 +515,12 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
num_deep_discharges - deep_dis_last_equalization
|
||||
>= bat_conf->equalization_trigger_deep_cycles))
|
||||
{
|
||||
port->bus->sink_voltage_bound = bat_conf->equalization_voltage;
|
||||
port->bus->sink_voltage_intercept = bat_conf->equalization_voltage;
|
||||
port->pos_current_limit = bat_conf->equalization_current_limit;
|
||||
enter_state(CHG_STATE_EQUALIZATION);
|
||||
}
|
||||
else if (bat_conf->trickle_enabled) {
|
||||
port->bus->sink_voltage_bound = bat_conf->trickle_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->trickle_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
enter_state(CHG_STATE_TRICKLE);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
}
|
||||
case CHG_STATE_TRICKLE: {
|
||||
// continuously adjust voltage setting for temperature compensation
|
||||
port->bus->sink_voltage_bound = bat_conf->trickle_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->trickle_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
|
||||
if (port->bus->voltage >= port->bus->sink_control_voltage()) {
|
||||
@@ -553,7 +553,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
}
|
||||
case CHG_STATE_EQUALIZATION: {
|
||||
// continuously adjust voltage setting for temperature compensation
|
||||
port->bus->sink_voltage_bound = bat_conf->equalization_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->equalization_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
|
||||
// current or time limit for equalization reached
|
||||
@@ -566,7 +566,7 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
discharged_Ah = 0; // reset coulomb counter again
|
||||
|
||||
if (bat_conf->trickle_enabled) {
|
||||
port->bus->sink_voltage_bound = bat_conf->trickle_voltage +
|
||||
port->bus->sink_voltage_intercept = bat_conf->trickle_voltage +
|
||||
bat_conf->temperature_compensation * (bat_temperature - 25);
|
||||
enter_state(CHG_STATE_TRICKLE);
|
||||
}
|
||||
@@ -582,8 +582,8 @@ void Charger::charge_control(BatConf *bat_conf)
|
||||
|
||||
void Charger::init_terminal(BatConf *bat) const
|
||||
{
|
||||
port->bus->sink_voltage_bound = bat->topping_voltage;
|
||||
port->bus->src_voltage_bound = bat->voltage_load_disconnect;
|
||||
port->bus->sink_voltage_intercept = bat->topping_voltage;
|
||||
port->bus->src_voltage_intercept = bat->voltage_load_disconnect;
|
||||
|
||||
port->neg_current_limit = -bat->discharge_current_max;
|
||||
port->pos_current_limit = bat->charge_current_max;
|
||||
|
||||
+3
-3
@@ -231,10 +231,10 @@ static DataNode data_nodes[] = {
|
||||
#endif
|
||||
|
||||
#if CONFIG_HV_TERMINAL_NANOGRID
|
||||
TS_NODE_FLOAT(0x65, "GridSink_V", &hv_bus.sink_voltage_bound, 2,
|
||||
TS_NODE_FLOAT(0x65, "GridSink_V", &hv_bus.sink_voltage_intercept, 2,
|
||||
ID_INPUT, TS_ANY_R | TS_ANY_W, 0),
|
||||
|
||||
TS_NODE_FLOAT(0x66, "GridSrc_V", &hv_bus.src_voltage_bound, 2,
|
||||
TS_NODE_FLOAT(0x66, "GridSrc_V", &hv_bus.src_voltage_intercept, 2,
|
||||
ID_INPUT, TS_ANY_R | TS_ANY_W, 0),
|
||||
#endif
|
||||
|
||||
@@ -273,7 +273,7 @@ static DataNode data_nodes[] = {
|
||||
ID_OUTPUT, TS_ANY_R, 0),
|
||||
#endif
|
||||
|
||||
TS_NODE_FLOAT(0x7A, "ChgTarget_V", &bat_bus.sink_voltage_bound, 2,
|
||||
TS_NODE_FLOAT(0x7A, "ChgTarget_V", &bat_bus.sink_voltage_intercept, 2,
|
||||
ID_OUTPUT, TS_ANY_R, 0),
|
||||
|
||||
TS_NODE_FLOAT(0x7B, "ChgTarget_A", &bat_terminal.pos_current_limit, 2,
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ int Dcdc::perturb_observe_controller()
|
||||
"out: %.2fV (target %.2fV) %.2fA (limit %.2fA), "
|
||||
"PWM: %.1f, chg_state: %d, pwr_inc: %d, buck/boost: %d\n",
|
||||
out->power, power_prev, in->bus->voltage, in->current, in->neg_current_limit,
|
||||
out->bus->voltage, out->bus->sink_voltage_bound, out->current, out->pos_current_limit,
|
||||
out->bus->voltage, out->bus->sink_voltage_intercept, out->current, out->pos_current_limit,
|
||||
half_bridge_get_duty_cycle() * 100.0, state, pwr_inc_goal, pwr_inc_pwm_direction);
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ void PowerPort::init_nanogrid()
|
||||
bus->src_droop_res = 0.1;
|
||||
|
||||
// also initialize the connected bus
|
||||
bus->src_voltage_bound = 30.0; // starting buck mode above this point
|
||||
bus->sink_voltage_bound = 28.0; // boost mode until this voltage is reached
|
||||
bus->src_voltage_intercept = 30.0; // starting buck mode above this point
|
||||
bus->sink_voltage_intercept = 28.0; // boost mode until this voltage is reached
|
||||
}
|
||||
|
||||
void PowerPort::energy_balance()
|
||||
|
||||
+6
-6
@@ -45,7 +45,7 @@ public:
|
||||
* This value is the voltage at zero current. Values for other currents are calculated
|
||||
* using the droop resistance.
|
||||
*/
|
||||
float sink_voltage_bound;
|
||||
float sink_voltage_intercept;
|
||||
|
||||
/**
|
||||
* Lower voltage boundary where this bus may be used to source current.
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
* This value is the voltage at zero current. Values for other currents are calculated
|
||||
* using the droop resistance.
|
||||
*/
|
||||
float src_voltage_bound;
|
||||
float src_voltage_intercept;
|
||||
|
||||
/**
|
||||
* Droop resistance to adjust voltage bounds for current in sourcing direction
|
||||
@@ -91,11 +91,11 @@ public:
|
||||
* Calculate current-compensated src control voltage, considering droop and series multiplier
|
||||
*
|
||||
* @param voltage_zero_current Voltage at zero current (without droop). If this parameter is
|
||||
* left empty, the src_voltage_bound is considered.
|
||||
* left empty, the src_voltage_intercept is considered.
|
||||
*/
|
||||
inline float src_control_voltage(float voltage_zero_current = 0)
|
||||
{
|
||||
float v0 = (voltage_zero_current == 0) ? src_voltage_bound : voltage_zero_current;
|
||||
float v0 = (voltage_zero_current == 0) ? src_voltage_intercept : voltage_zero_current;
|
||||
if (ref_current != nullptr) {
|
||||
return (v0 - src_droop_res * (*ref_current)) * series_multiplier;
|
||||
}
|
||||
@@ -108,11 +108,11 @@ public:
|
||||
* Calculate current-compensated sink control voltage, considering droop and series multiplier
|
||||
*
|
||||
* @param voltage_zero_current Voltage at zero current (without droop). If this parameter is
|
||||
* left empty, the sink_voltage_bound is considered.
|
||||
* left empty, the sink_voltage_intercept is considered.
|
||||
*/
|
||||
inline float sink_control_voltage(float voltage_zero_current = 0)
|
||||
{
|
||||
float v0 = (voltage_zero_current == 0) ? sink_voltage_bound : voltage_zero_current;
|
||||
float v0 = (voltage_zero_current == 0) ? sink_voltage_intercept : voltage_zero_current;
|
||||
if (ref_current != nullptr) {
|
||||
return (v0 - sink_droop_res * (*ref_current)) * series_multiplier;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user