Skip to content

PWM resolves #4089 and #4090 and #4839 - #4812

Open
AHaumer wants to merge 35 commits into
modelica:masterfrom
AHaumer:PWM
Open

AHaumer wants to merge 35 commits into
modelica:masterfrom
AHaumer:PWM

Conversation

@AHaumer

@AHaumer AHaumer commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixes the bugs adressed in #4089 and #4090 and refines the example for testing.

@AHaumer AHaumer added this to the MSL4.1.1 milestone Sep 11, 2026
@AHaumer AHaumer self-assigned this Sep 11, 2026
@AHaumer AHaumer added bug Critical/severe issue L: Electrical.PowerConverters Issue addresses Modelica.Electrical.PowerConverters needs backporting Needs back-porting from the master branch create new reference results create new reference results labels Sep 11, 2026
@AHaumer AHaumer linked an issue Sep 11, 2026 that may be closed by this pull request

@christiankral christiankral left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do understand the changes in line 30-31 and 42-43 of Electrical/PowerConverters/DCAC/Control/IntersectivePWM.mo‎

Unfortunately I cannot understand why the quantities and the units of the some variables have been changed, as this is a non backwards compatible change. Shouldn't there be a solution the same units ...

@AHaumer

AHaumer commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks a lot for your thorough review @christiankral

I have to admit I don't understand your remark "why the quantities and the units of the some variables have been changed".
Which quantities and units have been changed?

Regarding the changes amplitude=uMax -> 2 and offset=-uMax/2 -> -1: There is a new gain block diving the signal by uMax.
This is not equivalent! I have to rethink this whether the new or the old version is correct.

Regarding the comparions SVPWM and IntersectivePWM: I have to dig into this.

@AHaumer
AHaumer marked this pull request as draft November 1, 2026 11:32
@AHaumer

AHaumer commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

After enhancing the documentation including clarification of the voltages, I'll check and adapt:

  • Electrical.PowerConverters.DCAC.Control.IntersectivePWM
  • Electrical.PowerConverters.DCAC.Control.SVPWM
    take care of Bugfix Electrical.PowerConverters.DCAC.Control.SVPWM #4840
    as well as these two examples
  • Electrical.PowerConverters.Examples.DCAC.PolyphaseTwoLevel..PolyphaseTwoLevel_PWM
  • Electrical.Machines.Examples.InductionMachines.IMC_InverterDrive

Since it is not possible to separate PR #4840 from this one in order to resolve the issues addressed here properly, these rather limited changes in SVPWM done in #4840 (issue #4839) have been incorporated here.
#4840 will be closed, and the issue addressed there is resolved with this PR.

@AHaumer AHaumer closed this Nov 2, 2026
@AHaumer AHaumer reopened this Nov 2, 2026
@AHaumer AHaumer changed the title PWM resolves #4089 and #4090 PWM resolves #4089 and #4090 and #4839 Nov 2, 2026
@MSL-RegressionTesting-CI

Copy link
Copy Markdown

@MSL-RegressionTesting-CI

Copy link
Copy Markdown

@AHaumer
AHaumer requested a review from casella November 11, 2026 10:07
@AHaumer

AHaumer commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@casella @GallLeo @MatthiasBSchaefer
As far as I see, "Some checks of the regression testing failed." doesn't make sense if we work on a bugfix.
Of course a bugfix can change the results, and new refercne results have to be generated.
How do we handle this properly?

@MatthiasBSchaefer

Copy link
Copy Markdown
Contributor

@casella @GallLeo @MatthiasBSchaefer As far as I see, "Some checks of the regression testing failed." doesn't make sense if we work on a bugfix. Of course a bugfix can change the results, and new refercne results have to be generated. How do we handle this properly?

Obviously the regression testing will fail, as long as the reference files are not updated. This absolutely makes sense.

You can download - potentially - new reference files from the report:
1.) click the links given in the comment for Modelica or ModelicaTest
2.) then choose the box, where the examples for the pull request were tested with Dymola (box in the lower right corner of the Dymola- section).
3.) There you can choose the relevant example
4.) In the report of the relevant example you can find a download-Button in the mSL-Reference section
5.) check the trajectories (they are only potentially new reference files)
6.) If you agree with the results, you can create a new commit adding these files as new references

@AHaumer

AHaumer commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@MatthiasBSchaefer I don't get it.
2) lower right corner? 0 failed?
grafik

@MatthiasBSchaefer

Copy link
Copy Markdown
Contributor

@AHaumer Yes, the box you marked in the picture.
This is where all the examples were simulated.
This is successful (0 failed), even if the trajectories diverge.

New reference results were created based on the simulation, not based on the trajectory-comparison. Such, the box in the lower right corner of the Dymola-pattern is the place of new reference files.

@MSL-RegressionTesting-CI

Copy link
Copy Markdown

@AHaumer

AHaumer commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@MatthiasBSchaefer how do I see what failed?

Failure: Some checks of the regression testing failed. Details:
https://serv.ltx.de/prs//4812/Modelica/PR_comparison_report.html
https://serv.ltx.de/prs//4812/ModelicaTest/PR_comparison_report.html

