diff --git a/flattening/modelica/scodeinst/Makefile b/flattening/modelica/scodeinst/Makefile index b08116bdd..2ae1d0630 100644 --- a/flattening/modelica/scodeinst/Makefile +++ b/flattening/modelica/scodeinst/Makefile @@ -56,6 +56,53 @@ usertype3.mo \ usertype4.mo \ usertype5.mo \ usertype6.mo \ +ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mos \ +ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mos \ +ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mos \ +ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mos \ +ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mos \ +ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mos \ +ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mos \ +ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mos \ +ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mos + # test that currently fail. Move up when fixed. # Run make testfailing diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mo new file mode 100644 index 000000000..a604f612e --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mo @@ -0,0 +1,229 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_total "N cascaded first order systems, approximating a pure delay" + extends ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); +end CascadedFirstOrder_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mos new file mode 100644 index 000000000..90e79faa6 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.Models.CascadedFirstOrder has 10 equation(s) and 10 variable(s). +// 10 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mo new file mode 100644 index 000000000..a74390e1d --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_100 + extends Models.CascadedFirstOrder(N = 100); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_100; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_100_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_100_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mos new file mode 100644 index 000000000..431be298f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_100 has 100 equation(s) and 100 variable(s). +// 100 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mo new file mode 100644 index 000000000..29b0686bf --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_12800 + extends Models.CascadedFirstOrder(N = 12800); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_12800; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_12800_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_12800_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mos new file mode 100644 index 000000000..cf6926f9e --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_12800 has 12800 equation(s) and 12800 variable(s). +// 12800 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mo new file mode 100644 index 000000000..d10993004 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_1600 + extends Models.CascadedFirstOrder(N = 1600); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_1600; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_1600_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_1600_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mos new file mode 100644 index 000000000..6f2ec903b --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_1600 has 1600 equation(s) and 1600 variable(s). +// 1600 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mo new file mode 100644 index 000000000..a52b81ce8 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_200 + extends Models.CascadedFirstOrder(N = 200); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_200; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_200_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_200_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mos new file mode 100644 index 000000000..a977125bc --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_200 has 200 equation(s) and 200 variable(s). +// 200 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mo new file mode 100644 index 000000000..944ec8c58 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_25600 + extends Models.CascadedFirstOrder(N = 25600); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_25600; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_25600_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_25600_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mos new file mode 100644 index 000000000..911f305fb --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_25600 has 25600 equation(s) and 25600 variable(s). +// 25600 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mo new file mode 100644 index 000000000..a82386548 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_3200 + extends Models.CascadedFirstOrder(N = 3200); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_3200; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_3200_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_3200_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mos new file mode 100644 index 000000000..10de8f844 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_3200 has 3200 equation(s) and 3200 variable(s). +// 3200 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mo new file mode 100644 index 000000000..055113693 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_400 + extends Models.CascadedFirstOrder(N = 400); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_400; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_400_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_400_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mos new file mode 100644 index 000000000..3de224107 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_400 has 400 equation(s) and 400 variable(s). +// 400 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mo new file mode 100644 index 000000000..1a51ea74a --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_6400 + extends Models.CascadedFirstOrder(N = 6400); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_6400; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_6400_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_6400_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mos new file mode 100644 index 000000000..ba6f1760a --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_6400 has 6400 equation(s) and 6400 variable(s). +// 6400 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mo new file mode 100644 index 000000000..a43d2b40d --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mo @@ -0,0 +1,230 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Time = Real(final quantity = "Time", final unit = "s"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package SimpleODE "Models with simple ODE systems" + package Models + model CascadedFirstOrder "N cascaded first order systems, approximating a pure delay" + parameter Integer N = 10 "Order of the system"; + parameter Modelica.SIunits.Time T = 1 "System delay"; + final parameter Modelica.SIunits.Time tau = T / N "Individual time constant"; + Real[N] x(each start = 0, each fixed = true); + equation + tau * der(x[1]) = 1 - x[1]; + for i in 2:N loop + tau * der(x[i]) = x[i - 1] - x[i]; + end for; + annotation(experiment(StopTime = 2, Tolerance = 1e-6), Documentation(info = "

This model is meant to try out the tool + performance with ODE systems of possibly very large size, with high + sparsity degree.

+

The model is a cascaded connection of first order linear systems, + approximating a pure delay of T seconds as N approaches + infinity. It contains exactly N state variables and N + differential equations.

