public class FMIModelDescription
extends java.lang.Object
A Functional Mock-up Unit file is a .fmu file in zip format that contains a .xml file named "modelDescription.xml". This class is a representation of the elements of that file.
FMI documentation may be found at http://www.modelisar.com/fmi.html.
Red (cxh) |
Red (cxh) |
Modifier and Type | Field and Description |
---|---|
boolean |
canGetAndSetFMUstate
For FMI 2.0 and greater, the XML file may specify that the FMU
supports getting and setting its state.
|
boolean |
canProvideMaxStepSize
For the IBM/UCB proposed extension to FMI 2.0, there is a
capability flag canProvideMaxStepSize that indicates that
the FMU implements the procedure fmiGetMaxStepSize().
|
java.util.List<java.lang.String> |
continuousStates
The list of continuous states.
|
FMICapabilities |
cosimulationCapabilities
The capabilities for co-simulation.
|
java.util.List<java.io.File> |
files
The list of files that were extracted from the .fmu file.
|
java.lang.String |
fmiVersion
The fmiVersion, typically the value of the fmiVersion
attribute from a .fmu file.
|
java.lang.String |
fmuResourceLocation
The absolute path to the resources directory.
|
java.lang.String |
guid
The FMI guid, typically the value of the guid attribute from a
.fmu file.
|
boolean |
modelExchange
If true, then the FMU is intended for model exchange, not
co-simulation.
|
FMICapabilities |
modelExchangeCapabilities
The capabilities for model exchange.
|
java.lang.String |
modelIdentifier
The FMI modelIdentifier, typically the value of the
modelIdentifier attribute from a .fmu file.
|
java.lang.String |
modelName
The FMI modelName, typically the value of the modelName
attribute from a .fmu file.
|
java.util.List<FMIScalarVariable> |
modelVariables
The list of ScalarVariable elements.
|
int |
numberOfContinuousStates
Number of continuous states.
|
int |
numberOfEventIndicators
Number of event indicators.
|
boolean |
qssIntegration
If true, then the FMU is intended for model exchange,
with QSS integrator.
|
java.util.Map<java.lang.String,java.lang.String> |
typeDefinitions
A map from TypeDefinition type name declarations to the
defined type name.
|
Constructor and Description |
---|
FMIModelDescription() |
Modifier and Type | Method and Description |
---|---|
void |
createStateVector()
Create the state vector.
|
void |
dispose()
Unload the native library and free up any Java references
to memory allocated by the allocate memory callback.
|
static java.lang.String |
fmiStatusDescription(int fmiStatus)
Return a string describing the specified fmiStatus.
|
com.sun.jna.Function |
getFmiFunction(java.lang.String functionName)
Get the native function from the native library.
|
FMULibrary.FMUAllocateMemory |
getFMUAllocateMemory()
Return a class that provides a callback function
that allocates memory, but retains a reference
so that the memory does not get gc'd.
|
com.sun.jna.NativeLibrary |
getNativeLibrary()
Get the native library of C functions for the current platform.
|
java.lang.String |
getNativeLibraryPath()
Return the canonical native library path.
|
java.lang.String |
toString()
Return the value of the FMI modelName element.
|
public boolean canGetAndSetFMUstate
public boolean canProvideMaxStepSize
public java.util.List<java.io.File> files
public java.lang.String fmiVersion
public java.lang.String fmuResourceLocation
public java.lang.String guid
public boolean modelExchange
public boolean qssIntegration
public java.lang.String modelIdentifier
public java.lang.String modelName
public java.util.List<FMIScalarVariable> modelVariables
public java.util.List<java.lang.String> continuousStates
public int numberOfContinuousStates
public int numberOfEventIndicators
public java.util.Map<java.lang.String,java.lang.String> typeDefinitions
public FMICapabilities cosimulationCapabilities
public FMICapabilities modelExchangeCapabilities
public void createStateVector()
public void dispose()
public static java.lang.String fmiStatusDescription(int fmiStatus)
fmiStatus
- The status returned by an FMI procedure.public FMULibrary.FMUAllocateMemory getFMUAllocateMemory()
public java.lang.String getNativeLibraryPath() throws java.io.IOException
FMUFile.fmuSharedLibrary(FMIModelDescription)
exists, then it is returned. If it does not exist, then
FMUBuilder.build(File)
is invoked, which may build the shared library.java.io.IOException
- If the FMU file does not contain binaries
for the current platform.public com.sun.jna.Function getFmiFunction(java.lang.String functionName) throws java.lang.UnsatisfiedLinkError, java.io.IOException
A FMI 1.0 FMU will have functions like MyModel_fmiGetReal().
A FMI 2.0 FMU that is shipped with C source code or with a static library, will have functions like MyModel_fmiGetReal().
However, a FMI 2.0 FMU that is shipped with a shared library (and without C source code), will have functions like fmiGetReal().
This method tries both formats. The leading modelIdentifier is tried first because we believe that FMUs should be shipped with source code. If the function name with the leading modelIdentifier is not found, then just the functionName is tried.
functionName
- The name of the function, without a leading underscore.java.lang.UnsatisfiedLinkError
- If the function is not found using either format.java.io.IOException
- If the native library cannot be found.public com.sun.jna.NativeLibrary getNativeLibrary() throws java.io.IOException
FMUBuilder.build(File)
is invoked,
which may build the shared library.java.io.IOException
- If the FMU file does not contain binaries
for the current platform.public java.lang.String toString()
toString
in class java.lang.Object