Modelica Training Workshop: Avoiding Step Change and Nonlinear Equations

modelica training workshop 8 n.w
1 / 10
Embed
Share

In this workshop by Wangda Zuo and Michael Wetter from Lawrence Berkeley National Laboratory, solutions for avoiding step changes, breaking algebraic loops, and reducing nonlinear equations in system simulations are discussed. Practical methods for handling mass flow rates and initialization problems are also covered, providing valuable insights for enhancing simulation efficiency.

  • Modelica
  • Training
  • Workshop
  • Simulation
  • Nonlinear Equations

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Modelica Training Workshop 8 Wangda Zuo, Michael Wetter Simulation Research Group Energy and Environmental Technologies Division Lawrence Berkeley National Laboratory, USA 6/11/2012

  2. Outline Avoid Step Change Breaking Algebraic Loops Reducing Nonlinear Equations Prescribed Mass Flow Rate Avoiding Overspecified Initialization Problems Pre- and Post Process 2

  3. Avoiding Step Change Problem: Step changes can lead to high computing time or to convergence problems in large systems. Solution: The control input signal of components is sent to a 2nd order low pass filter that changes a step signal to a smooth signal. Flow machines (fans and pumps): boolean parameter filteredSpeed in dynamics Actuators: boolean parameter filteredOpening in dynamics Note: When changing filteredSpeed (or filteredOpening), or when changing the value ofriseTime, the dynamic response of the closed loop control changes. Therefore, control gains may need to be retuned to ensure satisfactory closed loop control performance. 3

  4. Breaking Algebraic Loops Problem: In fluid flow systems, flow junctions where mass flow rates separate and mix can couple non-linear systems of equations. This leads to larger systems of coupled equations that need to be solved, which often causes larger computing time and can sometimes cause convergence problems. Solution: Adds a control volume at the fluid junction that can decouple the system of equations. Set the parameter dynamicBalance to true for model of a flow splitter or mixer fans or pumps 4

  5. Reduce Nonlinear Equations (1) Problem: Computing pressure drop due to flow friction in a serial of components can lead to coupled nonlinear systems of equations that need higher computing time to solve. Pressure drop & Mass flow rate or Solution: Set parameter res2(dp_nominal=0) and add pressure drop in res1(dp_nominal) Set from_dp=false in all components (default setting). 5

  6. Reduce Nonlinear Equations (2) Problem: Solution: Buildings.Fluid.FixedResistances.FixedResistance DpM res( redeclarepackage Medium = Medium, m_flow_nominal=0.2, dp_nominal=10000); Buildings.Fluid.Actuators.Valves.TwoWayLinear val( redeclarepackage Medium = Medium, m_flow_nominal=0.2, dpValve_nominal=5000); Buildings.Fluid.Actuators.Valves.TwoWayLinear val( redeclarepackage Medium = Medium, m_flow_nominal=0.2, dpValve_nominal=5000, dpFixed_nominal=10000); 6

  7. Prescribed Mass Flow Rate Problem: Computing the mass flow rate using the fan/pump curve leads to interaction with flow resistance. In some situations, this can lead to slower simulation or convergence problem. Solution: User prescribed mass flow rate Fan/Pump: Buildings.Fluid.Movers.FlowMachine_m_flow Source Element: Buildings.Fluid.Sources.MassFlowSource_T 7

  8. Overspecified Initialization Problem Problem: In the thermal flow systems, Dymola error message for overspecified problem: Error: The initialization problem is overspecified for variables of element type Real The initial equation ... refers to variables, which are all knowns. To correct it you can remove this equation. Solution: To avoid this: energyDynamics = Modelica.Fluid.Types.Dynamics.DynamicsFreeInitial; massDynamics = Modelica.Fluid.Types.Dynamics.DynamicsFreeInitial; 8

  9. Pre- and Post Processing Background Modelica does not specify the scripting format and format of result file Dymola and OpenModelica generate .mat file Useful Tools Buildings library provides the BuildingsPy Python library http://simulationresearch.lbl.gov/modelica/buildingspy/ to run Modelica simulations using Dymola, to process *.mat output files to run unit tests as part of the library development. Dymola provides MATLAB scripts to process data GenOpt to optimize the cost functions computed by Dymola 9

  10. What is Next Workshops We will look at the details of Modelica programming following the Fritzon s slides. June 13 3:30-5:00pm in 90-1099 Join the Google group if you haven t. https://groups.google.com/group/modelica-buildings Use it and ask questions. 10

More Related Content