")); + end CascadedFirstOrder; + end Models; + + package ScaledExperiments + model CascadedFirstOrder_N_800 + extends Models.CascadedFirstOrder(N = 800); + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); + end CascadedFirstOrder_N_800; + end ScaledExperiments; + end SimpleODE; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model CascadedFirstOrder_N_800_total + extends ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800; + annotation(experiment(StopTime = 2, Tolerance = 1e-6)); +end CascadedFirstOrder_N_800_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mos new file mode 100644 index 000000000..2db88d6b8 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800 completed successfully. +// Class ScalableTestSuite.Elementary.SimpleODE.ScaledExperiments.CascadedFirstOrder_N_800 has 800 equation(s) and 800 variable(s). +// 800 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mo new file mode 100644 index 000000000..d2064d7eb --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mo @@ -0,0 +1,182 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEventsManyConditions "Model with many events in when clauses and a when clause with many triggering conditions" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + Integer v(start = 0, fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + when e then + v = pre(v) + 1; + end when; + end ManyEventsManyConditions; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEventsManyConditions_N_1000 + extends Models.ManyEventsManyConditions(N = 1000); + annotation(experiment(StopTime = 100, Tolerance = 1e-6)); + end ManyEventsManyConditions_N_1000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEventsManyConditions_N_1000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000; + annotation(experiment(StopTime = 100, Tolerance = 1e-6)); +end ManyEventsManyConditions_N_1000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mos new file mode 100644 index 000000000..fac0c719b --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_1000 has 2001 equation(s) and 2001 variable(s). +// 1000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mo new file mode 100644 index 000000000..b49c8c76a --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mo @@ -0,0 +1,182 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEventsManyConditions "Model with many events in when clauses and a when clause with many triggering conditions" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + Integer v(start = 0, fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + when e then + v = pre(v) + 1; + end when; + end ManyEventsManyConditions; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEventsManyConditions_N_2000 + extends Models.ManyEventsManyConditions(N = 2000); + annotation(experiment(StopTime = 200, Tolerance = 1e-6)); + end ManyEventsManyConditions_N_2000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEventsManyConditions_N_2000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000; + annotation(experiment(StopTime = 200, Tolerance = 1e-6)); +end ManyEventsManyConditions_N_2000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mos new file mode 100644 index 000000000..3a2f8b88e --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_2000 has 4001 equation(s) and 4001 variable(s). +// 2000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mo new file mode 100644 index 000000000..99a57c768 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mo @@ -0,0 +1,182 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEventsManyConditions "Model with many events in when clauses and a when clause with many triggering conditions" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + Integer v(start = 0, fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + when e then + v = pre(v) + 1; + end when; + end ManyEventsManyConditions; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEventsManyConditions_N_4000 + extends Models.ManyEventsManyConditions(N = 4000); + annotation(experiment(StopTime = 400, Tolerance = 1e-6)); + end ManyEventsManyConditions_N_4000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEventsManyConditions_N_4000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000; + annotation(experiment(StopTime = 400, Tolerance = 1e-6)); +end ManyEventsManyConditions_N_4000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mos new file mode 100644 index 000000000..39240b003 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_4000 has 8001 equation(s) and 8001 variable(s). +// 4000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mo new file mode 100644 index 000000000..6e48f80f2 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mo @@ -0,0 +1,182 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEventsManyConditions "Model with many events in when clauses and a when clause with many triggering conditions" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + Integer v(start = 0, fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + when e then + v = pre(v) + 1; + end when; + end ManyEventsManyConditions; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEventsManyConditions_N_8000 + extends Models.ManyEventsManyConditions(N = 8000); + annotation(experiment(StopTime = 800, Tolerance = 1e-6)); + end ManyEventsManyConditions_N_8000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEventsManyConditions_N_8000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000; + annotation(experiment(StopTime = 800, Tolerance = 1e-6)); +end ManyEventsManyConditions_N_8000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mos new file mode 100644 index 000000000..375a75f5f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEventsManyConditions_N_8000 has 16001 equation(s) and 16001 variable(s). +// 8000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mo new file mode 100644 index 000000000..3a673fbf7 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mo @@ -0,0 +1,178 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEvents "Model with many events in when clauses" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + end ManyEvents; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEvents_N_1000 + extends Models.ManyEvents(N = 1000); + annotation(experiment(StopTime = 100, Tolerance = 1e-6)); + end ManyEvents_N_1000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEvents_N_1000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000; + annotation(experiment(StopTime = 100, Tolerance = 1e-6)); +end ManyEvents_N_1000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mos new file mode 100644 index 000000000..70a489166 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_1000 has 2000 equation(s) and 2000 variable(s). +// 1000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mo new file mode 100644 index 000000000..57eda54e1 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mo @@ -0,0 +1,178 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEvents "Model with many events in when clauses" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + end ManyEvents; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEvents_N_2000 + extends Models.ManyEvents(N = 2000); + annotation(experiment(StopTime = 200, Tolerance = 1e-6)); + end ManyEvents_N_2000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEvents_N_2000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000; + annotation(experiment(StopTime = 200, Tolerance = 1e-6)); +end ManyEvents_N_2000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mos new file mode 100644 index 000000000..22a3d0628 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_2000 has 4000 equation(s) and 4000 variable(s). +// 2000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mo new file mode 100644 index 000000000..2e3ec42b0 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mo @@ -0,0 +1,178 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEvents "Model with many events in when clauses" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + end ManyEvents; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEvents_N_4000 + extends Models.ManyEvents(N = 4000); + annotation(experiment(StopTime = 400, Tolerance = 1e-6)); + end ManyEvents_N_4000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEvents_N_4000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000; + annotation(experiment(StopTime = 400, Tolerance = 1e-6)); +end ManyEvents_N_4000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mos new file mode 100644 index 000000000..af7d17ce8 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_4000 has 8000 equation(s) and 8000 variable(s). +// 4000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mo new file mode 100644 index 000000000..370bdab27 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mo @@ -0,0 +1,178 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEvents "Model with many events in when clauses" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + end ManyEvents; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model ManyEvents_N_8000 + extends Models.ManyEvents(N = 8000); + annotation(experiment(StopTime = 800, Tolerance = 1e-6)); + end ManyEvents_N_8000; + end ScaledExperiments; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEvents_N_8000_total + extends ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000; + annotation(experiment(StopTime = 800, Tolerance = 1e-6)); +end ManyEvents_N_8000_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mos new file mode 100644 index 000000000..6ab14c588 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000 completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.ScaledExperiments.ManyEvents_N_8000 has 16000 equation(s) and 16000 variable(s). +// 8000 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mo new file mode 100644 index 000000000..80cfe49e5 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mo @@ -0,0 +1,79 @@ +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEvents "Model with many events in when clauses" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + end ManyEvents; + end Models; + + package Verification + model ManyEvents + extends Models.ManyEvents(N = 100); + annotation(experiment(StopTime = 10), Documentation(info = "

