Home

Proceedings of the 4th International Modelica Conference, Hamburg

image

Contents

1. mainFrame Pall E3 DialooPiots xl SIS Br n moles POG10 P atm 4 T Tin 20 File Edt View Simulation Format Tools Lon hr all A 25 DO s aa ste 2c r le sol F 200 60 3 a 5 Pause Simulink aol 21 T vivar Up iparam_signal F huar_ sigo e Br y Istate pin 1 signal pe 0 NA letate 0 As 0 had cp crgara o 50 100 150 0 5 100 150 o 50 100 150 CKparam pea time s time s DA E signal ol 20 Vim 3 10 Flow moles s Heat tow s s CKstate sya a T T T T T T T T 77 citar Enabled_signal 5 o DymolaBlock 15l sl 4L CKstate T OPT e nT np 101 OL J 3L enable Clock Time to Workspace 126 9 Reinit col all 2 Pause 2 it Read moz i i ods y ze sabi Je 1 Zl 0 O eady jj 0 50 100 150 0 50 100 150 0 50 100 150 a b X pes pus time s time s time s Figure 3 Perfect gas virtual lab a Simulink model b View c SAA A
2. contains the values used to re initialize the model state In the perfect gas model Istate n p T The array CKstate is used to trigger the state re initialization events which are performed using the Modelica operator reinit Each variable of the array CKstate is used to trigger the events in a differ ent instantiation of the physical model The perfect gas model contains three instantiations of the physical model perfectGasSSl perfectGasSS2 and perfect GasSS3 Consequently the array CKstate has three The Modelica Association 161 Modelica 2005 March 7 8 2005 C Martin A Urquia S Dormido n Number of moles p Absolute pressure V Volume of the gas T Absolute temperature Q U Internal energy Cp Cy Heat capacities F Input flow of gas Tin Input temperature Q Input flow of heat R Perfect gas constant F gt 0 OZ lt _ n lt 10 pV nRT dn_ J 0 empty dt F notempty 0 empty dZ 4 F Cp Tin Q notempty and F gt 0 F Cp T Q U n Cy T Cp Cy R not empty and F lt 0 Figure 1 Model of a perfect gas Virtual lab view Ejs model perfectGasinteractive Modelica model perfectGasSS1 Iparam model perfectGasl ______ 2 i Ivar Bill moas i por mags CKparam mil l a CKvar Bll Istate Hill y CKstate _ l 1 l 1 l 1 l 1 l 1 l 1 1 1 l l l 1 1 1 i 1 1 i T l 1 i l T I i l
3. extends perfectGasI nIsState false else if Enabled signal 2 gt 0 5 pIsState true then SS2 0 signal TIsState true else if Enabled signal 3 gt 0 5 equation then SS3 0 signal Interactive change of the state variables else zeros size O signal 1 when CKstate gt 0 5 and pre CKstateIs0 or end perfectGasInteractive CKstate lt 0 5 and not pre CKstatels0 then CKstatels0 CKstate lt 0 5 reinit p Istate signal 2 reinit T Istate signal 3 end when end perfectGasSSl model perfectGasSS2 extends perfectGasI nIsState true pIsState false TIsState true equation Interactive change of the state variables when CKstate gt 0 5 and pre CKstatels0 or CKstate lt 0 5 and not pre CKstatels0 then CKstatels0 CKstate lt 0 5 reinit n Istate signal 1 reinit T Istate signal 3 end when end perfectGasSS2 model perfectGasSS3 extends perfectGasI nIsState true pisState true TIsState false equation Interactive change of the state variables The Modelica Association 168 Modelica 2005 March 7 8 2005
4. lations from the user is required This results in small scripts developed quickly and easy to maintain LME can be extended by libraries composed of re lated functions written in LME or by extensions de The Modelica Association 164 Modelica 2005 March 7 8 2005 Modeling of Interactive Virtual Laboratories with Modelica setExperiment dsin1 txt t0 tF Inc nInt Tol MaxFixedStep Algorithm setValues dsin1 txt pN p XON x0 dsin txt dsin1 txt linearize dsin1 txt dymosim exe dymosim dsinl txt dsres txt Ne dsres txt dsres txt p x0 pN xON In ON getInfo dslin txt A B C D xN uN yN tloadlin dslin txt name s tload dsres txt Figure 5 Sysquake Dymosim interface functions veloped with standard compilers 3 1 Combined use of Sysquake and Mode lica Dymola A Sysquake interface to Dymosim i e the executable file generated by Dymola 2 has been programmed This interface is a set of functions in LME intended to be used by the Sysquake applications These functions perform the following tasks The setExperiment and setValues functions write the experiment description to a text file This text file is intended to be the input file for dy mosim exe The dymosim and linearize functions execute the dymosim exe file in order to simulate and lin earize the Model
5. well suited for web based and distance education 1 Typically the virtual lab definition includes the fol lowing two parts the model and the view The view is the user to model interface It is intended to provide a visual representation of the model dynamic behav ior and to facilitate the user s interactive actions on the model The graphical properties of the view elements are linked to the model variables producing a bidirec tional flow of information between the view and the model Any change of a model variable value is au tomatically displayed by the view Reciprocally any user interaction with the view automatically modifies the value of the corresponding model variable Two alternative types of interactivity can be imple mented Runtime interactivity The user is allowed to per form actions on the model during the simulation run He can change the value of the model in puts parameters and state variables perceiving instantly how these changes affect to the model dynamic An arbitrary number of actions can be made on the model during a given simulation run Batch interactivity The user s action triggers the start of the simulation which is run to comple tion During the simulation run the user is not allowed to interact with the model Once the sim ulation run is finished the results are displayed and a new user s action on the model is allowed 1 1 Contributions of this paper The implementa
6. H 1 1 i l 1 i 1 fF 1 i 1 l 1 1 I I model perfectGasSS3 l l model perfectGas f l i i I i 1 I l 5 iF 1 I 1 i I i 1 i I li I 1 I i 1 I f T l 1 i 1 i il Figure 2 Schematic description of the perfect gas virtual lab components CKstate 1 triggers the change in the state variables of perfectGasSSI CKstate 2 and CK state 3 trigger the change in the state variables of per fectGasSS2 and perfectGasSS3 respectively see Fig ure 2 The interactive parameters V Cp and the input variables F Tin Q are defined as constant state variables i e with zero time derivative in the phys ical model 4 Their values are changed by using the reinit operator Four input variables to the Dy molaBlock block are used see Figure 2 two arrays param l Ivar containing the new values and two arrays CKparam l CKvar for triggering the re initialization events The output variable array of the DymolaBlock block O see Figure 2 contains the variables linked to the properties of the virtual lab view Ejs uses the value of this output array O to refresh the simulation view The value of the input array Enabled is set by Ejs and it selects which output is connected to the output signal O The output array in the perfect gas model is the following O n p T V Cp Tin F Q The Simulink model of the perfect gas is shown in Figure 3a The Modelica mode
7. causality of the Modelica model interface needs to be explicitly set 2 The input variables are supposed to be calculated from other Simulink blocks while the output variables are calculated from the Modelica model Ejs 3 3 supports the option of describing and simulat ing the virtual lab model using Simulink In this case the data exchange between the virtual lab view com posed using Ejs and the model Simulink block dia gram is accomplished through the Matlab workspace The properties of the Ejs view elements are linked to variables of the Matlab workspace which can be writ ten and read from the Simulink block diagram The Modelica model needs to be built to allow the communication with the virtual lab view It needs to support the discontinuous changes in the value of its state variables parameters and input variables which are the result of the user interaction In some cases several choices of the state variables need to be sup ported simultaneously in the model in order to pro vide the user with alternative ways of describing the state changes A design methodology for the Mode lica model is described in Section 2 2 Further details can be found in 4 6 2 2 Modeling methodology The model of a perfect gas is shown in Figure 1 The input flow of gas F of heat Q and the input tem perature Tin are input variables The gas volume V and the heat capacities Cp Cy are time independent properties of the phys
8. needs to support different choices of the state variables simultaneously An approach to implement this capability is the fol lowing Building the interactive model as composed of several instantiations of the physical model each one with a different choice of the state variables When describing an interactive action on the model the user selects the adequate state variable choice according to his preference This information is transmitted from the virtual lab view to the model Then the interac tive model uses the adequate physical model instan tiation that with the chosen state selection for exe cuting the instantaneous change in the parameters and state variables and for solving the re start problem Finally these calculated values are used to re initialize the other physical model instantiations This action guarantees that all physical model instantiations de scribe the same trajectory Modelica capability for state selection control allows easy implementation of this approach 8 Three in stantiations of the perfect gas model i e perfectGas have been defined see Figure 2 1 perfectGasSS1 with e p T 2 perfectGasSS2 with e n T and 3 perfectGasSS3 with e n p The Appen dix A provides the Modelica code for the perfect gas model Two input variables to the DymolaBlock block are used to carry out the interactive changes in the state Istate and CKstate see Figure 2 The array Istate
9. 2 International Modelica Con ference pp 7 1 7 12 2002 9 Cutlip M B Shacham M Problem Solving in Chemical Engineering with Numerical Methods Prentice Hall 1999 10 Urquia A Modelado Orientado a Objetos y Sim ulaci n de Sistemas H bridos en el mbito del Control de Procesos Qu micos PhD Thesis Dept Inform tica y Autom tica UNED Madrid Spain 2000 11 Urquia A Dormido S Object Oriented Design of Reusable Model Libraries of Hybrid Dynamic Systems Mathematical and Computer Modelling of Dynamical Systems 9 1 pp 65 118 2003 12 Calerga Sarl Sysquake 3 User s Manual Ca lerga Sarl Lausanne Switzerland APPENDIX A Modelica code for the perfect gas model model perfectGas parameter Boolean nIsState plsState Real n unit mol start 20 stateSelect if nIsState then StateSelect always else StateSelect default start le5 if plsState then StateSelect always else StateSelect default TIsState Real p unit N m 2 stateSelect Real T unit K start 300 stateSelect if TIsState then StateSelect always else StateSelect default Real V unit m3 start 1 Real Cp unit J Kg K start 5 R 2 Real Cv unit J Kg K Real F unit mol s 1 Real Tin unit K Real Q unit J s 1 parameter Real R unit J mol K 8 31 protected Real U unit J stateSelect StateSelect never Boolean empty start false equation Interactive param
10. 3 Batch interactive simulation by combining the use of Sysquake and Modelica Dymola Sysquake is a commercial tool intended to develop interactive applications 12 It is based on LME an interpreter specialized for numerical computation LME is mostly compatible with the language of MAT LAB R 4 x and it includes many features of MAT LAB 5 to 7 It implements graphic functions specific to dynamic systems such as step responses and fre quency responses and general purpose functions used for displaying any kind of data Typically a Sysquake application contains several interactive graphics which are displayed simultane ously These graphics contain elements that can be manipulated using the mouse While one of these el ements is being manipulated the other graphics are automatically updated to reflect this change The con tent represented by each graphic and its dependence with respect to the content of the other graphics is pro grammed using LME The main goal of Sysquake is the interactive manipula tion of graphics The user can define functions called handlers intended to perform different tasks managed by Sysquake These tasks include the model initializa tion manipulation of figures and selection of menus As input and output the handlers use variables as well as values managed directly by Sysquake such as the position of the mouse Therefore only the code neces sary for displaying the figures and processing manipu
11. 7 8 2005 C Martin A Urquia S Dormido SISO plant x Ax Bu y Cx gt s a b e AG Sysquake 3 Intitlec E Fie Edt Settings Pots Figue Layout View Window Help aja 9 8 ol Eele Consttuve Relation la x i Figure 8 View of the control loop virtual lab the controller constitutive relation can be changed by dragging the mouse Roots plot graphic on the lower left The plant zeros and poles can be changed by click ing on the circles and crosses and dragging the mouse Reference plot graphic on the lower right The shape of the piecewise linear function and the amplitude and frequency of the sine function can be modified by clicking on the lines and cir cles that appear in the graphic and dragging the mouse Figure 9 View of the heat exchanger virtual lab 3 3 Case study III heat exchanger The heat exchanger virtual lab described in Section 2 3 supports runtime interactivity It was imple mented using Ejs Simulink and Modelica Dymola In this section the heat exchanger model is revisited and a virtual lab supporting batch interactivity is pro grammed by combining the use of Sysquake and Mo delica Dymola The view of the virtual lab is the Sysquake application shown in Figure 9 The sliders placed on the upper left side allow modifying so
12. A O AO SN AU AU A OA Ea a a aaa a a Ya Pel i Bal ay dl al alk E heatexchmodel 57x qJ E H amp amp amp EE EEE Pt ve Sinton foma tose t Es Fm E Deus rre a fy Hw Hn a a H H Hah Iparam tol tol tol del tel tel tol el te se eer COM loloa sioa 4 4 4 4 4 ae AH HAHAH amp oe Oh i Ea Istate_s CKparam el A kal ak ool Ckvar Ear signal r alt tol tol tol tol tol tol tol ot a ee pia D ClockTime to Workspace E Te o Ready 100 CE z a b EIE E characterises A zi Input temperature 17 9 60 Liquid temperatures Gas temperatures E r r i feria 50 put flow 0 01 Input flow 0 17 40 SS yee Oo 30 20 Pipe length 1 ult Inner diam pipet 0 019 E oa 100 69 A Outer diam pipet 0 022 EEGI AaS Inner diam pipe2 0 038 Wali temperatures Pumps temperatures 100 Ji 2 50 i 0 L 4 a 0 50 100 15 time s time s Liquid Flow Gas Flow 10 th 05 f i osl oal J asl 03 gt E X oal 202 0 1 Pause 7 Geometry Para L Modify state an F Play 00 00 L 1 dl s o 50 100 o 50 100 150 ja c02 0 600 Reset Show diagrams Molar fraction i time s Taote Figure 4 Heat exchanger virtual lab a Physical model b Simulink model c View The Modelica Association 163 Modelica 2005 March 7 8 2005 C Martin A Urquia S Dormido 2 3 Case study I heat exchanger The interactive simulation of a heat exchanger has been implemented by the combined us
13. Boolean CKparamIs0O start true fixed true odelica Blocks Interfaces OutPort O n 8 Boolean CKvarls0 start true fixed true odelica Blocks Interfaces OutPort Release n 1 Boolean CKstatels0 start true fixed true perfectGasSS1 SS1 CKparam CKparam signal 1 equation CKvar CKvar signal 1 Interactive change of the parameters CKstate CKstate signal 1 when CKparam gt 0 5 and pre CKparamIs0 or perfectGasSS2 SS2 CKparam CKparam signal 2 CKparam lt 0 5 and not pre CKparamIs0 then CKvar CKvar signal 2 CKparamIs0 CKparam lt 0 5 CKstate CKstate signal 2 reinit V Iparam signal 1 perfectGasSS3 SS3 CKparam CKparam signal 3 reinit Cp Iparam signal 2 CKvar CKvar signal 3 end when CKstate CKstate signal 3 Interactive change of the input variables equation when CKvar gt 0 5 and pre CKvarls0 or connect Iparam SS1 Iparam CKvar lt 0 5 and not pre CKvarls0 then connect Istate SSl Istate CKvarls0 CKvar lt 0 5 connect Ivar SSl Ivar reinit F Ivar signal 1 connect Iparam SS2 Iparam reinit Tin Ivar signal 2 connect Istate SS2 Istate reinit Q Ivar signal 3 connect Ivar SS2 Ivar end when connect Iparam SS3 Iparam Output signal connect Istate SS3 Istate O signal n p T V Cp Tin F Q connect Ivar SS3 Ivar end perfectGasl Release signal 4 0 O signal if Enabled signal 1 gt 0 5 model perfectGasSS1l then SS1 0 signal
14. Ejs capabilities for model description and numerical solution However Simulink modeling paradigm i e graphical block diagram modeling exhibits some limitations 7 It re quires explicit state models ODE and that the blocks have a unidirectional data flow from inputs to out puts These restrictions strongly condition the mod eling task which requires a considerable effort from the modeller The use of Modelica language is an attractive alterna tive to Simulink because it reduces considerably the modeling effort and permits better reuse of the mod els The combined application of Modelica Dymola and Ejs to the implementation of virtual labs in dis cussed next 2 1 Combined use of Ejs Matlab Simulink and Modelica Dymola Dymola 5 0 interface to Simulink 3 0 can be found in Simulink s library browser DymolaBlock block 2 This block is an interface to the C code gener ated by Dymola for the Modelica code DymolaBlock block can be connected to other Simulink blocks and also to other DymolaBlocks blocks in the Simulink s workspace window Simulink synchronizes the nu The Modelica Association 160 Modelica 2005 March 7 8 2005 Modeling of Interactive Virtual Laboratories with Modelica merical solution of the complete model performing the numerical integration of the DymolaBlock blocks together with the other blocks In order to make the Modelica model useful as a Dy molaBlock block the computational
15. MODELICA Proceedings of the 4th International Modelica Conference Hamburg March 7 8 2005 Gerhard Schmitz editor C Martin A Urquia S Dormido UNED Madrid Spain Modeling of Interactive Virtual Laboratories with Modelica pp 159 168 Paper presented at the 4th International Modelica Conference March 7 8 2005 Hamburg University of Technology Hamburg Harburg Germany organized by The Modelica Association and the Department of Thermodynamics Hamburg University of Technology All papers of this conference can be downloaded from http www Modelica org events Conference2005 Program Committee Prof Gerhard Schmitz Hamburg University of Technology Germany Program chair Prof Bernhard Bachmann University of Applied Sciences Bielefeld Germany Dr Francesco Casella Politecnico di Milano Italy Dr Hilding Elmqvist Dynasim AB Sweden Prof Peter Fritzson University of Linkping Sweden Prof Martin Otter DLR Germany Dr Michael Tiller Ford Motor Company USA Dr Hubertus Tummescheit Scynamics HB Sweden Local Organization Gerhard Schmitz Katrin Prol8 Wilson Casas Henning Knigge Jens Vasel Stefan Wischhusen TuTech Innovation GmbH Modeling of Interactive Virtual Laboratories with Modelica Modeling of Interactive Virtual Laboratories with Modelica Carla Martin Alfonso Urquia Sebastian Dormido Departamento de Informatica y Automatica E T S de Ingenieria Informatica UNED Juan del Ro
16. Piguet Calerga Sarl Lausanne CH for his constructive comments This work has been supported by the Spanish CICYT under DPI2001 1012 and DPI2004 1804 grants References 1 Dormido S Control learning Present and Fu ture In Annual Reviews in Control vol 28 pp 115 136 2004 2 LL Dynasim AB Dymola User s Manual Version 5 0a Dynasim AB Lund Sweden 3 Esquembre F Easy Java Simulations a Software Tool to Create Scientific Simulations in Java In Computer Physics Communications vol 156 pp 199 204 2004 4 Martin C Urquia A Sanchez J Dormido S Es quembre F Guzman J L Berenguel M Interac tive Simulation of Object Oriented Hybrid Mod els by Combined use of Ejs Matlab Simulink and Modelica Dymola In Proc 18th European Simulation Multiconference pp 210 215 2004 5 Martin C Urquia A Dormido S JARA 2i A Modelica Library for Interactive Simulation of Physical Chemical Processes In Proc Euro pean Simulation and Modelling Conference pp 128 132 2004 6 Martin C Urquia A Dormido S Object Oriented Modeling of Virtual Laboratories for Control Education 16 IFAC World Congress Praha Czech Republic July 2005 Accepted 7 Astrom K J Elmqvist H Mattsson S E Evolu tion of Continuous Time Modeling and Simula tion In Proc of the 12 European Simulation Multiconference Manchester UK 1998 8 Otter M Olsson H New features in Modelica 2 0 In Proc
17. e of Ejs Mat lab Simulink and Modelica Dymola A mixture of car bon dioxide and sulfur dioxide is cooled by water in a double pipe heat exchanger 9 Two modes of opera tion are allowed cocurrent or parallel flow and coun tercurrent flow The convective heat transfer on both the tube and shell sides are calculated from the Dittus Boelter correlation 9 The center heat exchanger tube is made of copper with a constant thermal conductiv ity and the exterior of the steel pipe shell is very well insulated The physical model of the heat exchanger has been composed using JARA The model diagram is shown in Figure 4a JARA is a set of libraries of some funda mental physical chemical principles JARA was origi nally written in Dymola language 10 11 Later on it was translated into Modelica language The method ology discussed in Section 2 2 was applied in order to make JARA useful for interactive simulation 5 JARA is composed of seven model libraries including models of Control volumes containing 1 an ideal mixture of an arbitrary number of semi perfect gases or 2 a homogeneous liquid mixture composed of an arbitrary number of components or a homo geneous solid The liquid and gaseous control volumes are considered open systems i e they can exchange mass and heat with their environ ment and chemical reactions can take place in side them The solid control volumes are con sidered closed systems i e they onl
18. eters der V 0 der Cp 0 Input variables der F 0 der Tin 0 der 0 0 State equation pe V nx x Rx T Mol balance der n if empty then 0 else F Energy balance der U if empty then 0 else if F gt 0 then F Cp Tin O else Fx Cpx T 0 Internal energy U n Cv gt T Mayer law Cp Cv R Empty vessel condition The Modelica Association 167 Modelica 2005 March 7 8 2005 C Martin A Urquia S Dormido when F gt 0 and pre empty or when CKstate gt 0 5 and pre CKstatels0 or n lt le 5 and not pre empty then CKstate lt 0 5 and not pre CKstatels0 then empty not pre empty CKstatels0 CKstate lt 0 5 end when reinit n Istate signal 1 end perfectGas reinit p Istate signal 2 end when model perfectGasI end perfectGasSS3 extends perfectGas Modelica Blocks Interfaces InPort Iparam n 2 model perfectGasInteractive Modelica Blocks Interfaces InPort Ivar n 3 odelica Blocks Interfaces InPort Iparam n 2 Modelica Blocks Interfaces InPort Istate n 3 odelica Blocks Interfaces InPort Ivar n 3 Real CKparam odelica Blocks Interfaces InPort Istate n 3 Real CKvar odelica Blocks Interfaces InPort CKparam n 3 Real CKstate odelica Blocks Interfaces InPort CKvar n 3 Modelica Blocks Interfaces OutPort O n 8 odelica Blocks Interfaces InPort CKstate n 3 protected odelica Blocks Interfaces InPort Enabled n 3
19. ica model respectively The tload and tloadlin functions 1 read the out put file generated by dymosim exe after a model simulation or linearization respectively and 2 save these results as variables to the Sysquake workspace These variables can be used by Sysquake applications Next a brief description of each function is provided see Figure 5 setExperiment txtFile StartTime StopTime In crement ninterval Tolerance MaxFixedStep Al gorithm It writes to the txtFile text file default file name dsin1 txt the simulation parameters p x0 pN xON InputN outputN getinfo This function executes the dymosim exe file command dymosim i in order to generate the Dymosim in put file dsin txt In addition this function reads the names of the model variables i e inputs out puts parameters states and their default values from dsin txt file and saves them as variables to the Sysquake workspace SetValues txtFile pN p xON xO The name and the value of the model parameters and state vari ables are written to the txtFile text file dsin txt by default dymosim iFile oFile This function executes the following command dymosim d dsin txt iFile oFile The default file name for iFile and oFile is dsinl txt and dsres txt respectively linearize iFile oFile This function obtains the linearized model by executing the command dy mosim l iFile oFile The default file na
20. ical system In general different choices of the model state variables are possible Possible choices in the model shown in Figure 1 include e p T e2 n T and ez n p where e represents one particular choice of the state variables If the user wants to change interactively p and 7 the appropriate choice is ey p T This is also the right choice if the user wants to change p and to keep constant T or of he wants to change T and to keep constant p Like wise the appropriate choice is ez if the user wants 1 to modify interactively n and T or 2 to modify n and to maintain constant 7 or 3 to modify T and to maintain constant n An analogous reasoning is ap plied to e3 In general an interactive model is required to support state changes that correspond with different choices of the state variables In addition interactive changes of the model parame ters can have different effects depending on the state variable choice Consider an instantaneous change in the gas volume V of the model shown in Figure 1 If the state variables are e p T then the change in V produces an instantaneous change in the number of moles n while the pressure p and the temperature T remain constant On the contrary if the state vari ables are e n T then the change of volume pro duces a change of pressure In this case the number of moles n and the temperature remain constant As a consequence the interactive model
21. l perfectGasInterac tive is embedded within the DymolaBlock block The blocks connected to the DymolaBlock inputs MAT LAB Fcn blocks transmit the value of the input variables from the Matlab workspace to the Simulink block diagram window The blocks connected to the DymolaBlock outputs To Workspace blocks trans mit the value of the output variables from the Simulink block diagram window to the Matlab workspace Ejs reads the value of these output variables from the Mat lab workspace and writes the value of the input vari ables in the Matlab workspace The view of the virtual lab is shown in Figure 3b The main window on the left side contains the schematic diagram of the process above and the control buttons below Both of them allow the user to experiment with the model The vessel volume represented in the schematic diagram is linked to the V variable Its value can be interactively changed by clicking on the hand picture and dragging the mouse Three radio but tons allow choosing the state variables p T n T or n p Text fields allow the user set the value of the state variables n p T the input variables F Tin Q and the parameters V Cp The window placed on the right side of the virtual lab view contains graphic plots of the model variables The Modelica Association 162 Modelica 2005 March 7 8 2005 Modeling of Interactive Virtual Laboratories with Modelica
22. me for iFile and oFile is dsinl txt and dslin txt respec tively N s tload oFile This function reads the re sult file oFile default file name dsres txt and stores the signal names and the simulation results into N text matrix and s numeric matrix re spectively A B C D xN uN yN tloadlin txtfile It loads the linear model generated by dymosim from the txtfile result file default file name dslin txt into the Sysquake workspace Next two case studies are provided to illustrate the use of this Sysquake Dymosim interface 3 2 Case study II control loop The interactive simulation of the control loop shown in Figure 6 is implemented by combining the use of Sysquake and Modelica Dymola The constitutive re lation of the hysteresis based controller in shown in Figure 7 The setpoint is the composition of two signals a piecewise linear function and a sine func tion The model of the control loop has been pro grammed using Modelica language and translated us ing Dymola The execution of the dymosim exe file generated by Dymola is controlled by the Sysquake application i e the virtual lab view The view of the virtual lab is the Sysquake application shown in Figure 8 It is composed of four graphics Three of them are interactive Constitutive relation plot graphic on the upper left The position of the a b c d e f points of The Modelica Association 165 Modelica 2005 March
23. me model parameters the pipe length and diameters and the thermal parameters of the center heat exchanger tube The graphic on the upper right corner is interactive It represents the time evolution of the inlet temper ature of the water The shape of this curve can be changed by clicking on one of the points and dragging the mouse The graphics on the lower side of Figure 9 show the time evolution of the temperature at certain positions of the tube and the shell 4 Conclusions The feasibility of combining Modelica Dymola with Ejs and Sysquake for implementing runtime and batch interactive simulations respectively has been demon strated Ejs and Sysquake are software tools intended to develop interactive applications Their strong point is the programming of the virtual lab view Work ing together with Modelica Dymola significantly im proves the Ejs and Sysquake capabilities for model description and simulation The use of Modelica lan guage reduces considerably the modeling effort In order to implement this software combination ap The Modelica Association 166 Modelica 2005 March 7 8 2005 Modeling of Interactive Virtual Laboratories with Modelica proach a modeling methodology has been proposed and a Sysquake Dymosim interface has been pro grammed Several case studies of virtual labs sup porting runtime and batch interactivity have been dis cussed Acknowledgements The authors wish to thank Dr Yves
24. sal 16 28040 Madrid Spain Abstract The implementation of virtual labs supporting runtime and batch interactivity is discussed and it is illustrated by means of several case studies The virtual lab mod els have been programmed using Modelica language and translated using Dymola The virtual lab views i e the user to model interfaces have been imple mented using Ejs and Sysquake This software com bination approach allows us to take advantage of the best features of each tool Ejs and Sysquake capabil ity for building interactive user interfaces composed of graphical elements whose properties are linked to the model variables Modelica capability for phys ical modeling and Dymola capability for simulating hybrid DAE models In order to implement this approach the following tasks have been completed 1 a novel modeling methodology adequate for runtime interactive simu lation using Ejs Simulink and Modelica Dymola has been proposed and 2 a Sysquake to Dymosim inter face has been programmed a set of functions in LME intended to be used by the Sysquake applications 1 Introduction A virtual lab is a distributed environment of simula tion and animation tools intended to perform the in teractive simulation of a mathematical model Virtual labs provide a flexible and user friendly method to de fine the experiments performed on the model In par ticular interactive virtual labs are effective pedagogi cal resources
25. tion of interactive virtual labs is dis cussed in this manuscript Runtime and batch inter activity are considered In both cases the models are programmed using Modelica language and translated using Dymola 2 The view of the virtual labs sup porting runtime interactivity has been implemented using Easy Java Simulations 3 abbreviated Ejs http fem um es Ejs The view of the virtual labs supporting batch interactivity has been programmed using Sysquake http www calerga com This software combination approach allow us to take advantage of the best features of each tool Ejs and Sysquake capability for building interactive user interfaces composed of graphical elements whose properties are linked to the model variables Modelica capability for physical modeling and finally Dymola capability for simulating hybrid DAE models The Modelica Association 159 Modelica 2005 March 7 8 2005 C Martin A Urquia S Dormido The tasks completed to successfully implement this approach are discussed In particular Runtime interactive simulation The communi cation between the virtual lab view programmed using Ejs and the virtual lab model C code gen erated by Dymola is accomplished by using the Ejs Simulink and the Dymola Simulink in terfaces The C code generated by Dymola for the Modelica model can be embedded within a Simulink block 2 On the other hand Ejs allows the model to be partially or completel
26. wnloaded from the web site http fem um es Ejs Ejs guides the user in the process of creating the model and the view generates the Java source code of the virtual lab program com piles the program packs the resulting object files into a compressed file and generates HTML pages con taining the virtual lab as an applet Then the user can readily run the virtual lab and or publish it on the In ternet The view definition is a strong point of Ejs Ejs in cludes a set of ready to use visual elements that the modeller can use to compose a sophisticated view in a simple drag and drop way The properties of the view elements can be linked to the model variables On the contrary the model definition and simulation is a weak point of Ejs Ejs provides its own proce dure to define the model which must be formulated by the user as a sorted sequence of algorithm clauses i e assignment statements Ejs implements some standard ODE solvers However it implements nei ther algorithms for symbolic formula manipulation nor algebraic loop solvers Ejs version 3 3 release 2004 provides a Ejs to Mat lab Simulink interface Therefore Ejs 3 3 supports the option of describing and simulating the model us ing Matlab Simulink 1 Matlab code and calls to any Matlab function can be used at any point in the Ejs model and 2 the Ejs model can be partially or completely developed using Simulink block diagrams This significantly improves the
27. y devel oped using Simulink block diagrams As a conse quence virtual labs supporting runtime interac tivity can be implemented by combining the use of Ejs Matlab Simulink and Modelica Dymola The Modelica model needs to be adequately for mulated in order to be 1 useful as a Simulink block 2 able to accept information from the virtual lab view and 3 able to return infor mation to the virtual lab view As a conse quence a modeling methodology has been pro posed It states how a Modelica model can be formulated to suit runtime interactive simula tion This methodology has been successfully ap plied to program a set of virtual labs for chemi cal process control One of them is discussed in this manuscript the virtual lab of a double pipe heat exchanger Other virtual labs are discussed in 4 5 6 Batch interactive simulation A set of Sysquake functions has been programmed to facilitate data exchange between the view and the model of the virtual lab These functions synchronizes the ex ecution of the dymosim exe file generated by Dy mola and the Sysquake application The com bined use of Sysquake and Modelica Dymola for virtual lab programming is illustrated by means of two case studies 2 Runtime interactive simulation by combining the use of Ejs Simulink and Modelica Dymola Easy Java Simulations Ejs is a open source Java based software tool intended to implement virtual labs It can be freely do
28. y exchanges energy not mass with their environment Mass transport due to the pressure and concen tration gradient the gravitational acceleration chemical reactions liquid vapor phase changes etc Heat transport by conduction and convection The Simulink model is shown in Figure 4b The interactive model of the heat exchanger written in Modelica language has been embedded within the DymolaBlock block Observe that the structure of this Simulink model is completely analogous to the perfect gas model shown in Figure 3a The view of the virtual lab is shown in Figure 4c The main window on the left side contains 1 a diagram of the heat exchanger 2 buttons to control the simu lation run i e pause reset and play 3 sliders and a text field to modify the input variables i e liquid and gas flows liquid and gas input temperatures and mo lar fraction of CO2 and SO in the gas mixture and 4 checkboxes to show and hide three secondary win dows Geometry Parameters Modify State and Characteristics The Geometry Parameters window contains text fields that can be used to modify the pipe length and diameters The controls placed in the Modify State window allow changing the temperature of the medium inside each control volume i e the cooling liquid the gas mixture or the metal wall Finally Characteristics is a window with several plots of the model variables

Download Pdf Manuals

image

Related Search

Related Contents

PCA2 – Caisse d`essai et d`analyse des organes de protections  Novosepara 4 Aluminio  HRP-Antibody All-In-One Conjugation Kit Technical Manual  technical info  intext:installationshandbuch filetype:pdf  User Manual - Rohde & Schwarz  POWER BANK 2200mAH  Sony SS-SP40FW User's Manual  Télécharger - Office de Tourisme de Sillé le Guillaume  取扱説明書 ホームシアタースピーカーシステム  

Copyright © All rights reserved.
Failed to retrieve file