Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to assert function rather than use of blunt print statements #989

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 3 comments
Assignees
Labels
L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) task General work that is not related to a bug or feature
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by dietmarw on 18 Feb 2013 11:52 UTC
In 9e0d695 the following changes were done to System.mo:

-equation
-  assert(use_small == false, "Using obsolete system.m_flow_small and system.dp_small."
-         + " Please update the model to new use_small = false",
-         level=AssertionLevel.warning);
+initial equation
+  //assert(use_small == false, "Using obsolete system.m_flow_small and system.dp_small."
+  //       + " Please update the model to new system.use_small = false",
+  //       level=AssertionLevel.warning);
+  if use_small == true then
+    Modelica.Utilities.Streams.print("***");
+    Modelica.Utilities.Streams.print("Using obsolete global system.m_flow_small and system.dp_small.");
+    Modelica.Utilities.Streams.print("They do not distinguish between laminar flow and regularization of zero flow.");
+    Modelica.Utilities.Streams.print("Absolute small values are error prone for models with local nominal values.");
+    Modelica.Utilities.Streams.print("Moreover dp_small can generally be obtained automatically.");
+    Modelica.Utilities.Streams.print("Please update to the new system.use_small = false (see system, Advanced tab).");
+    Modelica.Utilities.Streams.print("***");
+  end if;

The problem is that the print statements might be generated for every iteration unless the tool does some optimisation. A much cleaner way would be the use of the assert() function just as the commented version already suggest. So I would strongly recommend to get rid of the print statements and use assert instead.


Migrated-From: https://trac.modelica.org/Modelica/ticket/989

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.1 milestone Jan 14, 2017
@modelica-trac-importer modelica-trac-importer added L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) task General work that is not related to a bug or feature labels Jan 14, 2017
@modelica-trac-importer
Copy link
Author

Comment by sjoelund.se on 18 Feb 2013 15:25 UTC
Oh, and maybe also update the examples use the new way?

@modelica-trac-importer
Copy link
Author

Comment by rfranke on 6 Mar 2013 10:46 UTC
First the intention was to declare m_flow_small/dp_small obsolete and enable the new feature use_eps_Re per default -- all existing examples would have used the new feature automatically. This appeared too aggressive for the minor release 3.2.1 though.

Then the idea was to declare m_flow_small/dp_small classic, in conjunction with the print statements. This obviously is annoying for someone who just wants to run all Modelica models -- consequently all examples should be updated. So far only the examples and tests that require the new feature have been updated. Most examples and tests run with both settings.

The appropriate solution might be to go back one step further and declare the new use_eps_Re feature experimental in the MSL 3.2.1 release.

28691a3 removes the print statements and comments out the assertion.

@modelica-trac-importer
Copy link
Author

Modified by rfranke on 6 Mar 2013 10:50 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) task General work that is not related to a bug or feature
Projects
None yet
Development

No branches or pull requests

2 participants