DC Regulation
This module governs the DC side of the genset by limiting the generation demand. Two independent limiters act together, and the smaller of the two wins:
- the voltage limiter — the primary regulator: it holds the DC bus at a configured voltage by backing the generation off above it,
- the current limiter — caps the total DC generation current (
ibneg_total), and the battery charging current when a BMS reports it (ibneg_bms).
Both are smooth integrating limiters: when the measured value exceeds the limit, the generation demand is gradually reduced until it settles at the limit, and it recovers the same way. Each limiter signals its activity in the status word — CC (constant current) and 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 speed-derived load line (load_cmd_k = 0) the demand does not scale the loading torque directly — these limiters 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 limiter — 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 limiter acts as protection: it throttles the generation back on a full battery before the hard overvoltage protection would have to act.
This limiter is distinct from the MODE_OVERVOLTAGE protection: the protection kills the engine on motor-side overvoltage (overspeed), while this limiter 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
Integrator gain of the voltage limiter.
Current limiter
Two independent current constraints act on the limiter — each contributes its own restriction, and the generation follows the combined result:
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 constraint releases andibneg_totalkeeps limiting alone.
The battery current report is a customer-specific CAN message that is compiled in. The public firmware has no battery current input — only the ibneg_total limitation of the summed controller currents is available.
ibneg_bms [A]
Maximum battery charging current (as reported by the BMS). Generation is reduced to keep the charging current below 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
Integrator gain of the current limiter.
bms_tim [ms]
Timeout of the BMS battery current message. After this time without a valid report, the ibneg_bms constraint releases — ibneg_total keeps limiting — and the problem is signalized as BMS/Battery failure in the status word. 0 disables the timeout.
States
| State | Unit | Description |
|---|---|---|
ub_limit | - | Voltage limiter output, 0–1, 1 = no limitation |
ib_limit | - | Current limiter output, 0–1, 1 = no limitation |
bms_current | A | Battery current from the BMS report, negative = charging |
bms_tmo | ms | Remaining BMS message timeout, 0 = timed out |