I think I am missing something about how the motor controller charges a battery when the generator EMF is below the battery voltage (when voltage boost is required, using flyback EMF).
Looking at the Odrive v3.5 controller schematic, a pretty standard driver circuit is used; the circuit contains diodes allowing reverse/recirculating current flow when switched accordingly. As I understand it, this circuit can be operated in at least two charging modes, depending on how the PWMs are used - either using flyback to boost voltage to charge the battery (when battery voltage is higher than generator EMF), or only using the generator EMF to charge the battery (no flyback voltage boost).
Also as I understand it - in boost mode and PWM state 1, current is recirculating through diodes and two of the motor phases, and no current is flowing in the battery; current builds until the PWM switches to state 2, where the current can then flow into the battery. 0% duty cycle would be if it is always in PWM state 1 (recirculating/building), and never state 2 (flowing back into battery). 100% duty cycle would be always state 2, never 1.
Hence my confusion - if my understanding is correct (it must not be?), when generating in boost mode the current magnitude goes up at lower duty cycle, and down at higher duty cycle (the opposite of what occurs when in motoring mode and the battery is driving the motor). This is because in generating mode with flyback boost, the windings are effectively shorted in state 1 and current is increasing, whereas in state 2 current is decreasing as it dissipates into the battery (going to zero when flyback voltage + gen EMF drops below battery voltage). Avg current increases with time spent in PWM state1, whereas avg current decreases with time spent in PWM state 2.
Is this accurate?
If it operated this way, would it also complicate the story wrt controlling negative torque when voltage boost is NOT required - since current would be flowing regardless of PWM state (but at different rates)?
I think I see my misunderstanding - when operating with negative torque (torque command is in the opposite direction as motor rotation), the torque value has a negative sign, which means the proportional current controller will decrease PWM duty cycle when more negative torque is required (this is the same as reducing the duty cycle when less positive torque is required). So there is no actual inversion of the PWM duty cycle/torque magnitude relationship, since torque is negative in this regime.
Hi! So, this is one way of thinking about it, and it’s a very very natural way coming from normal power converters, where things are always either in buck mode or boost mode. However, it works a bit differently when you’re dealing with motors – not because there’s some major intrinsic difference in the actual power electronics layout, but because you’re always thinking about and modulating the current, instead of the voltage.
A few loose scattered thoughts, please let me know if you need a bit more explanation to fill things in. Note some oversimplifications here and there:
- In a FOC controller (like what the ODrive uses), the target variable to control is always the motor current, e.g. current through a winding.
- Motor windings are generally very high inductance, and in the ODrive’s ~48kHz effective switching frequency, the inductor current varies negligibly
- As such, we can analyze the motor coils as constant current sources/sinks
- The ODrive doesn’t differentiate internally between positive or negative bus current, similarly it doesn’t differentiate between positive and negative motor current in a given coil – there’s no if/else for current polarity or anything like that
- Instead, the internal loops modulate the average voltage (e.g. PWM duty cycle) at each phase of the motor to drive the motor coil current to the desired value.
- The ODrive uses center-aligned PWM, which means that the “neutral” state of each winding is actually an average of about half the DC bus voltage. It’s best to think less of this as PWM duty cycles, and more as adjusting the voltage at each terminal (since the motor smooths out all the switching)
I like to think of it in terms of brushed motors, since then you don’t have to think about commutation (it’s very similar to a brushless motor, just with mechanical commutation).
Here’s a quick janky basic sim of said brushed motor simplification (just resistor+inductor+voltage source for back-emf). Sliders for the motor back-emf voltage and the duty cycle (from -1 to 1, corresponding to -24V to 24V across the motor).
In a situation where we have e.g. +6V back-emf but ~0.33 duty cycle (both positive), the motor current will increase until we reach equilibrium across the motor resistance (which ~never happens in the case of the ODrive, it actively servos the current to desired value, but it’s helpful for this simplification): https://tinyurl.com/2ddm8l4u. This is “motoring”.
But if we have a duty cycle with an opposite sign than the motor back-emf voltage, the motor current will actively decrease, and we’ll regenerate current to the bus: https://tinyurl.com/26xhnjqk
A long, but very very nice intro to all of this is in James Robert Mevey’s master’s thesis: https://krex.k-state.edu/server/api/core/bitstreams/e3f7aa0b-4833-44e4-9ef0-af09f411baa1/content
There’s also a nice writeup on H-bridge control here, a lot of the fundimentals are similar: H-Bridge Secrets | Modular Circuits