thineight said:
Hello everyone,
yesterday I went for a trip with a positive climb of about 2000m, so for the first time I pushed my battery closer to the limit.
I've a 36v motor, OSF v.20 beta1, and a 620Wh battery (17.5Ah).
I set the motor limit to 450W for the offroad mode and 14A for current limit, so teoretically I could go from 570W (battery fully charged: 14A x 41V) to 420W (battery nearly empty: 14A x 30V).
With the battery fully charged and up to 1/3 remaining I noticed that my motor goes up the the 400-450W as expected from my limitations set, but as long as my battery goes down in voltage, the maximum power is reduced to approx 200W and does not reach to 400W anymore.
Theoretically it can still reach 400W (see above) but it does not.
The percentage left was around 20% (Voltage floating around 31V under load), as this is the first time I reach this level of battery I read carefully in the wiki and I found that the power is reduced in order to avoid to reach the cut off voltage.
It sounds to me reasonable, as it is perhaps better to have some assistance for longer time rather than the maximum until the end and then stop everything. What is the actual logic behind the "progressive power drop to increase the battery duration"?
Thanks
thineight said:
I am very happy with the current OSF firmware v.0.20beta and with the settings.
I noted a drop in peak power when the battery starts to be around 25% (this is the first time I discharged the battery that much during a trip) and I read in the wiki this limit is somehow foreseen to further extend the battery duration.
I just wanted to understand the logic in simple words. As I am not a professional programmer, it will take a week for me to open up the code, understand it and find the place where this logic is shown.
To me is sufficient a top-level answer like "for a 36V battery (range 41-->30v) from 34v the peak is linearly reduced to, say, 100W because .... "
First of all, I am very happy that you are satisfied with the 0.20.0 Beta 1! I know I have stated this a lot of times but the firmware will only get better in the future. It is a very solid foundation!
Second of all, let us try to answer your questions regarding the motor power limitations at low battery voltages in respect to the defined minimums. I will try to be very clear and try to convey the basic logic. Note that the explanation will be very simplified but if anyone wants a more in-depth explanation I will happily provide that.
--------------------------------
There is a current controller in the firmware that controls and limits the amount of current that goes to the motor. This is how we control the power. But it is more accurate to say that this is how we control the motor torque. The current is proportional to the torque.
The current controller will have several parameters that limit the amount of current at any given time. One example is the active riding mode limit. If we require 200 W of power and the battery voltage is 50 V we need 4 A of current. So the current controller in the firmware will send instructions to the motor controller to limit the current to 4 A.
Another parameter is the
maximum battery current. If we set that to 3 A the current controller will prioritize this lower limit compared to the previous example of 4 A. The current controller always uses the lowest limit.
Yet another parameter is the
low voltage cutoff. If the voltage gets below the
low voltage cutoff the current controller will automatically lower the current until the battery voltage is at or above the
low voltage cutoff.
So how do we control the current? Basically, we control the timing of the transistors in the motor controller. This is another way to say that we control the
duty cycle. By changing the
duty cycle we change the average voltage applied over the motor phases and therefore the average current that goes through the motor phases.
By increasing or lowering the
duty cycle we can change the amount of current that flows through the motor. So when we get to the battery
low voltage cutoff we immediately decrease the
duty cycle. This will in turn decrease the current flowing through the motor and as a result the motor power will go down.
Here is the current controller in our 0.20.0 firmware:
Code:
// check if to decrease, increase or maintain duty cycle
if ((ui8_g_duty_cycle > ui8_controller_duty_cycle_target) ||
(ui8_controller_adc_battery_current > ui8_controller_adc_battery_current_target) ||
(ui8_adc_motor_phase_current > ADC_10_BIT_MOTOR_PHASE_CURRENT_MAX) ||
(ui16_motor_speed_erps > ui16_max_motor_speed_erps) ||
(UI8_ADC_BATTERY_VOLTAGE < ui8_adc_battery_voltage_cut_off) ||
(ui8_brake_state))
{
// reset duty cycle ramp up counter (filter)
ui16_counter_duty_cycle_ramp_up = 0;
// ramp down duty cycle
if (++ui16_counter_duty_cycle_ramp_down > ui16_controller_duty_cycle_ramp_down_inverse_step)
{
ui16_counter_duty_cycle_ramp_down = 0;
// decrement duty cycle
if (ui8_g_duty_cycle > 0) { --ui8_g_duty_cycle; }
}
}
else if (ui8_g_duty_cycle < ui8_controller_duty_cycle_target)
{
// reset duty cycle ramp down counter (filter)
ui16_counter_duty_cycle_ramp_down = 0;
// ramp up duty cycle
if (++ui16_counter_duty_cycle_ramp_up > ui16_controller_duty_cycle_ramp_up_inverse_step)
{
ui16_counter_duty_cycle_ramp_up = 0;
// increment duty cycle
if (ui8_g_duty_cycle < PWM_DUTY_CYCLE_MAX) { ++ui8_g_duty_cycle; }
}
}
else
{
// duty cycle is where it needs to be so reset ramp counters (filter)
ui16_counter_duty_cycle_ramp_up = 0;
ui16_counter_duty_cycle_ramp_down = 0;
}
Notice that we check several parameters and if either one of those returns
true we will decrease the
duty cycle -> current -> power.
So at any give moment, the system will give us the maximum amount of power (actually current/torque) provided it does not go over the defined limits.
--------------------------------
EDIT: If anyone found this interesting and would want it on a wiki page, please let me know!