没有合适的资源?快使用搜索试试~ 我知道了~
首页OpenModelica用户手册
OpenModelica用户手册
5星 · 超过95%的资源 需积分: 47 218 下载量 201 浏览量
更新于2023-03-16
评论 6
收藏 5.76MB PDF 举报
文档中主要介绍了OpenModelica的操作方法,由简入深,非常有助于初学者学习Modelica。
资源详情
资源评论
资源推荐
OpenModelica Users Guide
Version 2011-04-20
for OpenModelica 1.7
April 2011
Peter Fritzson
Adrian Pop, Martin Sjölund, Per Östlund, Peter Aronsson,
Adeel Asghar, Mikael Axin, Bernhard Bachmann, Vasile Baluta, Robert Braun,
Willi Braun, David Broman, Stefan Brus, Francesco Casella, Filippo Donida,
Jens Frenkel, Pavel Grozman, Daniel Hedberg, Michael Hanke, Alf Isaksson,
Kim Jansson, Daniel Kanth, Tommi Karhela, Juha Kortelainen, Petter Krus,
Alexey Lebedev, Oliver Lenord, Ariel Liebman, Rickard Lindberg, Håkan
Lundvall, Abhi Raj Metkar, Eric Meyers, Maroun Nemer, Hannu Niemistö,
Peter Nordin, Kristoffer Norling, Lennart Ochel, Karl Pettersson, Pavol
Privitzer, Reino Ruusu, Per Sahlin,Wladimir Schamai, Gerhard Schmitz, Anton
Sodja, Ingo Staack, Kristian Stavåker, Sonia Tariq, Mohsen Torabzadeh-Tari,
Parham Vasaiely, Niklas Worschech, Robert Wotzlaw, Björn Zackrisson,
Azam Zia
Copyright by:
Open Source Modelica Consortium
2
Copyright © 1998-CurrentYear, Open Source Modelica Consortium (OSMC), c/o Linköpings universitet,
Department of Computer and Information Science, SE-58183 Linköping, Sweden
All rights reserved.
THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR THIS
OSMC PUBLIC LICENSE (OSMC-PL). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS
PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR
THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License (OSMC-
PL) are obtained from OSMC, either from the above address, from the URLs:
http://www.openmodelica.org or http://www.ida.liu.se/projects/OpenModelica, and in the
OpenModelica distribution. GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET
FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
See the full OSMC Public License conditions for more details.
This document is part of OpenModelica: http://www.openmodelica.org
Contact: OpenModelica@ida.liu.se
Modelica
®
is a registered trademark of the Modelica Association, http://www.Modelica.org
MathModelica
®
is a registered trademark of MathCore Engineering AB, www.mathcore.com
Mathematica
®
is a registered trademark of Wolfram Research Inc, www.wolfram.com
3
Table of Contents
Preface ............................................................................................................................................. 7
Chapter 1 Introduction ....................................................................................................................... 9
1.1 System Overview ................................................................................................................... 10
1.2 Interactive Session with Examples ......................................................................................... 11
1.2.1 Starting the Interactive Session ......................................................................................... 11
1.2.2 Using Compiler Debug Trace Flags in Interactive Mode .................................................. 12
1.2.3 Trying the Bubblesort Function ......................................................................................... 15
1.2.4 Trying the system and cd Commands ................................................................................ 15
1.2.5 Modelica Library and DCMotor Model ............................................................................ 16
1.2.6 The val() function .............................................................................................................. 19
1.2.7 BouncingBall and Switch Models ..................................................................................... 19
1.2.8 Clear All Models ............................................................................................................... 21
1.2.9 VanDerPol Model and Parametric Plot ............................................................................. 21
1.2.10 Using Japanese or Chinese Characters .............................................................................. 22
1.2.11 Scripting with For-Loops, While-Loops, and If-Statements ............................................. 23
1.2.12 Variables, Functions, and Types of Variables ................................................................... 24
1.2.13 Getting Information about Error Cause ............................................................................. 25
1.2.14 Alternative Simulation Output Formats............................................................................. 25
1.2.15 Using External Functions .................................................................................................. 25
1.2.16 Calling the Model Query and Manipulation API .............................................................. 25
1.2.17 Quit OpenModelica ........................................................................................................... 27
1.2.18 Dump XML Representation .............................................................................................. 27
1.2.19 Dump Matlab Representation ............................................................................................ 27
1.3 Summary of Commands for the Interactive Session Handler ................................................ 28
1.4 References .............................................................................................................................. 29
Chapter 2 OMEdit – The OpenModelica Connection Editor ........................................................ 30
2.1 Starting OMEdit ..................................................................................................................... 30
2.1.1 Microsoft Windows ........................................................................................................... 30
2.1.2 Linux ................................................................................................................................. 31
2.1.3 Mac OS X .......................................................................................................................... 31
2.2 Introductory Modeling in OMEdit ......................................................................................... 32
2.2.1 Creating a New File ........................................................................................................... 32
2.2.2 Adding Component Models .............................................................................................. 33
2.2.3 Making Connections .......................................................................................................... 33
2.2.4 Simulating the Model ........................................................................................................ 34
2.2.5 Plotting Variables from Simulated Models ....................................................................... 35
2.3 How to Create User Defined Shapes – Icons ......................................................................... 37
2.4 OMEdit Views ....................................................................................................................... 39
2.4.1 Modeling View .................................................................................................................. 39
2.4.2 Plotting View ..................................................................................................................... 39
2.4.3 Interactive Simulation View .............................................................................................. 39
4
2.5 OMEdit Windows/Tabs ......................................................................................................... 40
2.5.1 Library Window ................................................................................................................ 40
2.5.2 Designer Window .............................................................................................................. 41
2.5.3 Plot Variables Window ...................................................................................................... 41
2.5.4 Messages Window ............................................................................................................. 42
2.5.5 Documentation Window .................................................................................................... 42
2.6 Dialogs ................................................................................................................................... 42
2.6.1 New Model Dialog ............................................................................................................ 43
2.6.2 Simulation Dialog .............................................................................................................. 43
2.6.3 Model Properties Dialog .................................................................................................... 43
2.6.4 Model Attributes Dialog .................................................................................................... 44
2.7 Interactive Simulation in OMEdit .......................................................................................... 45
2.7.1 Invoking Interactive Simulation ........................................................................................ 45
2.7.2 Interactive Simulation View .............................................................................................. 45
Chapter 3 2D Plotting and 3D Animation ....................................................................................... 47
3.1 Enhanced Qt-based 2D Plot Functionality ............................................................................. 47
3.2 Simple 2D Plot ....................................................................................................................... 48
3.2.1 Plot Functions and Their Options ...................................................................................... 51
3.2.2 Zooming ............................................................................................................................ 53
3.2.3 Plotting all variables of a model ........................................................................................ 54
3.2.4 Plotting During Simulation ................................................................................................ 54
3.2.5 Programmable Drawing of 2D Graphics ........................................................................... 55
3.2.6 Plotting of Table Data ....................................................................................................... 56
3.3 Java-based PtPlot 2D plotting ................................................................................................ 57
3.4 3D Animation ......................................................................................................................... 57
3.4.1 Object Based Visualization ............................................................................................... 58
3.4.2 BouncingBall ..................................................................................................................... 58
3.4.3 Pendulum 3D Example ...................................................................................................... 60
3.5 References .............................................................................................................................. 62
Chapter 4 OMNotebook with DrModelica and DrControl ............................................................ 64
4.1 Interactive Notebooks with Literate Programming ................................................................ 64
4.1.1 Mathematica Notebooks .................................................................................................... 64
4.1.2 OMNotebook ..................................................................................................................... 64
4.2 DrModelica Tutoring System – an Application of OMNotebook .......................................... 65
4.3 DrControl Tutorial for Teaching Control Theory .................................................................. 71
4.3.1 Feedback Loop .................................................................................................................. 71
4.3.2 Mathematical Modeling with Characteristic Equations ..................................................... 74
4.4 OpenModelica Notebook Commands .................................................................................... 80
4.4.1 Cells ................................................................................................................................... 80
4.4.2 Cursors ............................................................................................................................... 80
4.4.3 Selection of Text or Cells .................................................................................................. 80
4.4.4 File Menu .......................................................................................................................... 81
4.4.5 Edit Menu .......................................................................................................................... 81
4.4.6 Cell Menu .......................................................................................................................... 82
4.4.7 Format Menu ..................................................................................................................... 83
4.4.8 Insert Menu ........................................................................................................................ 83
4.4.9 Window Menu ................................................................................................................... 83
4.4.10 Help Menu ......................................................................................................................... 83
4.4.11 Additional Features ........................................................................................................... 84
5
4.5 References .............................................................................................................................. 85
Chapter 5 Interactive Simulation ..................................................................................................... 87
5.1 Interactively Changeable Parameters ..................................................................................... 87
5.2 OpenModelica Interactive Components description .............................................................. 88
5.3 Communication Interface ....................................................................................................... 88
5.4 Network configuration Settings ............................................................................................. 89
5.4.1 Operation Messages ........................................................................................................... 89
5.5 Interactive Simulation general Procedure .............................................................................. 90
5.5.1 Initialize an Interactive Simulation Session ...................................................................... 91
5.6 Interactive Simulation Example ............................................................................................. 91
5.6.1 How to get an example Modelica Model ........................................................................... 91
5.6.2 Create the simulation runtime ............................................................................................ 92
5.6.3 Start an interactive Simulation Session ............................................................................. 92
Chapter 6 OMOptim – Optimization with OpenModelica ............................................................ 95
6.1 Introduction ............................................................................................................................ 95
6.2 Preparing the Model ............................................................................................................... 95
6.2.1 Parameters ......................................................................................................................... 95
6.2.2 Constraints ......................................................................................................................... 95
6.2.3 Objectives .......................................................................................................................... 96
6.3 Set problem in OMOptim ...................................................................................................... 96
6.3.1 Launch OMOptim ............................................................................................................. 96
6.3.2 Create a new project .......................................................................................................... 96
6.3.3 Load models ...................................................................................................................... 96
6.3.4 Create a new optimization problem ................................................................................... 97
6.3.5 Select Optimized Variables ............................................................................................... 98
6.3.6 Select objectives ................................................................................................................ 99
6.3.7 Select and configure algorithm .......................................................................................... 99
6.3.8 Launch ............................................................................................................................. 100
6.3.9 Stopping Optimization ..................................................................................................... 100
6.4 Results .................................................................................................................................. 100
6.4.1 Obtaining all Variable Values ......................................................................................... 100
6.5 Window Regions in OMOptim GUI .................................................................................... 101
Chapter 7 MDT – The OpenModelica Development Tooling Eclipse Plugin ............................. 103
7.1 Introduction .......................................................................................................................... 103
7.2 Installation ............................................................................................................................ 103
7.3 Getting Started ..................................................................................................................... 104
7.3.1 Configuring the OpenModelica Compiler ....................................................................... 104
7.3.2 Using the Modelica Perspective ...................................................................................... 104
7.3.3 Selecting a Workspace Folder ......................................................................................... 104
7.3.4 Creating one or more Modelica Projects ......................................................................... 104
7.3.5 Building and Running a Project ....................................................................................... 104
7.3.6 Switching to Another Perspective ................................................................................... 105
7.3.7 Creating a Package .......................................................................................................... 106
7.3.8 Creating a Class ............................................................................................................... 106
7.3.9 Syntax Checking .............................................................................................................. 107
7.3.10 Automatic Indentation Support ....................................................................................... 108
7.3.11 Code Completion ............................................................................................................. 108
7.3.12 Code Assistance on Identifiers when Hovering ............................................................... 109
剩余150页未读,继续阅读
Y一45
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1