DC Regulation
This module governs the DC side of the genset by limiting the generation demand. It watches three limits and follows whichever is the most restrictive at the moment:
- the voltage limit (
ubmax) — the primary regulator: it holds the DC bus at a configured voltage by backing the generation off above it, - the current limits — the total DC generation current (
ibneg_total), and the battery charging current when a BMS reports it (ibneg_bms).
When a measured value exceeds its limit, the generation demand is gradually reduced until it settles at the limit. When all values are back within their limits, the demand recovers without overshooting into the nearest limit. The handover between the limits — typically from constant current to constant voltage as the battery fills — is seamless: the new limit takes over at once, without a pause or an overshoot.
The limit in charge is signaled in the status word — CC (constant current) or CV (constant voltage), the classic charging regimes — and the limitation is reflected in the reported capability, so a host following the capability automatically backs the engine throttle off as well.
All parameters live in the /dc directory.
The driver-level limiters (/driver/limiter/ibneg, /driver/limiter/ubmax) remain active as independent low-level backstops in each controller and should still be configured as the hard safety limits.
With the pure propeller load line (load_cmd_k = 0) the demand does not scale the loading torque directly — the DC limits then act through the reported capability and rely on the host throttle following it. A negative load_cmd_k restores their direct authority over the torque.
Voltage limit — the primary regulator
When the DC bus voltage exceeds ubmax, the generation demand is reduced centrally — in a pair, the reduction reaches both motors together.
Set /dc/ubmax to the desired system voltage and pair the generator with a small DC battery or a supercapacitor to stabilize the bus. The generation demand then regulates itself — when the host system draws power, the bus voltage sags and the limiter releases more generation; when the draw stops, the voltage rises and the limiter winds the generation back down toward idle. The result is a genset that dynamically follows the power draw of the host system and behaves as a standalone, regulated DC voltage source — no active cmd management by the host is required.
In a battery-dominated system the same limit acts as protection: it throttles the generation back on a full battery before the hard overvoltage protection would have to act.
This limit is distinct from the MODE_OVERVOLTAGE protection: the protection kills the engine on motor-side overvoltage (overspeed), while this limit gently unloads it on a high bus voltage. With a suitable ubmax the kill should never be reached in normal operation.
ubmax [V]
DC voltage limit — the generation demand is reduced when the bus voltage exceeds it. 0 disables.
ubgain [1/(V·s)]
Response speed of the voltage limit — how fast the generation follows a voltage excess. Higher reacts faster; too high makes the generation hunt around the limit.
For a smooth handover between the current limits and the voltage limit, keep ubgain ≈ ibgain / R, with R the internal resistance of the battery and its wiring — e.g. ubgain ≈ 40 × ibgain for 25 mΩ.
Current limits
Two current limits, independent of each other:
ibneg_totallimits the total DC generation current — the sum of the currents the controllers measure at their own terminals — engaged at all times, with or without a BMS. In a multi-master pair a missing or faulted peer contributes zero — a single healthy controller may then use the whole budget.ibneg_bmslimits the current reported by the BMS — which covers the whole battery — and is engaged while the report is valid. When the report is missing (never received, or timed out afterbms_tim), this limit releases and the others keep acting; the generation continues from its current level, without a step.
The battery current report comes from a customer-specific CAN message. The public firmware has no battery current input — only the ibneg_total limitation of the summed controller currents is available.
ibneg_bms [A]
Battery charging current limit (as reported by the BMS). Entered as a negative value, like the driver's /driver/limiter/ibneg — e.g. -40 limits the charging current to 40 A (bms_current is negative while charging). Generation is reduced to keep bms_current above this value. 0 disables.
ibneg_total [A]
Total DC generation current limit — the sum of the currents the controllers feed into the bus (not tied to the battery); engaged at all times, with or without a BMS. 0 disables.
ibgain [1/(A·s)]
Response speed of the current limits — how fast the generation follows a current excess. For its ratio to ubgain, see above.
bms_tim [ms]
Timeout of the BMS battery current message. After this time without a valid report, the ibneg_bms limit releases — ibneg_total and ubmax keep acting — and the problem is signalized as BMS/Battery failure in the status word. 0 disables the timeout.
States
| State | Unit | Description |
|---|---|---|
limit | - | DC limitation of the generation demand, 0–1, 1 = no limitation |
limit_src | - | The limit in charge: 0 none, 1 ubmax (CV), 2 ibneg_total (CC), 3 ibneg_bms (CC) |
bms_current | A | Battery current from the BMS report, negative = charging |
bms_tmo | ms | Remaining BMS message timeout, 0 = timed out |