Skip to content

Prepare for CI: Magnetic.QuasiStatic.FundamentalWave#4787

Open
AHaumer wants to merge 4 commits intomodelica:masterfrom
AHaumer:PrepCI_QSFW
Open

Prepare for CI: Magnetic.QuasiStatic.FundamentalWave#4787
AHaumer wants to merge 4 commits intomodelica:masterfrom
AHaumer:PrepCI_QSFW

Conversation

@AHaumer
Copy link
Copy Markdown
Contributor

@AHaumer AHaumer commented May 3, 2026

same procedure as #4775, except Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines.IMC_withLosses where IMHO a longer interval (factor 100) is sufficient to reduce the size of the reference results.

@AHaumer AHaumer mentioned this pull request May 3, 2026
@AHaumer AHaumer added L: Magnetic.QuasiStatic Issue addresses Modelica.Magnetic.QuasiStatic ref-result Issue addresses the reference results labels May 3, 2026
@christiankral
Copy link
Copy Markdown
Contributor

@AHaumer Some "new" models have been added to ModelicaTest. Why can't we just extend these models from the MSL and add a proper annotation? They look quite identical to me.

@christiankral
Copy link
Copy Markdown
Contributor

Extending from the Modelica Standard Library make the code very maintainable. One more aspect here:

  • The annotations in ModelicaTest now show simulation start and stop time and indicate the time window for comparison. This is OK.
  • The same annotation also shows the documentation of original model stored in the MSL. This causes some obvious conflicts. Example:
 extends Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines.SMPM_CurrentSource;
  annotation (
    experiment(StopTime=0.20, Interval=1E-4, Tolerance=1E-6),
    TestCase(shouldPass = true,
      __ModelicaAssociation(Comparison(TimeWindows={TimeSlot(0.00, 0.20)}))),
    Documentation(info="<html>
<p>
This example compares a time transient and a quasi-static model of a permanent magnet synchronous machine. The machines are fed by a current source. The current components are oriented at the magnetic field orientation and transformed to the stator fixed reference frame. This way the machines are operated at constant torque. The machines start to accelerate from standstill.</p>

<p>
Simulate for 2 seconds and plot (versus time):
</p>

The stop time is set to 0.20 seconds and the documentation states "Simulate for 2 seconds".

I wonder if it makes more sense to just state something like:

    Documentation(info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>

Reasons:

  • Who is maintaining the documentation of the ModelicaTest models extended from the MSL? I guess no one. So whenever we update the documentation of the MSL model, it is entirely forgotten about the documentation of the ModelicaTest models.
  • However, we could add a hyperlink to the original model of the MSL. But this is not required from my point of view, as the extends clearly shows which model we refer to.

@henrikt-ma
Copy link
Copy Markdown
Contributor

henrikt-ma commented May 4, 2026

  • The annotations in ModelicaTest now show simulation start and stop time and indicate the time window for comparison. This is OK.

I don't see this being OK regarding the StartTime, as this may have all sorts of unwanted effects compared to just trimming the first part of the main model's simulation result.

To make time windowed comparison beyond just taking the initial part of the result of a chaotic system, we need this TestCase annotation that we have talked about, where the time intervals have both beginning and end.

@AHaumer
Copy link
Copy Markdown
Contributor Author

AHaumer commented May 4, 2026

@christiankral I adreesed your concerns. Sorry for not using extends, my fault.
@henrikt-ma I don't understand your comment.
All the "extended" examples in ModelicaTest use the same default StartTime=0 as the original models.

@henrikt-ma
Copy link
Copy Markdown
Contributor

@henrikt-ma I don't understand your comment. All the "extended" examples in ModelicaTest use the same default StartTime=0 as the original models.

I was commenting on the following (emphasis is mine):

The annotations in ModelicaTest now show simulation start and stop time and indicate the time window for comparison. This is OK.

That is, if you remove the start and, and maybe stop calling it a time window when the window must be open-eded to the left, then it would seem OK to me as well.

I would rather call what you are doing something like a short-time comparison model to not cause confusion with a proper time-windowed comparison which we seem to need sooner or later anyway.

@HansOlsson
Copy link
Copy Markdown
Contributor

I wonder if it makes more sense to just state something like:

    Documentation(info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>

Reasons:

  • Who is maintaining the documentation of the ModelicaTest models extended from the MSL? I guess no one. So whenever we update the documentation of the MSL model, it is entirely forgotten about the documentation of the ModelicaTest models.
  • However, we could add a hyperlink to the original model of the MSL. But this is not required from my point of view, as the extends clearly shows which model we refer to.

I agree that we shouldn't duplicate the documentation, but to me it seems simplest to as default not have any documentation for these models.

Tools can already show that it extends from another model, and in some way make that accessible.

In Dymola that would currently give something like:

Information

Extends from Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines.SMPM_CurrentSource
(Test example: PermanentMagnetSynchronousMachine fed by current source).

(But with an internal link instead.)

Thus, I don't see that spending time on writing "The original documentation is available at the model from which this one is extended." really helps.

I could even imagine that tools could be more helpful if the documentation of the derived class is empty, so it might be that the text is counter-productive.

Comment on lines +10 to +15
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),
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.

Suggested change
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),

No need for documentation to say that it extends from something.

Comment on lines +7 to +12
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),
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.

Suggested change
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),

No need for documentation to say that it extends from something.

Comment on lines +7 to +12
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),
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.

Suggested change
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),

No need for documentation to say that it extends from something.

Comment on lines +11 to +16
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),
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.

Suggested change
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),

No need for documentation to say that it extends from something.

Comment on lines +8 to +13
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),
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.

Suggested change
Documentation(
info="<html>
<p>
The original documentation is available at the model from which this one is extended.
</p>
</html>"),

No need for documentation to say that it extends from something.

Comment on lines 4 to 7
Electrical
Fluid
Magnetic
Media
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.

Suggested change
Electrical
Fluid
Magnetic
Media
Electrical
Magnetic
Fluid
Media

I understand that it looked odd to have "Magnetic" last, but I assume it is an expanded view of the Modelica-structure not a pure alphabetic order (that's why Media is before Math and Tables after Blocks), so I think Magnetic should be grouped with Electrical, not between Fluid and Media.

It could also be that it is just based on when the packages were added, but even in that case I think we should start working towards a logical order based on MSL - not an alphabetical one.

Copy link
Copy Markdown
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

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

Some minor issues, but overall it looks good.

@christiankral
Copy link
Copy Markdown
Contributor

Thus, I don't see that spending time on writing "The original documentation is available at the model from which this one is extended." really helps.

I could even imagine that tools could be more helpful if the documentation of the derived class is empty, so it might be that the text is counter-productive.

@HansOlsson @AHaumer I totally agree. The simplest and most transparent solution is just to not add any documentation and leave it up to the tool.

Copy link
Copy Markdown
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

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

LGTM - except for the package.order comment.

Copy link
Copy Markdown
Contributor

@christiankral christiankral left a comment

Choose a reason for hiding this comment

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

Looks good

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

Labels

L: Magnetic.QuasiStatic Issue addresses Modelica.Magnetic.QuasiStatic ref-result Issue addresses the reference results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants