Skip navigation links

Package org.ptolemy.fmi

A Java interface to Functional Mock-up Interface (FMI) files.

See: Description

Package org.ptolemy.fmi Description

A Java interface to Functional Mock-up Interface (FMI) files.

A Functional Mock-up Unit (FMU) is a file that contains functionality that may be invoked either via co-simulation or model exchange. Typically, a FMU file has a .fmu extension. A FMU file is a zip file that contains a file named modelDescription.xml and one or more platform-dependent shared libraries.

The org.ptolemy.fmi package and subpackages are a BSD-licensed interface between Java and FMI.

FMI documentation may be found at http://www.modelisar.com/fmi.html.

Code

Below is a description of the packages

org.ptolemy.fmi - Read .fmu files and provide access to the data contained in the modelDescription.xml file of the .fmu file

FMICallbackFunctions.java
Functional Mock-up Interface (FMI) callback functions needed by Java Native Access (JNA) so that a FMU * can perform functions like allocating and freeing memory, printing log messages and handle the end of a step.
FMIEventInfo.java
Functional Mock-up Interface (FMI) event information.

The C language interface to Functional Mock-up Unit (FMU) files includes an structure that represents event information. This class represents that structure.

FMILibrary.java
A Java Native Acess (JNA) Wrapper for a Functional Mock-up Unit shared library.
FMIModelDescription.java
An object that represents the fmiModelDescription element of a modelDescription.xml file contained within a Functional Mock-up Unit (FMU) file.
FMIScalarVariable.java
An object that represents the ScalarVariable element of a modelDescription.xml file contained within a Functional Mock-up Interface .fmu XML file.
FMUFile.java
Parse a Functional Mock-up Interface (FMI) 1.0 Functional Mock-up Unit (FMU) file and create a FMIModelDescription for later use. The parseFMUFile() method in this class is the primary entry point into this package.
FMULibrary.java
An interface that is used by Java Native Access (JNA) to handle callbacks.

This class contains implementations of methods that are registered with the FMI and then called back from by the FMI. The callback methods allocate and free memory, handle logging and are sometimes called when the step ends. For each callback we define an inner class that implements the appropriate interface and has one method that provides the body of the callback.

FMULog.java
A Functional Mock-up Interface (FMI) log method implementation.
NativeSizeT.java
A Java representation for a C type size_t, which is 32 or 64 bits.

org.ptolemy.fmi.type - Data types that are passed to and from a FMU.

FMIBooleanType.java
An Functional Mock-up Interface type that represents a Boolean.
FMIIntegerType.java
An Functional Mock-up Interface type that represents an Integer.
FMIRealType.java
An Functional Mock-up Interface type that represents a Real.
FMIStringType.java
An Functional Mock-up Interface type that represents a String.
FMIType.java
The base type of all of the other FMI types.

org.ptolemy.fmi.driver - Simple drivers for co-simulation and model exchange

The org.ptolemy.fmi.drivers package is based on FMUSDK 1.0.2 from http://www.qtronic.de/en/fmusdk.html, which has has a BSD-style license.

The code in org.ptolemy.fmi does not depend on the org.ptolemy.fmi.drivers package and thus the code in org.ptolemy.fmi is not encumbered by this license.

In FMI-1.0, co-simulation fmu files contain a modelDescription.xml file that has an <Implementation> element. Model exchange fmu files do not have this element.

FMUCoSimulation.java
A simple example that reads a co-simulation .fmu file and performs co-simulation.
FMUDriver.java
The base clase for the co-simulation and model exchange drivers.
FMUModelExchange.java
A simple example that reads a model exchagen .fmu file and performs model exchange.
OutputRow.java
Given a fmu component, output the current state.

These drivers are based on code found in FMUSDK 1.0.2. These drivers are simple examples that do not read inputs and contain other common functionality that would be used by a real system.

JUnit tests - tests

To run the tests, do:

        cd org/ptolemy/fmu
        ant test
      

Sample .fmu files may be found in fmu/cs and fmu/me. for the following architectures: darwin64, linux32, linux64, win32 and win64. These files were generated using a port of the FMUSDK which may be found at http://github.com/cxbrooks/fmusdk.

Sponsors

This package was developed under a Department of Energy Contract for the Building Controls Virtual Test Bed (BCVTB) see http://simulationresearch.lbl.gov/bcvtb.

Additional support was provided by Ptolemy II, which is supported by the following organizations: The Center for Hybrid and Embedded Software Systems (CHESS) at UC Berkeley, which receives support from the National Science Foundation (NSF awards #0720882 (CSR-EHS: PRET), #1035672 (CPS: PTIDES), and #0931843 (ActionWebs)), the U. S. Army Research Laboratory (ARL #W911NF-11-2-0038), the Air Force Research Lab (AFRL), the Multiscale Systems Center (MuSyC), one of six research centers funded under the Focus Center Research Program, a Semiconductor Research Corporation program, and the following companies: Bosch, National Instruments, Thales, and Toyota.

Authors

The org.ptolemy.fmi package has the following authors.
David Broman (UC Berkeley)
Christopher Brooks (UC Berkeley)
Edward A. Lee (UC Berkeley)
Thierry Stephane Nouidui (Lawrence Berkeley National Laboratory)
Michael Wetter (Lawrence Berkeley National Laboratory)

The org.ptolemy.fmi.drivers package is based on FMUSDK 1.0.2 from http://www.qtronic.de/en/fmusdk.html.

Support

This package is delivered without support. However, the BCVTB mailing list at https://groups.google.com/group/bcvtb maybe be used for questions.

Since:
Ptolemy II 8.1
Skip navigation links