The model contains N integrators x[i] with different integration rates. + When each state values crosses the value of one, a when clause is triggered, switching the + corresponding boolean e[i] from false to true.

+

If the model is run with StopTime = N/10, only about + one tenth of the when clauses are actually triggered, to save on simulation time.

")); + end ManyEvents; + end Verification; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEvents_total + extends ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents; + annotation(experiment(StopTime = 10), Documentation(info = "

The model contains N integrators x[i] with different integration rates. + When each state values crosses the value of one, a when clause is triggered, switching the + corresponding boolean e[i] from false to true.

+

If the model is run with StopTime = N/10, only about + one tenth of the when clauses are actually triggered, to save on simulation time.

")); +end ManyEvents_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mos new file mode 100644 index 000000000..f1eef1263 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEvents has 200 equation(s) and 200 variable(s). +// 100 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mo new file mode 100644 index 000000000..f9c5b9c04 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mo @@ -0,0 +1,87 @@ +package ScalableTestSuite "A library of scalable Modelica test models" + package Elementary "Elementary models to stress some aspects of the tool" + package WhenEvents "Models large number of when statements and events" + package Models + model ManyEventsManyConditions "Model with many events in when clauses and a when clause with many triggering conditions" + parameter Integer N = 5; + Real[N] x(each start = 0, each fixed = true); + Boolean[N] e(each start = false, each fixed = true); + Integer v(start = 0, fixed = true); + equation + for i in 1:N loop + der(x[i]) = 1 / i; + when x[i] > 1 then + e[i] = true; + end when; + end for; + when e then + v = pre(v) + 1; + end when; + end ManyEventsManyConditions; + end Models; + + package Verification + model ManyEventsManyConditions + extends Models.ManyEventsManyConditions(N = 20); + annotation(experiment(StopTime = 2), Documentation(info = "

The model contains N integrators x[i] with different integration rates. + When each state values crosses the value of one, a when clause is triggered, switching the + corresponding boolean e[i] from false to true.

+

Additionally, a single when clause monitors the changes of the entire e vector, and increases the value + of v by one each time any when clause is triggered.

+

If the model is run with StopTime = N/10, only about + one tenth of the when clauses are actually triggered, to save on simulation time.

")); + end ManyEventsManyConditions; + end Verification; + end WhenEvents; + end Elementary; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model ManyEventsManyConditions_total + extends ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions; + annotation(experiment(StopTime = 2), Documentation(info = "

The model contains N integrators x[i] with different integration rates. + When each state values crosses the value of one, a when clause is triggered, switching the + corresponding boolean e[i] from false to true.

+

Additionally, a single when clause monitors the changes of the entire e vector, and increases the value + of v by one each time any when clause is triggered.

+

If the model is run with StopTime = N/10, only about + one tenth of the when clauses are actually triggered, to save on simulation time.

