Skip to content

Commit

Permalink
Added FMUSDK2.0.1 files from Qtronic
Browse files Browse the repository at this point in the history
  • Loading branch information
cxbrooks committed May 31, 2014
1 parent 1bdd7ed commit cef175e
Show file tree
Hide file tree
Showing 135 changed files with 20,248 additions and 0 deletions.
57 changes: 57 additions & 0 deletions bin/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
7-Zip
~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7-Zip Copyright (C) 1999-2007 Igor Pavlov.

Licenses for files are:

1) 7z.dll: GNU LGPL + unRAR restriction
2) All other files: GNU LGPL

The GNU LGPL + unRAR restriction means that you must follow both
GNU LGPL rules and unRAR restriction rules.


Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.


GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


unRAR restriction
-----------------

The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.

The license for original unRAR code has the following restriction:

The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.


--
Igor Pavlov
255 changes: 255 additions & 0 deletions doc/FmuSdk_reference.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
<html>
<head>
<title>Documentation for FMU SDK 2.0.1</title>
<style type="text/css">
html { font-family: Verdana, Arial, Helvetica, sans-serif; }
h1,h2,h3 { color: #000066; }
</style>
</head>
<body>
<h1>FMU SDK 2.0.1</h1>
The FMU SDK is a free software development kit provided by
<a href="http://www.qtronic.de" target="_blank">QTronic</a>.
The FMU SDK demonstrates basic use of Functional Mockup Units (FMUs)
as defined by the following specifications
<ul>
<li>Functional Mock-up Interface for <a href=
"https://svn.modelica.org/fmi/branches/public/specifications/FMI_for_ModelExchange_and_CoSimulation_v2.0_RC1.pdf"
target="_blank">Model Exchange and Co-Simulation 2.0 RC1</a> (October 18, 2013)</li>
<li>Functional Mock-up Interface for <a href=
"https://svn.modelica.org/fmi/branches/public/specifications/FMI_for_ModelExchange_v1.0.pdf"
target="_blank">Model Exchange 1.0</a> (January 26, 2010)</li>
<li>Functional Mock-up Interface for <a href=
"https://svn.modelica.org/fmi/branches/public/specifications/FMI_for_CoSimulation_v1.0.pdf"
target="_blank">Co-Simulation 1.0</a> (October 12, 2010)</li>
</ul>
The FMI specifications are available from
<a href="https://fmi-standard.org/downloads" target="_blank">here</a>.
A short overview on FMUs and the FMI specification can be found
<a href="http://www.qtronic.de/doc/fmi_overview.pdf" taget="_blank">here</a>.
The FMU SDK can also serve as starting point for developing applications
that create or process FMUs.
<p>
For each of the supported FMI versions (currently 1.0 and 2.0 RC1),
the FMU SDK contains the C sources for various discrete and continuous
FMU models, a batch file for compiling and zip'ing these models,
an XML parser for parsing the model description of an FMU and two simple
simulation programs that run a given FMU and output the result as CSV file.
<p>
The FMU SDK can be downloaded from
<a href="http://www.qtronic.de/doc/fmusdk.zip">
http://www.qtronic.de/doc/fmusdk.zip</a>.
For bug reports, questions or comments regarding the FMU SDK, please
mail to <a href="mailto:fmu@qtronic.de">fmu@qtronic.de</a>.
Questions or comments regarding the FMU specification should be sent to
<a href="mailto:info@functional-mockup-interface.org">info@functional-mockup-interface.org</a>.
<img src="fmus.jpg">

<hr />

<h2>Table of Contents</h2>
<ul>
<li><a href="#installation">Building and Installing the FMU SDK</a></li>
<li><a href="#simulation">Simulating an FMU</a></li>
<li><a href="#creating_fmus">Creating your own FMUs</a></li>
<li><a href="#revisions">FMU SDK Revision history</a></li>
<li><a href="#license">License conditions</a></li>
</ul>

<hr />
<h2><a name="installation">Installing the FMU SDK</a></h2>
The FMU SDK runs on all 32 bit and 64 bit Windows platforms, starting from Windows XP.
Downwload the FMU SDK from <a href="http://www.qtronic.de/doc/fmusdk.zip">here</a>,
and unzip the file in a directory where you have write access.
That directory is called FMUSDK_HOME below and may contain white space, such as in "C:\Program Files\fmusdk".
The FMU SDK contains only the C sources of the FMUs and the simulators, not the executables,
and should compile on all Windows platforms.
<p/>
To build 32 bit versions of all FMUs and simulators of the FMU SDK,
double click on FMUSDK_HOME\install.bat.
This should create fmus in FMUSDK_HOME\fmu10\fmu and FMUSDK_HOME\fmu20\fmu, as well as four
simulators in FMUSDK_HOME\bin.
<p/>
To build 64 bit versions of all FMUs and simulators, open a command shell an run "install -win64".
This creates additional fmus in the x64 subdirectories in FMUSDK_HOME\fmu10\fmu and FMUSDK_HOME\fmu20\fmu, as well
as additional simulators in FMUSDK_HOME\bin\x64. Building these 64 bit versions works also on 32 bit
Windows platforms. Execution of the 64 bit simulators and fmus requires however a 64 bit version of Windows.
<p/>
Compilation using install.bat requires that you have installed one of
Microsoft Visual Studio 2005 (VS8), 2008 (VS9), 2010 (VS10), or 2012 (VS11),
for example the free Express Edition.
To compile with another compiler, adapt the batch files.

<hr />
<h2><a name="simulation">Simulating an FMU</a></h2>
To run a given FMU with one of the FMU simulators, open a command shell in
directory FMUSDK_HOME and run the command fmusim
<pre>
fmusim simulator model.fmu [tEnd [h [loggingOn [csvSeparator]]]] [-win64]
simulator ..... cs10 or cs20 for co-simulation, me10 or me20 for model exchange, required
model.fmu ..... path to FMU, relative to current dir or absolute, required
tEnd .......... end time of simulation, optional, defaults to 1.0 sec
h ............. step size of simulation, optional, defaults to 0.1 sec
loggingOn ..... 1 to activate logging, optional, defaults to 0
csvSeparator .. c for comma, s for semicolon, optional, defaults to c
-win64 ........ to use a 64 bit simulator. By default, the 32 bit version is used
</pre>
This unzips the given FMU, parses the contained modelDescription.xml file, simulates
the FMU from t=0 to t=tEnd, and writes the solution to file 'result.csv'. The file
is written in CSV format (comma-separated values), using ';' to separate columns and
using ',' instead of '.' as decimal dot to print floating-point numbers.
To change the result file format, use the 'csv separator' option.
The logging option activates logging of the simulated FMU. The FMI specification does
not specify, what exactly to log in this case. However, when logging is switched on,
the sample FMUs of the FMU SDK log every single FMU function call. Moreover, the
fmusim simulators log every step and every event that is detected.
<p/>
Example command:
<pre>
&gt; fmusim me10 fmu10/fmu/me/bouncingBall.fmu 5 0.1 0 s
FMU Simulator: run 'fmu/bouncingBall.fmu' from t=0..5 with step size h=0.1, loggingOn=0, csv separator=';'
Simulation from 0 to 5 terminated successful
steps ............ 51
fixed step size .. 0.1
time events ...... 0
state events ..... 14
step events ...... 0
CSV file 'result.csv' written
</pre>
To plot the result file, open it e.g. in a spread-sheet program, such as Miscrosoft Excel or OpenOffice Calc.
The figure below shows the result of the above simulation when plotted using OpenOffice Calc 3.0.
Note that the height h of the bouncing ball as computed by fmusim becomes negative at the contact points,
while the true solution of the FMU does actually not contain negative height values.
This is not a limitation of the FMU, but of fmusim_me, which does not attempt to locate the
exact time of state events.
To improve this, either reduce the step size or add your own procedure for state-event location to fmusim_me.
<p/>
<img src="bouncingBallCalc.png">

<hr />
<h2><a name="creating_fmus">Creating your own FMUs</a></h2>
The FMU SDK contains a few sample FMUs
<ul>
<li><a href="../fmu20/src/models/dq/_main.html">dq</a> the Dahlquist test function x = -k der(x)</li>
<li><a href="../fmu20/src/models/inc/_main.html">inc</a> increments an integer counter every second</li>
<li><a href="../fmu20/src/models/values/_main.html">values</a> demonstrates the use of all scalar FMU data types</li>
<li><a href="../fmu20/src/models/vanDerPol/_main.html">vanDerPol</a> ODE with 2 continuous states</li>
<li><a href="../fmu20/src/models/bouncingBall/_main.html">bouncingBall</a> a bouncing ball that defines state events</li>
</ul>
To implement your own FMU using the FMU SDK, create a directory - say xy - in FMUSDK_HOME\fmu10\src\models,
or FMUSDK_HOME\fmu20\src\models, and create files xy.c there.
The name of the new directory and of the .c file must be the same.
The content of the .c file should follow the existing FMU examples, see the comments in the example code.
For FMI 1.0, add also file modelDescription.xml.
The XML file must not contain the <code>&lt;implementation&gt;</code>
element and the closing <code>&lt/fmiModelDescription&gt;</code> tag, because this is added automatically during build.
For FMI 2.0, add file modelDescription_cs.xml and modelDescription_cs.xml.
When done with editing xy.c and the xml file (or files), open a command shell in FMUSDK_HOME\fmu10\src\models
or in FMUSDK_HOME\fmu20\src\models and run the
command <code>build_fmu me xy</code> to build an FMU for model-exchange, or
<code>build_fmu cs xy</code> to build an FMU for co-simulation.
This should create a 32 bit FMU file xy.fmu in the corresponding subdirectory of FMUSDK_HOME\fmu10 or FMUSDK_HOME\fmu20
To build a 64-bit FMU, append option -win64 to the build command.
<p/>
The figure below might help to create or process the XML file modelDescription.xml.
It shows all XML elements (without attributes) used in the schema files (XSD) for
model exchange and co-simulation 1.0. Notation: UML class diagram.
<img src="fmu10-xml-schema.png">
<br/>
For the case of FMU 2.0, see the corresponding overview figure in the FMI specification 2.0 RC1.
<hr />

<h2><a name="revisions">FMU SDK Revision history</a></h2>
<ul>
<li>07.02.2010, Version 1.0
<ul>
<li>First release</li>
<li>demo FMI for Model Exchange 1.0</li>
</ul>
</li>
<li>05.03.2010, Version 1.0.1
<ul>
<li>demo FMI for Model Exchange 1.0</li>
<li>bug-fix in fmuTemplate.c: fmiSetString now copies the passed
string argument and fmiFreeModelInstance frees all string copies
</li>
<li>fmusim/main.c: removed strerror(GetLastError()) from error messages
</li>
</ul>
</li>
<li>22.08.2011, Version 1.0.2
<ul>
<li>demo FMI for Model Exchange 1.0 and FMI for Co-Simulation 1.0</li>
<li>added support for FMI for Co-Simulation 1.0 (standalone, no tool coupling)</li>
<li>bug-fix in fmusim/main.c: added missing calls to fmiTerminate and fmiFreeModelInstance</li>
</ul>
</li>
<li>07.03.2014, Version 2.0.0
<ul>
<li>demo FMI for versions 1.0 and 2.0 RC1</li>
<li>added support for FMI 2.0 RC1</li>
<li>added 64 bit support</li>
<li>more compilers recognized by the installer</li>
</ul>
</li>
<li>16.04.2014, Version 2.0.1
<ul>
<li>bug fix in modelDescription.xml files: remove alias parameter, add derivative attribute to suitable variables</li>
<li>bug fix in fmu20/fmuTemplate.c: allow modules to request termination of simulation, better time event
handling, initialize() moved from fmiEnterInitialization to fmiExitInitialization, correct logging message
format in fmiDoStep</li>
<li>bug fix in Co-Simulation and Model Exchange simulators: set fmu location for 1.0 and fmu resources location
for 2.0 at instantiation of model</li>
</ul>
</li>
</ul>

<h2><a name="license">License conditions</a></h2>
The FMU SDK is provided by QTronic under the
<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
<hr/>
<pre>
FMU SDK license

Copyright © 2008-2014, QTronic GmbH. All rights reserved.
The FmuSdk is licensed by the copyright holder under the BSD License
(http://www.opensource.org/licenses/bsd-license.html):
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY QTRONIC GMBH "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL QTRONIC GMBH BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</pre>
<hr/>

The following additional tools are distributed with the FMU SDK under their
respective licenses
<ul>
<li><a href="http://www.7-zip.org" target="_blank">7z 4.57</a>
by Igor Pavlov. Used here to zip and unzip FMUs,
license is <a href="../bin/license.txt">here</a>.</li>
<li><a href="http://sourceforge.net/projects/expat/" target="_blank">eXpat 2.0.1</a>
by James Clark. Used here to parse the modelDescription.xml file of an FMU 1.0,
license is <a href="../fmu10/src/shared/COPYING.txt">here</a>.</li>
<li><a href="http://xmlsoft.org" target="_blank">libxml</a>,
the XML C parser and toolkit of Gnome.
Used here to parse the modelDescription.xml file of an FMU 2.0,
license is <a href="../fmu20/src/shared/parser/libxml_license.txt">here</a>.</li>
</ul>
<hr />

</body>
</html>
Binary file added doc/bouncingBallCalc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fmu10-xml-schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fmus.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions doc/fmusdk_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

FMU SDK license

Copyright � 2008-2014, QTronic GmbH. All rights reserved.
The FmuSdk is licensed by the copyright holder under the BSD License
(http://www.opensource.org/licenses/bsd-license.html):
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY QTRONIC GMBH "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL QTRONIC GMBH BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 changes: 27 additions & 0 deletions fmu10/src/build_all.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@echo off

rem ------------------------------------------------------------
rem This batch builds both simulators and all FMUs of the FmuSDK
rem Copyright QTronic GmbH. All rights reserved
rem ------------------------------------------------------------

rem First argument %1 should be empty for win32, and '-win64' for win64 build.
call build_fmusim_me %1
call build_fmusim_cs %1
echo -----------------------------------------------------------
echo Making the FMUs of the FmuSDK ...
pushd models

call build_fmu me dq %1
call build_fmu me inc %1
call build_fmu me values %1
call build_fmu me vanDerPol %1
call build_fmu me bouncingBall %1

call build_fmu cs dq %1
call build_fmu cs inc %1
call build_fmu cs values %1
call build_fmu cs vanDerPol %1
call build_fmu cs bouncingBall %1

popd
Loading

0 comments on commit cef175e

Please sign in to comment.