130 likes | 232 Views
Media and Fluid. Draft 2010-10-28 Adrian Pop & Martin Sjölund [ Adrian.Pop@liu.se , Martin.Sjölund@liu.se ]. Media. Draft 2010-10-28 Adrian Pop & Martin Sjölund [ Adrian.Pop@liu.se , Martin.Sjölund@liu.se ]. Requirements (I). Front End (from Francesco)
E N D
Media and Fluid Draft 2010-10-28 Adrian Pop & Martin Sjölund [Adrian.Pop@liu.se, Martin.Sjölund@liu.se]
Media Draft 2010-10-28 Adrian Pop & Martin Sjölund [Adrian.Pop@liu.se, Martin.Sjölund@liu.se]
Requirements (I) Front End (from Francesco) • full support of replaceable redeclare extends of functions, records and packages, as you can easily see by browsing, e.g., Modelica.Media.IdealGases.Common.SingleGasNasa • full support of arrays of records • full support of package constants (including arrays of records of constants): they are used widely in the package, for some reason they were often a problem in earlier versions of Dymola, and I somehow got the impression that they are also problematic in OMC, though I have difficulties understanding what's difficult about constants :)
Requirements (II) Back End (from Francesco) • function inlining (I understand this is now firmly in place) • lateInline might help with the water/steam model, but it is not essential • common subexpression elimination can be beneficial to avoid unnecessary multiple evaluations of heavy functions • tearing is essential in order to solve real-life nonlinear models efficiently
Milestone White December (I) Milestone White December Report • https://openmodelica.org:8443/cb/proj/report/execute.do?doc_id=1456 • 1336 Implement a preprocessing phase from SCode to SCode that simplifies instantiation • 1334Do dependency analysis in instElementList • 1332Media: Redeclare record doesn't work correctly • 1333Rewrite Cevalfunc to use the instantiated DAE instead of SCode. • NO (1327 Use DAE.Type instead of DAE.ExpTypeeverywhere) • MetaModelica profiling • Back-end/Front-end separation
Milestone White December (II) https://openmodelica.org:8443/cb/issue/1336 Implement an preprocessing phase that removes • extends (copies the components from base class and applies the modifications) • imports (transforms all type names to fully qualified ones) • redeclare (applies the redeclares by replacing the redeclared parts) • fully qualifies the class names (SCode.name becomes SCode.path). This will benefit us several ways • instantiation will be easier and more robust. • lookup will be less complex • error messages will be better • API functionality will not require partial instantiation
Milestone White December (III) https://openmodelica.org:8443/cb/issue/1334 Do dependency analysis in instElementList • In order to instantiate Modelica.Media models, we need to instantiate elements in the order of dependencies. First constants, then parameters, then variables. You need to start with constants that have no dependencies on other constants in the package. As a first step, we could simply say that constants with bindings that contain function calls are instantiated after any other constant (functions may refer to constants in this package). If this does not solve the issues, we need all dependencies in all functions called by this function, etc. • You can verify that this solves some issues in Modelica.Media by changing the order of the declared constants in packages. • Note: You cannot do the dependency analysis lazy (instElement on another element if we realize it's needed). The reason for this is that you sometimes end up with infinite loops. • In Inst.Classdef2 we currently sort all conditional components so that they are instantiated last, since they might depend on other components (this is safe to do, since conditional components can't be dependencies of each other or other components). If we do dependency checking I guess this is not needed any more.
Milestone White December (IV) https://openmodelica.org:8443/cb/issue/1332 Media: Redeclare record doesn't work correctly • The correct record constructors are not added to the FunctionTree. Plus, Cevalfunc does not work which means Media becomes really slow classC recordmyRendmyR; end C; class B replaceable record R end R; end B; class A extends B(redeclare record R = C.myR); Real r = fn(); functionfn output Real r; algorithm R(); r := 42.42; end fn; end A;
Milestone White December (V) https://openmodelica.org:8443/cb/issue/1333 Rewrite Cevalfunc to use the instantiated DAE instead of SCode • TodayCevalfunc uses SCode (why is doing that, nobody knows, maybe BZ). • We should rewrite it so it uses the *ALREADY* instantiated DAE forthe function and interpret the DAE algorithm. • This will also speed up the function evaluation as you won‘t doStatic.elabExp and Ceval.ceval all over again. • This is also needed for Modelica.Media as Cevalfunc doesn't handle extended or derived functions and some other things.
Milestone White December (VI) https://openmodelica.org:8443/cb/issue/1327 Use DAE.Type instead of DAE.ExpType everywhere • Right now we have two types: DAE.Type which we translate to DAE.ExpType. • We should *REMOVE* DAE.ExpType as the DAE.Type -> DAE.ExpType translation consumes a lot of CPU and Memory for nothing.
Fluid Draft 2010-10-28 Adrian Pop & Martin Sjölund [Adrian.Pop@liu.se, Martin.Sjölund@liu.se]
Milestone White December (VII) https://openmodelica.org:8443/cb/issue/1269 Implement stream connectors one-to-one connection only • Implement stream connectors, the one-to-one connection only • ModelicaSpecification 3.2, page 176-177 • For inside-inside connections no equations are added. • For outside-inside connections one equality equation is added. • inStream operator • actualStream operator
The End This document is stored in Subversion (not yet, but it will be) https://openmodelica.ida.liu.se/svn/OpenModelica/trunk/doc/performance www.OpenModelica.org