modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

MSL v4.1.0-beta.1 feedback: broken Dymola plot scripts #4316

Closed m-kessler closed 4 months ago

m-kessler commented 4 months ago

There are 3 plot scripts in MSL 4.1.0 beta 1 with errors:

  1. plotResults in Modelica.Fluid.Examples.HeatingSystem Error: Could not plot variable 'pipe.heatPort[1].Q_flow'

  2. _plot level and port.mflow in Modelica.Fluid.Examples.Tanks.ThreeTanks Error: Could not plot variable 'tank3.ports[2].m_flow'

  3. _plot level and port.mflow in Modelica.Fluid.Examples.Tanks.TanksWithOverflow Error: Could not plot variable 'tank3.ports[2].m_flow'

Tested with Dymola Version 2024x Refresh 1 Alpha.

HansOlsson commented 4 months ago

The model errors seem to be:

  1. heatPort is disabled for the model, and thus there is no heatPort
  2. There is only one array element for tank3.ports[:] - not two.
  3. There is no tank3
beutlich commented 4 months ago

@m-kessler I wonder how you found out? And I also wonder if there is some similar check for the figure annotation.

HansOlsson commented 4 months ago

I checked Modelica 3.2.2 and it also lacked those variables, and at least the first script had the same issue (those script say they were generated in 2006). It seems this is a very old problem, and since there is nothing linking the model and the script I can see why it has been missed.

The figure annotation will be a better replacement.

maltelenz commented 4 months ago

Could the existing plot scripts for Dymola be used to generate figure annotations, to get the project of adding figures on the way? (For after 4.1.0 of course.)

m-kessler commented 4 months ago

@m-kessler I wonder how you found out? And I also wonder if there is some similar check for the figure annotation.

We have an in-house tool that checks all our libraries at Dassault Systemes. It simulates all examples, executes the dymola-commands in the model annotation and checks if there is an error. Currently the figure annotation is not checked.

beutlich commented 4 months ago

@m-kessler Thanks for the feedback. I was wondering if there could be some CI check to check both command scripts and figure annotations for invalid references.

Anyway, would it be possible for you to file a PR to fix these three plot commands. Thanks again.

beutlich commented 4 months ago

@Harisankar-Allimangalath Please backport to maint/4.1.0.

HansOlsson commented 4 months ago

@Harisankar-Allimangalath Please backport to maint/4.1.0.

I did it in #4322

Harisankar-Allimangalath commented 4 months ago

@HansOlsson I have added @maltelenz and @m-kessler as reviewers for the PR4322 . Thanks

maltelenz commented 4 months ago

FYI @Harisankar-Allimangalath if you type #4322 instead of PR4322 github automatically creates helpful cross-links that help navigation.