")); +end ManyEventsManyConditions_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mos new file mode 100644 index 000000000..7f29a29b6 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions.mo"); getErrorString(); +checkModel(ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions completed successfully. +// Class ScalableTestSuite.Elementary.WhenEvents.Verification.ManyEventsManyConditions has 41 equation(s) and 41 variable(s). +// 20 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mo new file mode 100644 index 000000000..1c43e4155 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_100 + extends Models.AdvectionReaction(N = 100, mu = 500); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_100; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_100_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_100_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mos new file mode 100644 index 000000000..93e40e70d --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_100 has 101 equation(s) and 101 variable(s). +// 101 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mo new file mode 100644 index 000000000..d19d44e50 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_12800 + extends Models.AdvectionReaction(N = 12800, mu = 64000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_12800; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_12800_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_12800_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mos new file mode 100644 index 000000000..5840479b1 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_12800 has 12801 equation(s) and 12801 variable(s). +// 12801 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mo new file mode 100644 index 000000000..a4ad88ec8 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_1600 + extends Models.AdvectionReaction(N = 1600, mu = 8000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_1600; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_1600_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_1600_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mos new file mode 100644 index 000000000..06581f716 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_1600 has 1601 equation(s) and 1601 variable(s). +// 1601 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mo new file mode 100644 index 000000000..1b8a5632c --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_200 + extends Models.AdvectionReaction(N = 200, mu = 1000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_200; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_200_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_200_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mos new file mode 100644 index 000000000..72b5cb423 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_200 has 201 equation(s) and 201 variable(s). +// 201 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mo new file mode 100644 index 000000000..49958677b --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_3200 + extends Models.AdvectionReaction(N = 3200, mu = 16000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_3200; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_3200_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_3200_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mos new file mode 100644 index 000000000..2f6b0805b --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200 has 3201 equation(s) and 3201 variable(s). +// 3201 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mo new file mode 100644 index 000000000..dc1c4cef2 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_400 + extends Models.AdvectionReaction(N = 400, mu = 2000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_400; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_400_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_400_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mos new file mode 100644 index 000000000..60541cef8 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_400 has 401 equation(s) and 401 variable(s). +// 401 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mo new file mode 100644 index 000000000..2828dea3d --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_6400 + extends Models.AdvectionReaction(N = 6400, mu = 32000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_6400; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_6400_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_6400_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mos new file mode 100644 index 000000000..855f57664 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_6400 has 6401 equation(s) and 6401 variable(s). +// 6401 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mo new file mode 100644 index 000000000..f92cd706d --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mo @@ -0,0 +1,185 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model AdvectionReaction "Model of an advection process with chemical reaction" + parameter Integer N = 10 "Number of volumes"; + parameter Real mu = 1000 "Kinetic coefficient of the reaction"; + constant Real alpha = 0.5 "Parameter of the reaction model"; + Real u_in = 1 "Inlet concentration"; + Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; + equation + der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); + for j in 2:N loop + der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); + end for; + annotation(Documentation(info = " +

This models solves the problem represented by the following PDE by means of the finite volume method, on a spatial domain of unit length and assuming unit velocity v.

+

+

If μ = 0, the model represent the transport of a certain chemical species in a fluid, similar to SimpleAdvection. If mu is increased, a chemical reaction is added with two stable equilibria, one at u = 0 and one at u = 1, with an unstable equilibrium at u = α.

+

The chemical reaction sharpens the concentration wave front, which would be otherwise be smoothed out by the numerical diffusion effect of the finite volume method.

+

The boundary condition u_in at the inlet, i.e., u(0,t), is specified by suitable binding equations.

+ ")); + end AdvectionReaction; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model AdvectionReaction_N_800 + extends Models.AdvectionReaction(N = 800, mu = 4000); + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); + end AdvectionReaction_N_800; + end ScaledExperiments; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model AdvectionReaction_N_800_total + extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800; + annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); +end AdvectionReaction_N_800_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mos new file mode 100644 index 000000000..18a511e1c --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800 completed successfully. +// Class ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_800 has 801 equation(s) and 801 variable(s). +// 801 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mo new file mode 100644 index 000000000..b600ceb47 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mo @@ -0,0 +1,253 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Time = Real(final quantity = "Time", final unit = "s"); + type Velocity = Real(final quantity = "Velocity", final unit = "m/s"); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type TemperatureDifference = Real(final quantity = "ThermodynamicTemperature", final unit = "K") annotation(absoluteValue = false); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package Advection "1D advection models" + package Models + model SimpleAdvection "Basic thermal advection model with uniform speed" + parameter Integer N = 2 "Number of nodes"; + parameter Modelica.SIunits.Temperature[N] Tstart = ones(N) * 300 "Start value of the temperature distribution"; + parameter Modelica.SIunits.Length L = 10 "Pipe length"; + final parameter Modelica.SIunits.Length l = L / N "Length of one volume"; + Modelica.SIunits.Velocity u = 1 "Fluid speed"; + Modelica.SIunits.Temperature Tin = 300 "Inlet temperature"; + Modelica.SIunits.Temperature[N] T "Node temperatures"; + Modelica.SIunits.Temperature[N - 1] Ttilde(start = Tstart[2:N], each fixed = true) "Temperature states"; + Modelica.SIunits.Temperature Tout; + equation + for j in 1:N - 1 loop + der(Ttilde[j]) = u / l * (T[j] - T[j + 1]); + end for; + T[1] = Tin; + T[N] = Tout; + Ttilde = T[2:N]; + annotation(Documentation(info = " +

This models solves the temperature advection problem represented by the following PDEs by means of the finite volume method.

+

+

+

The boundary condition at the inlet Tin and the fluid speed u are specified by suitable binding equations.

+ ")); + end SimpleAdvection; + end Models; + + package Verification + model SimpleAdvection + extends Models.SimpleAdvection(N = 1000, Tin = 300 + dT * (0.5 * tanh((time - t0) / dt) + 0.5)); + parameter Modelica.SIunits.Time t0 = 2 "Instant of smooth step temperature increase at inlet"; + parameter Modelica.SIunits.Time dt = 0.1 "Transition time of temperature increase"; + parameter Modelica.SIunits.TemperatureDifference dT = 10 "Temperature increase at inlet"; + Modelica.SIunits.Temperature Tout_ex "Exact outlet temperature from analytical solution"; + equation + Tout_ex = 300 + dT * (0.5 * tanh((time - t0 - L / u) / dt) + 0.5); + annotation(experiment(StopTime = 15, Interval = 4e-3, Tolerance = 1e-6), Documentation(info = " +

At constant fluid speed u, the exact analytical solution of the PDEs is

+

+ ")); + end SimpleAdvection; + end Verification; + end Advection; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model SimpleAdvection_total + extends ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection; + annotation(experiment(StopTime = 15, Interval = 4e-3, Tolerance = 1e-6), Documentation(info = " +

At constant fluid speed u, the exact analytical solution of the PDEs is

+

+")); +end SimpleAdvection_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mos new file mode 100644 index 000000000..3dd13d465 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection completed successfully. +// Class ScalableTestSuite.Thermal.Advection.Verification.SimpleAdvection has 1005 equation(s) and 2003 variable(s). +// 5 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mo new file mode 100644 index 000000000..cf7b7e6bc --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mo @@ -0,0 +1,255 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Math "Library of mathematical functions (e.g., sin, cos) and of functions operating on vectors and matrices" + extends Modelica.Icons.Package; + + package Icons "Icons for Math" + extends Modelica.Icons.IconsPackage; + + partial function AxisCenter "Basic icon for mathematical function with y-axis in the center" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{0, -80}, {0, 68}}, color = {192, 192, 192}), Polygon(points = {{0, 90}, {-8, 68}, {8, 68}, {0, 90}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Text(extent = {{-150, 150}, {150, 110}}, textString = "%name", lineColor = {0, 0, 255})}), Diagram(graphics = {Line(points = {{0, 80}, {-8, 80}}, color = {95, 95, 95}), Line(points = {{0, -80}, {-8, -80}}, color = {95, 95, 95}), Line(points = {{0, -90}, {0, 84}}, color = {95, 95, 95}), Text(extent = {{5, 104}, {25, 84}}, lineColor = {95, 95, 95}, textString = "y"), Polygon(points = {{0, 98}, {-6, 82}, {6, 82}, {0, 98}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

+ Icon for a mathematical function, consisting of an y-axis in the middle. + It is expected, that an x-axis is added and a plot of the function. +

+ ")); end AxisCenter; + end Icons; + + function tanh "Hyperbolic tangent" + extends Modelica.Math.Icons.AxisCenter; + input Real u; + output Real y; + external "builtin" y = tanh(u) annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-90, 0}, {68, 0}}, color = {192, 192, 192}), Polygon(points = {{90, 0}, {68, 8}, {68, -8}, {90, 0}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-47.8, -78.7}, {-35.8, -75.7}, {-27.7, -70.6}, {-22.1, -64.2}, {-17.3, -55.9}, {-12.5, -44.3}, {-7.64, -29.2}, {-1.21, -4.82}, {6.83, 26.3}, {11.7, 42}, {16.5, 54.2}, {21.3, 63.1}, {26.9, 69.9}, {34.2, 75}, {45.4, 78.4}, {72, 79.9}, {80, 80}}), Text(extent = {{-88, 72}, {-16, 24}}, lineColor = {192, 192, 192}, textString = "tanh")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, 0}, {84, 0}}, color = {95, 95, 95}), Polygon(points = {{96, 0}, {80, 6}, {80, -6}, {96, 0}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80.5}, {-47.8, -79.2}, {-35.8, -76.2}, {-27.7, -71.1}, {-22.1, -64.7}, {-17.3, -56.4}, {-12.5, -44.8}, {-7.64, -29.7}, {-1.21, -5.32}, {6.83, 25.8}, {11.7, 41.5}, {16.5, 53.7}, {21.3, 62.6}, {26.9, 69.4}, {34.2, 74.5}, {45.4, 77.9}, {72, 79.4}, {80, 79.5}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-29, 72}, {-9, 88}}, textString = "1", lineColor = {0, 0, 255}), Text(extent = {{3, -72}, {23, -88}}, textString = "-1", lineColor = {0, 0, 255}), Text(extent = {{82, -2}, {102, -22}}, lineColor = {95, 95, 95}, textString = "u"), Line(points = {{0, 80}, {88, 80}}, color = {175, 175, 175})}), Documentation(info = " +

+ This function returns y = tanh(u), with -∞ < u < ∞: +

+ +

+ +

+ ")); + annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-90, 0}, {68, 0}}, color = {192, 192, 192}), Polygon(points = {{90, 0}, {68, 8}, {68, -8}, {90, 0}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-47.8, -78.7}, {-35.8, -75.7}, {-27.7, -70.6}, {-22.1, -64.2}, {-17.3, -55.9}, {-12.5, -44.3}, {-7.64, -29.2}, {-1.21, -4.82}, {6.83, 26.3}, {11.7, 42}, {16.5, 54.2}, {21.3, 63.1}, {26.9, 69.9}, {34.2, 75}, {45.4, 78.4}, {72, 79.9}, {80, 80}}), Text(extent = {{-88, 72}, {-16, 24}}, lineColor = {192, 192, 192}, textString = "tanh")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, 0}, {84, 0}}, color = {95, 95, 95}), Polygon(points = {{96, 0}, {80, 6}, {80, -6}, {96, 0}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80.5}, {-47.8, -79.2}, {-35.8, -76.2}, {-27.7, -71.1}, {-22.1, -64.7}, {-17.3, -56.4}, {-12.5, -44.8}, {-7.64, -29.7}, {-1.21, -5.32}, {6.83, 25.8}, {11.7, 41.5}, {16.5, 53.7}, {21.3, 62.6}, {26.9, 69.4}, {34.2, 74.5}, {45.4, 77.9}, {72, 79.4}, {80, 79.5}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-29, 72}, {-9, 88}}, textString = "1", lineColor = {0, 0, 255}), Text(extent = {{3, -72}, {23, -88}}, textString = "-1", lineColor = {0, 0, 255}), Text(extent = {{82, -2}, {102, -22}}, lineColor = {95, 95, 95}, textString = "u"), Line(points = {{0, 80}, {88, 80}}, color = {175, 175, 175})}), Documentation(info = " +

+ This function returns y = tanh(u), with -∞ < u < ∞: +

+ +

+ +

+ ")); + end tanh; + annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 0}, {-68.7, 34.2}, {-61.5, 53.1}, {-55.1, 66.4}, {-49.4, 74.6}, {-43.8, 79.1}, {-38.2, 79.8}, {-32.6, 76.6}, {-26.9, 69.7}, {-21.3, 59.4}, {-14.9, 44.1}, {-6.83, 21.2}, {10.1, -30.8}, {17.3, -50.2}, {23.7, -64.2}, {29.3, -73.1}, {35, -78.4}, {40.6, -80}, {46.2, -77.6}, {51.9, -71.5}, {57.5, -61.9}, {63.9, -47.2}, {72, -24.8}, {80, 0}}, color = {0, 0, 0}, smooth = Smooth.Bezier)}), Documentation(info = " +

+ This package contains basic mathematical functions (such as sin(..)), + as well as functions operating on + vectors, + matrices, + nonlinear functions, and + Boolean vectors. +

+ +
+
Main Authors:
+
Martin Otter and + Marcus Baur
+ Deutsches Zentrum für Luft und Raumfahrt e.V. (DLR)
+ Institut für Robotik und Mechatronik
+ Postfach 1116
+ D-82230 Wessling
+ Germany
+ email: Martin.Otter@dlr.de
+
+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + + ")); + end Math; + + package Icons "Library of icons" + extends Icons.Package; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + + partial package IconsPackage "Icon for packages containing icons" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})})); + end IconsPackage; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package DistrictHeating "Simplified models of district heating systems - only continuous time equations" + package Models + function sat "Smooth saturation of input x between xmin and xmax" + input Real x; + input Real xmin; + input Real xmax; + output Real y; + algorithm + y := Modelica.Math.tanh(2 * (x - xmin) / (xmax - xmin) - 1) * (xmax - xmin) / 2 + (xmax + xmin) / 2; + end sat; + end Models; + + package Verification + model TestSat "Test of the Models.sat function" + Real x = (-20) + time * 40; + Real y; + equation + y = Models.sat(x, -3, 6); + annotation(experiment(StopTime = 1, Interval = 2e-5)); + end TestSat; + end Verification; + end DistrictHeating; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model TestSat_total "Test of the Models.sat function" + extends ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat; + annotation(experiment(StopTime = 1, Interval = 2e-5)); +end TestSat_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mos new file mode 100644 index 000000000..eac7fa039 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat completed successfully. +// Class ScalableTestSuite.Thermal.DistrictHeating.Verification.TestSat has 2 equation(s) and 2 variable(s). +// 1 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mo new file mode 100644 index 000000000..4590e22a4 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mo @@ -0,0 +1,385 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_10_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_10_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mos new file mode 100644 index 000000000..c52381567 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_10 has 10 equation(s) and 10 variable(s). +// 9 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mo new file mode 100644 index 000000000..cdfc848d3 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_1280 + extends OneDHeatTransferTI_FD_N_10(N = 1280); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_1280; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_1280_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_1280_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mos new file mode 100644 index 000000000..d410eb61f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_1280 has 1280 equation(s) and 1280 variable(s). +// 1279 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mo new file mode 100644 index 000000000..c12f7af51 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_160 + extends OneDHeatTransferTI_FD_N_10(N = 160); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_160; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_160_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_160_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mos new file mode 100644 index 000000000..df5aac279 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_160 has 160 equation(s) and 160 variable(s). +// 159 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mo new file mode 100644 index 000000000..47ca73072 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_20 + extends OneDHeatTransferTI_FD_N_10(N = 20); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_20; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_20_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_20_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mos new file mode 100644 index 000000000..9d41380e0 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_20 has 20 equation(s) and 20 variable(s). +// 19 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mo new file mode 100644 index 000000000..0af80252f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_320 + extends OneDHeatTransferTI_FD_N_10(N = 320); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_320; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_320_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_320_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mos new file mode 100644 index 000000000..8931f2b49 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_320 has 320 equation(s) and 320 variable(s). +// 319 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mo new file mode 100644 index 000000000..3691f65cf --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_40 + extends OneDHeatTransferTI_FD_N_10(N = 40); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_40; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_40_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_40_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mos new file mode 100644 index 000000000..b7150ca34 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_40 has 40 equation(s) and 40 variable(s). +// 39 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mo new file mode 100644 index 000000000..10b5dbfe3 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_640 + extends OneDHeatTransferTI_FD_N_10(N = 640); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_640; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_640_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_640_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mos new file mode 100644 index 000000000..1970e1070 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_640 has 640 equation(s) and 640 variable(s). +// 639 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mo new file mode 100644 index 000000000..9cbfdf87b --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTI_FD "One end at a fixed temperature, one end is insulated; implemented by FD method" + parameter .Modelica.SIunits.Length L "Length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature TN "Temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 1:N - 1 loop + T[i] = T0; + end for; + equation + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i + 1] - T[i]) / dx + ((-T[i]) + T[i - 1]) / dx) / cp / rho / dx; + end for; + der(T[1]) = lambda * ((T[2] - T[1]) / dx) / cp / rho / dx; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTI, one end is exposed to a fixed temperature while the other end is insulated. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTI, TN has a constant temperature value and T1 is insulated. T1 has a boundary condition defined as:

The parameters for HeatConductionTI_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTI_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTI_FD_N_10 + extends Models.OneDHeatTransferTI_FD(L = 0.2, N = 10, T0 = 273.15, TN = 330, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_10; + + model OneDHeatTransferTI_FD_N_80 + extends OneDHeatTransferTI_FD_N_10(N = 80); + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); + end OneDHeatTransferTI_FD_N_80; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTI_FD_N_80_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80; + annotation(experiment(StopTime = 1500, Tolerance = 1e-6)); +end OneDHeatTransferTI_FD_N_80_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mos new file mode 100644 index 000000000..af7375303 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTI_FD_N_80 has 80 equation(s) and 80 variable(s). +// 79 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mo new file mode 100644 index 000000000..1281ae5e3 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mo @@ -0,0 +1,390 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_10_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_10_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mos new file mode 100644 index 000000000..ade15955f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_10 has 10 equation(s) and 10 variable(s). +// 10 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mo new file mode 100644 index 000000000..ccfb35a36 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_1280 + extends OneDHeatTransferTT_FD_N_10(N = 1280); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_1280; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_1280_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_1280_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mos new file mode 100644 index 000000000..da70b509a --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_1280 has 1280 equation(s) and 1280 variable(s). +// 1280 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mo new file mode 100644 index 000000000..233ff8826 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_160 + extends OneDHeatTransferTT_FD_N_10(N = 160); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_160; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_160_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_160_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mos new file mode 100644 index 000000000..9bbf0ec87 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_160 has 160 equation(s) and 160 variable(s). +// 160 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mo new file mode 100644 index 000000000..37e75f74e --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_20 + extends OneDHeatTransferTT_FD_N_10(N = 20); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_20; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_20_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_20_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mos new file mode 100644 index 000000000..96ad072f4 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_20 has 20 equation(s) and 20 variable(s). +// 20 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mo new file mode 100644 index 000000000..40e07edf5 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_320 + extends OneDHeatTransferTT_FD_N_10(N = 320); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_320; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_320_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_320_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mos new file mode 100644 index 000000000..c73777bd9 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_320 has 320 equation(s) and 320 variable(s). +// 320 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mo new file mode 100644 index 000000000..c79c37bc5 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_40 + extends OneDHeatTransferTT_FD_N_10(N = 40); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_40; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_40_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_40_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mos new file mode 100644 index 000000000..94c67b1af --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_40 has 40 equation(s) and 40 variable(s). +// 40 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mo new file mode 100644 index 000000000..835a724a6 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_640 + extends OneDHeatTransferTT_FD_N_10(N = 640); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_640; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_640_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_640_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mos new file mode 100644 index 000000000..e7579d70f --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_640 has 640 equation(s) and 640 variable(s). +// 640 of these are trivial equation(s)." +// "" +// endResult diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mo b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mo new file mode 100644 index 000000000..ab80def05 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mo @@ -0,0 +1,395 @@ +package Modelica "Modelica Standard Library - Version 3.2.2" + extends Modelica.Icons.Package; + + package Icons "Library of icons" + extends Icons.Package; + + partial package ExamplesPackage "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {8.0, 14.0}, lineColor = {78, 138, 73}, fillColor = {78, 138, 73}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-58.0, 46.0}, {42.0, -14.0}, {-58.0, -74.0}, {-58.0, 46.0}})}), Documentation(info = " +

This icon indicates a package that contains executable examples.

+ ")); + end ExamplesPackage; + + partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = " +

Standard package icon.

+ ")); end Package; + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = " +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors:

+ +
+
Martin Otter
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
+
Oberpfaffenhofen
+
Postfach 1116
+
D-82230 Wessling
+
email: Martin.Otter@dlr.de
+
Christian Kral
+ +
Electric Machines, Drives and Systems
+
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

Copyright © 1998-2016, Modelica Association, DLR, AIT, and Modelon AB.

+

This Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in Modelica.UsersGuide.ModelicaLicense2.

+ ")); + end Icons; + + package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992" + extends Modelica.Icons.Package; + type Length = Real(final quantity = "Length", final unit = "m"); + type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0); + type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true); + type Temperature = ThermodynamicTemperature; + type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)"); + type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)"); + annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = " +

