Repository navigation
fix(trapezoid commutation): non-centred modulation produced no output for Uq < 0 - #580
Open
stijncarelsbergh wants to merge 1 commit into
Open
stijncarelsbergh wants to merge 1 commit into
stijncarelsbergh wants to merge 1 commit into
Conversation
… for Uq < 0 The trapezoid branches used `center = Uq` for non-centred modulation, which works for Uq > 0 but makes all three phase voltages <= 0 for Uq < 0; setPwm() clamps them to 0, so the motor gets no voltage at all in one direction. The sine/SVPWM branches handle this by shifting the phases up by their minimum, which is what non-centred modulation means for every mode. Using the same min-clamp for the trapezoid modes is exactly equivalent for Uq > 0 (every sector map contains a -1, so min = -Uq and the result is map*Uq + Uq as before) and gives the correct shifted waveform for Uq < 0.
Collaborator
|
I once had Claude check the library for bugs and it also mentioned this case. Nobody probably experienced the bug because it only happens with trapezoidal commutation/non centered/negative torque but it's worth fixing/testing it. Claude is telling me there is a simpler and equivalent fix: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(trapezoid commutation): non-centred modulation produced no output for Uq < 0
The trapezoid branches used
center = Uqfor non-centred modulation, which worksfor Uq > 0 but makes all three phase voltages <= 0 for Uq < 0; setPwm() clamps
them to 0, so the motor gets no voltage at all in one direction. The sine/SVPWM
branches handle this by shifting the phases up by their minimum, which is what
non-centred modulation means for every mode.
Using the same min-clamp for the trapezoid modes is exactly equivalent for
Uq > 0 (every sector map contains a -1, so min = -Uq and the result is
map*Uq + Uq as before) and gives the correct shifted waveform for Uq < 0.
Split out of #571 at your request: one fix per PR, against
dev. The branch containsnothing else, so it can be reviewed, amended or dropped on its own.
The CI board matrix runs automatically; I did not run any hardware test, so the behavioural
claims are from reading the code plus the compiler. Happy to adjust the wording, split it
differently or drop it - no attachment to this one.