I tried to follow your advice and committed new reference results (Modelica.Electrical.Machines.Examples.InductionMachines.IMC_InverterDrive and Modelica.Electrical.PowerConverters.Examples.DCAC.PolyphaseTwoLevel.ThreePhaseTwoLevel_PWM) to the PR itself (is this correct?).
Why I was wondering:
For ThreePhaseTwoLevel_PWM I expected the new comparisonSignals with 4 signals but found an old one, whereas the csv contained the 4 signals.

The whole procedure seems to be complicated and confusing.

@MSL-RegressionTesting-CI

Copy link
Copy Markdown

@MSL-RegressionTesting-CI

Copy link
Copy Markdown

@christiankral christiankral left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I investigated Modelica.Electrical.PowerConverters.Examples.DCAC.PolyphaseTwoLevel.ThreePhaseTwoLevel_PWM, changing VNom from VNom=Vmax/sqrt(2) to half of this value: VNom=Vmax/sqrt(2)/2. Then I compared VNom with harmonic.y_rms for

  • SVPWM
  • Intersective
    and found the following result:
ThreePhaseTwoLevel_PWM

The ratio of the two results is 115.3V / 100V = 1.153 = $2 / \sqrt 3$

@christiankral

Copy link
Copy Markdown
Contributor

@AHaumer I do understand, that there is a difference for VNom=Vmax/sqrt(2) as the intersective PWM "saturates". But why is do the two results differ for half of this value.

@christiankral

Copy link
Copy Markdown
Contributor

I also compared uMax of in the intersective PWM model for the attached Modelica example ThreePhaseTwoLevel_PWM.mo:

MSL 4.1.0

ThreePhaseTwoLevel_PWM_uMax

uMax for the SVPWM and the intersective PWM are equal.

PR #4812

ThreePhaseTwoLevel_PWM_uMax-4812

uMax for the SVPWM is now different from the intersective PWM case. This is a non backwards compatible change. Therefore, we have to put this into the release notes.

@AHaumer

AHaumer commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

I investigated Modelica.Electrical.PowerConverters.Examples.DCAC.PolyphaseTwoLevel.ThreePhaseTwoLevel_PWM, changing VNom from VNom=Vmax/sqrt(2) to half of this value: VNom=Vmax/sqrt(2)/2. Then I compared VNom with harmonic.y_rms for

* SVPWM

* Intersective
  and found the following result:

The ratio of the two results is 115.3V / 100V = 1.153 = 2 / sqrt(3)

@christiankral This is correct. Both PWM methods are in the linear mode without overmodulation.
How would you increase the base harmonic of the carrier based modulation without being nonlinear?
If we increase artificially the amplitude of the reference signal by 2/sqrt(3), we would achieve a higher base harmonic rms
until we reach saturation at sqrt(3)/2 of the maximum voltage and achieve a contiguous on-block at the maximum of the reference voltage.
This is not the desired behaviour. If we want to achieve higher output, we have to increase the base harmonic
without increasing the maximum of the reference voltage by injecting a zero system which doesn't affect the machine
(neglecting the potential of the starpoint).
I could add (in a backwards compatible manner) such a block that adds a zero system. Shall I?

@AHaumer

AHaumer commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

I also compared uMax of in the intersective PWM model for the attached Modelica example ThreePhaseTwoLevel_PWM.mo:

MSL 4.1.0

ThreePhaseTwoLevel_PWM_uMax

uMax for the SVPWM and the intersective PWM are equal.

PR #4812

ThreePhaseTwoLevel_PWM_uMax-4812

uMax for the SVPWM is now different from the intersective PWM case. This is a non backwards compatible change. Therefore, we have to put this into the release notes.

@christiankral you are right. This is a bugfix, the handling of maximum voltage was wrong. Here's a comparison:

MSL 4.1.0

SVPWM
parameter Real uMax "Maximum length of space vector = half diagonal of hexagon";
IntersectivePWM
parameter Real uMax "Maximum amplitude of signal";
PWM
parameter Real uMax "Maximum amplitude of signal";
PowerConverters.DCAC.Control.SVPWM svPWM(uMax=uMax, …)…;
PowerConverters.DCAC.Control.IntersectivePWM intersectivePWM(uMax=uMax, …)…;

PR4812

SVPWM
parameter Real uMax "Maximum space phasor = half diagonal of hexagon";
IntersectivePWM
parameter Real uMax "Maximum amplitude of signal";
PWM
parameter Real uMax "Maximum amplitude of signal";
PowerConverters.DCAC.Control.SVPWM svPWM(uMax=uMax/(sqrt(3)/2),…)…;
PowerConverters.DCAC.Control.IntersectivePWM intersectivePWM(uMax=uMax,…)…;

There are 3 bugfixes, and - you are rtíght - all of them have to be documented in the release notes:

  • correcting the timing of IntersectivePWM
  • correcting the sequence of switching patterns in SVPWM
  • correcting calculation and usage of maximum reachable voltage

Should I edit the release notes in this PR?

@MSL-RegressionTesting-CI

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Critical/severe issue create new reference results create new reference results L: Electrical.PowerConverters Issue addresses Modelica.Electrical.PowerConverters needs backporting Needs back-porting from the master branch

Projects

None yet

5 participants