This package provides predefined types, such as Mass, + Angle, Time, based on the international standard + on units, e.g., +

+ +
   type Angle = Real(final quantity = \"Angle\",
+                       final unit     = \"rad\",
+                       displayUnit    = \"deg\");
+  
+ +

+ Some of the types are derived SI units that are utilized in package Modelica + (such as ComplexCurrent, which is a complex number where both the real and imaginary + part have the SI unit Ampere). +

+ +

+ Furthermore, conversion functions from non SI-units to SI-units and vice versa + are provided in subpackage + Conversions. +

+ +

+ For an introduction how units are used in the Modelica standard library + with package SIunits, have a look at: + How to use SIunits. +

+ +

+ Copyright © 1998-2016, Modelica Association and DLR. +

+

+ This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ ", revisions = " + + ")); + end SIunits; + annotation(preferredView = "info", version = "3.2.2", versionBuild = 3, versionDate = "2016-04-03", dateModified = "2016-04-03 08:44:41Z", revisionId = "$Id:: $", uses(Complex(version = "3.2.2"), ModelicaServices(version = "3.2.2")), conversion(noneFromVersion = "3.2.1", noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.897, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.368, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092, -52.387}, {-0.684, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.939}, {-77.678, -74.612}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = " +

+Package Modelica® is a standardized and free package +that is developed together with the Modelica® language from the +Modelica Association, see +https://www.Modelica.org. +It is also called Modelica Standard Library. +It provides model components in many domains that are based on +standardized interface definitions. Some typical examples are shown +in the next figure: +

+ +

+ +

+ +

+For an introduction, have especially a look at: +

+ + +

+This version of the Modelica Standard Library consists of +

+ +

+that are directly usable (= number of public, non-partial classes). It is fully compliant +to Modelica Specification Version 3.2 Revision 2 +and it has been tested with Modelica tools from different vendors. +

+ +

+Licensed by the Modelica Association under the Modelica License 2
+Copyright © 1998-2016, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A. Haumer, ITI, C. Kral, Modelon, +TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation. +

+ +

+This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2. +

+ +

+Modelica® is a registered trademark of the Modelica Association. +

+")); +end Modelica; + +package ScalableTestSuite "A library of scalable Modelica test models" + package Thermal "Models from the thermal domain" + package HeatConduction "Models of 1-D heat conduction in solids" + package Models + model OneDHeatTransferTT_FD "Both ends are exposed to a fixed temperature, implemented by FD method" + parameter .Modelica.SIunits.Length L "length"; + parameter Integer N = 2 "number of nodes"; + parameter .Modelica.SIunits.Temperature T0 "Initial temperature"; + parameter .Modelica.SIunits.Temperature T1 "Initial temperature at first node"; + parameter .Modelica.SIunits.Temperature TN "Initial temperature at the last node"; + parameter .Modelica.SIunits.SpecificHeatCapacity cp "Material Heat Capacity"; + parameter .Modelica.SIunits.ThermalConductivity lambda "Material thermal conductivity"; + parameter .Modelica.SIunits.Density rho "Material Density"; + final parameter Modelica.SIunits.Length dx = L / (N - 1) "Element length"; + .Modelica.SIunits.Temperature[N] T "temperature of the nodes"; + initial equation + for i in 2:N - 1 loop + T[i] = T0; + end for; + equation + T[1] = T1; + T[N] = TN; + for i in 2:N - 1 loop + der(T[i]) = lambda * ((T[i - 1] - T[i]) / dx + ((-T[i]) + T[i + 1]) / dx) / cp / rho / dx; + end for; + annotation(Documentation(info = "

A uniform rod has the length L, density ρ, specific heat capacity cp and thermal conductivity λ which are all assumed to be constant. Moreover, the sides of the rod are assumed to be insulated. In HeatConductionTT, both ends are exposed to a fixed temperature. We considered a small portion of the rod which has a width of dx from a distance x, and by considering the conservation of energy the equations are defined. According to the conservation of energy, difference between the heat in from left boundary and heat out from the right boundary has to be equal to the heat change at the portion at Δx in time Δt.

The discretized equations are described in the following form:

where i = 2,..,N−1 and they correspond to the temperature nodes along the rod excluding the temperature variables at the ends. In HeatConductionTT, T1 and TN have constant temperature values.

The parameters for HeatConductionTT_FD are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
LLength of the rod
Nnumber of nodes
T0Initial temperature
T1temperature at the first node
TNtemperature at the last node
cpmaterial specific heat capacity
lambdamaterial thermal conductivity
rhomaterial density
dxelement length
+ ")); + end OneDHeatTransferTT_FD; + end Models; + + package ScaledExperiments + extends Modelica.Icons.ExamplesPackage; + + model OneDHeatTransferTT_FD_N_10 + extends Models.OneDHeatTransferTT_FD(L = 0.2, N = 10, T0 = 273.15, T1 = 330, TN = 300, cp = 910, lambda = 237, rho = 2712); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_10; + + model OneDHeatTransferTT_FD_N_80 + extends OneDHeatTransferTT_FD_N_10(N = 80); + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); + end OneDHeatTransferTT_FD_N_80; + annotation(Documentation(info = "

In this package there are 32 tests for different N values; 8 for the OneDHeatTransferTT_FD, 8 for the OneDHeatTransferTT_Modelica, 8 for the OneDHeatTransferTI_FD and 8 for the OneDHeatTransferTI_Modelica.

The tests for the models are performed according to the N values as shown in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
N
10
20
40
80
160
320
640
1280

Parameter values for OneDHeatTransferTT models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
T1330
TN330
cp910
lambda237
rho2712

Parameter values for OneDHeatTransferTI models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParametersComment
L0.2
N10,20,40,80,160,320,640,1280
T0273.15
TN330
cp910
lambda237
rho2712
")); + end ScaledExperiments; + end HeatConduction; + end Thermal; + annotation(version = "1.8.2", uses(Modelica(version = "3.2.2")), Documentation(info = " +

This library contains a collection of Modelica models whose size can be scaled by means of integer parameter(s). This is useful to test the ability of Modelica tools to compile and simulate models of increasing size efficiently.

+

The library contains examples with a physical motivation, which are also verified against known analytical solutions wherever possible, as well as elementary models to stress some specific features of the Modelica tools.

+

In some cases, when feasible, two mathematically equivalent models are provided, one built by raw equations and the other one built using the Modelica Standard Library. This makes it possible to evaluate how efficiently the Modelica tool can handle the overhead of a modular description both in terms of compilation time, which might be higher due to additional processing, and of simulation time, which should be the same.

+

This work was originally inspired by discussion at the 2014 EOOLT Workshop in Berlin. Version 1.0.0 is the outcome of Kaan Sezginer's master's thesis work at Politecnico di Milano, under the supervision of prof. Francesco Casella. It is expected that the library grows and becomes a reference for the community.

+

The master branch of the library is hosted on GitHub. Please contact , please contact Francesco Casella or directly submit a pull request +if you want to contribute to the library. +

Main Authors

+ +

Copyright © 2015-2016 Politecnico di Milano

+

All rights reserved.

+ +

Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met:

+
    +
  1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission.
  6. +
+

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +

+"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 50}, {50, -100}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 0}, {0, -100}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -40}, {-40, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, -70}, {-68, -100}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)})); +end ScalableTestSuite; + +model OneDHeatTransferTT_FD_N_80_total + extends ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80; + annotation(experiment(StopTime = 350, Tolerance = 1e-6)); +end OneDHeatTransferTT_FD_N_80_total; diff --git a/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mos b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mos new file mode 100644 index 000000000..988cf2f34 --- /dev/null +++ b/flattening/modelica/scodeinst/ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mos @@ -0,0 +1,16 @@ +// ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mos +// keywords: new front-end with checkModel +// status: correct +// cflags: -d=newInst + +loadFile("ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80.mo"); getErrorString(); +checkModel(ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80); getErrorString(); + +// Result: +// true +// "" +// "Check of ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80 completed successfully. +// Class ScalableTestSuite.Thermal.HeatConduction.ScaledExperiments.OneDHeatTransferTT_FD_N_80 has 80 equation(s) and 80 variable(s). +// 80 of these are trivial equation(s)." +// "" +// endResult