
A Simulation Environment for Efficiently Mixing Signal Blocks and Modelica Components Ramine Nikoukhah Masoud Najafi Fady Nassif ALTAIR ENGINEERING, FRANCE, [email protected] Abstract mix both standard Scicos blocks and Modelica compo- nents in the same environment. A similar extension was There exist several specialized tools that provide environ- later introduced in Simulink with the introduction of the ments for the development and simulation of either pure SimscapeTM language (Simscape). Modelica models or pure signal based models. These en- Scicos/Modelica environment based on the Modelicac vironments have each their own advantages and flaws. TM compiler (Furic, 2007) provides a versatile modeling envi- solidThinking Activate has been developed to mix ronment, especially thanks to the Coselica library2. Even these domains and take advantage of both of these ap- though this extension allows Scicos users to use some proaches to system modeling. This paper presents this Modelica components in the construction of their models, mixed Signal-Modelica environment, and in particular the it has many limitations. For example Modelica libraries efforts and challenges faced in its development. cannot be automatically imported and used in Scicos. Keywords: Modelica tool, Signal based tool, FMI Activate is a professional simulation tool developed by Altair Engineering based on the open source academic 1 Introduction simulation software Scicos. As such, it inherits many The Modelica R language1 and tools are successfully used of Scicos features including the close integration with a for modeling physical systems in industrial applications. matrix-based scripting and programming language. In Activate, the HyperMath Language (HML) has replaced This success is primarily due to the ability of Modelica to 3 4 express mathematical equations corresponding to physical Scilab and NSP . And for the Modelica extension, Scicos Modelicac has been replaced with the MapleSimTM com- phenomena in a natural way (Modelica Association; Peter 5 Fritzson). piler developed by Maplesoft in Activate. For modeling complete systems, for example systems Activate and Scicos both use the same mechanism to including controllers, Modelica provides other features integrate Modelica: at compile time, they aggregate Mod- that makes it go beyond a declarative language for ex- elica components and create a Modelica program which pressing equations. Data types other than reals, algorithm is then processed by the Modelica compiler providing sections, Matlab-like matrix operations are introduced to the C code corresponding to the simulating function of a R block replacing these Modelica components in the origi- dispense of the use of other tools, in particular Matlab 6 and Simulink R for handling models with control compo- nal model . The Activate environment however provides nents. Yet, still in many applications, the design process specific features that has allowed taking the Modelica in- requires using Modelica to model the physical plant and tegration beyond what is available today in Scicos. This exporting the model in the Matlab/Simulink environment paper presents this new modeling environment. for controller design. The reason for this is in part the limitations of the Modelica language, which is not well 2 Motivations suited for creating block diagrams, such as the ones used It is widely agreed upon that for many applications Mod- in control applications, for which specialized tools such as elica today does not provide a viable alternative to block- Simulink, Scicos (Campbell et al., 2010), and solidThink- based modeling tools such as Simulink, Scicos and Ac- TM ing Activate have been developed. tivate. The limitations imposed by the language make it In an attempt to provide an environment for modeling difficult to provide the types of blocks that are needed efficiently both blocks and physical components, in 2002 Modelica was introduced in the Scicos environment in the 2http://www.kybdr.de/software. framework of the publicly funded project RNTL (Réseau 3http://www.scilab.org National des Technologies Logicielles) Simpa (Simula- 4https://cermics.enpc.fr/~jpc/nsp-tiddly tion pour le Process et l’Automatique). This Scicos ex- 5http://www.maplesoft.com 6 tension (Najafi et al., 2004, 2005a,b; Nikoukhah, 2006; A noteworthy difference is that in Scicos this simulation function represents a DAE (Differential Algebraic Equations) forcing Scicos to Nikoukhah and Furic, 2009) allowed Scicos users to use a DAE solver, whereas in Activate the simulation function is pro- vided as a model-exchange FMU representing ODEs. This difference 1http://www.modelica.org. however is not relevant to the presentation here. DOI Proceedings of the 12th International Modelica Conference 831 10.3384/ecp17132831 May 15-17, 2017, Prague, Czech Republic A Simulation Environment for Efficiently Mixing Signal Blocks and Modelica Components Figure 1. Different modules in Activate and their interactions. to model control systems. For example creating a sim- implementation of Modelica is considered with Julia7 as ple multiplexer block capable of concatenating a variable User Language. This undertaking is very ambitious in that number of vectors and scalars of different data types is the Underlying Language is also used for defining the dy- complicated in Modelica. Same is true for the summa- namics of blocks and components. The Activate/Modelica tion block and many other basic mathematical operations environment presented here is developed with this consid- (Elmqvist et al., 2016). eration in mind and follows the spirit of Scicos but uses HML as the Underlying Language. It does not go as far as Other limitations come from the lack of a powerful sup- defining dynamics of blocks in HML (except for embed- porting math environment. The computation of model pa- ded code generation purposes (Chancelier and Nikoukhah, rameters, post processing of the simulation results, etc., 2015)); but rather it makes a clear distinction between the require access to math and engineering libraries, which block/model creation and compilation, and runtime sim- could in theory be developed or interfaced in Modelica, ulation. Model creation, evaluation and compilation, and but would require an enormous and lasting effort. In in general anything that can be done before the start and short it would amount to developing alternatives to Mat- after the end of runtime simulation are based strongly on lab, Scilab, HML, or Nsp, including their specialized tool- the User Language. On the other hand the block dynamics boxes in control, signal processing, communication, opti- need not be based on the User Language. The “standard” mization, etc. Some Modelica tools already use other lan- (Signal) Activate blocks have in general their runtime sim- guages, for example Maple and Python, for such support. ulation functions expressed in C, and the equations of Ac- tivate physical components are expressed in Modelica. A reasonable solution to this problem is to base the sim- This approach allows the Activate/Modelica environ- ulation environment on a “User Language”, preferably a ment to take advantage of existing technologies: Acti- matrix-based mathematical language such as Scilab, Mat- vate (synchronous semantics, block libraries, compiler, lab, Nsp, Octave, HML, or even on non-matrix based Simulink import (Weis, 2015) facility) and Modelica (ex- languages such as Python and LUA. The key point is to isting Modelica compilers, in particular the MapleSim give users the ability to interact with the simulation model compiler, and existing Modelica libraries such as MSL). through this language for anything from block/component creation, model construction, parameterization, compila- 3 Activate/Modelica environment fea- tion, code generation and simulation to data collection, post processing, optimization, and more. The Scicos en- tures vironment was developed in this spirit with Scilab as User Activate is not a Modelica tool per se; it cannot be used Language. Matlab is the User Language for Simulink and conveniently to build Modelica libraries. Its objective is to Simscape. propose a unique harmonious environment to allow mix- ing regular Activate blocks and Modelica components in a A very interesting effort in this direction is under- taken in (Elmqvist et al., 2016), where a complete re- 7http://julialang.org. 832 Proceedings of the 12th International Modelica Conference DOI May 15-17, 2017, Prague, Czech Republic 10.3384/ecp17132831 Session 11A: Modelica Tools & GUIs same model. The user interface and behavior of Modelica of the AU in this case are the A, B, C, D matrices, which blocks and regular Activate blocks are designed to be as are computed by the HML function associated with the similar as possible without being too different from user block. interface of other Modelica tools. The Modelica compo- In general an AU is a computational unit providing nents are seen as regular Activate block in this environ- APIs to be used by the simulator. The APIs are C func- ment. tions that are called by the simulator at different stages of the simulation: computation of the output, of the state 3.1 Modularity derivative, of the next discrete state, etc. But the AUs can A key architectural element in Activate is modularity. The also be Modelica components. An AU may also be virtual. diagram in Figure1 shows different modules that consti- The creation of AUs from Activates blocks based on tute Activate. There are three main modules, the graphical a User Language
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-