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.
Modifier and Type | Class and Description |
---|---|
static class |
FMIModelDescription.ContinuousState
A data structure representing a continuous state of the FMU.
|
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<FMI20ContinuousStateDerivative> |
continuousStateDerivatives
The list of state derivatives.
|
java.util.List<java.lang.String> |
continuousStateNames
The list of continuous states names.
|
java.util.List<FMIModelDescription.ContinuousState> |
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 |
handleIntegerTime
For the IBM/UCB proposed extension to FMI 2.0, there is a capability flag
handleIntegerTime that indicates that the time inside the FMU is
represented with an integer m (precision) and an integer p (a counter)
representing time as multiples of m.
|
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.
|
java.util.List<java.lang.String> |
modelVariablesNames
The list of ScalarVariable elements name.
|
int |
numberOfContinuousStates
Number of continuous states.
|
int |
numberOfEventIndicators
Number of event indicators.
|
java.util.List<FMI20Output> |
outputs
The list of output variables.
|
java.lang.Integer |
precision
For the IBM/UCB proposed extension to FMI 2.0, there is a capability flag
handleIntegerTime that indicates that the time inside the FMU is
represented with an integer m (precision) and an integer p (a counter)
representing time as multiples of m.
|
boolean |
providesDirectionalDerivative
For FMI 2.0 and greater, the XML file may specify that the FMU supports
providing directional derivatives state.
|
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 |
addDefaultInputDependencies()
Add direct dependency to each output variables from all input variables.
|
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.
|
void |
parseDependenciese(org.w3c.dom.Node node)
Parse the ModelStructure to catch the I/O direct dependencies.
|
java.lang.String |
toString()
Return the value of the FMI modelName element.
|
public boolean canGetAndSetFMUstate
public boolean canProvideMaxStepSize
public boolean handleIntegerTime
public java.lang.Integer precision
public boolean providesDirectionalDerivative
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 java.lang.String modelIdentifier
public java.lang.String modelName
public java.util.List<FMIScalarVariable> modelVariables
public java.util.List<java.lang.String> modelVariablesNames
public java.util.List<FMIModelDescription.ContinuousState> continuousStates
public java.util.List<java.lang.String> continuousStateNames
public java.util.List<FMI20ContinuousStateDerivative> continuousStateDerivatives
public java.util.List<FMI20Output> outputs
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() throws java.io.IOException
java.io.IOException
- If the size of the continuousStateDerivatives
is not equal to the number of reals.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
public void parseDependenciese(org.w3c.dom.Node node)
node
- The node to be parsed.public void addDefaultInputDependencies()