public abstract class FMUDriver
extends java.lang.Object
Derived classes should implement the simulate(...) method and create a static main(String args) method that invokes _processArgs(args) and them simulate(...).
Red (cxh) |
Red (cxh) |
Modifier and Type | Field and Description |
---|---|
(package private) char |
_csvSeparator
The comma separated value separator.
|
(package private) boolean |
_enableLogging
True if logging is enabled.
|
(package private) double |
_endTime
The end time, in seconds.
|
(package private) double |
_fmiVersion
The version number of the FMI standard.
|
(package private) java.lang.String |
_fmuFileName
The name of the .fmu file.
|
(package private) java.lang.String |
_modelIdentifier
The modelIdentifier from modelDescription.xml.
|
(package private) com.sun.jna.NativeLibrary |
_nativeLibrary
The NativeLibrary that contains the functions.
|
(package private) java.lang.String |
_outputFileName
The output file name.
|
(package private) double |
_stepSize
The step size, in seconds.
|
Constructor and Description |
---|
FMUDriver() |
Modifier and Type | Method and Description |
---|---|
protected void |
_processArgs(java.lang.String[] args)
Process command line arguments for co-simulation or model exchange of
Functional Mock-up Unit (.fmu) files.
|
protected void |
_setEnableLogging(boolean enableLogging)
Set the _enableLogging field.
|
com.sun.jna.Function |
getFunction(java.lang.String name)
Deprecated.
Call FMIModelDescription.getFmiFunction() instead.
|
void |
invoke(FMIModelDescription fmiModelDescription,
java.lang.String name,
java.lang.Object[] arguments,
java.lang.String message)
Invoke a function that returns an integer representing the
FMIStatus return value.
|
void |
invoke(com.sun.jna.Function function,
java.lang.Object[] arguments,
java.lang.String message)
Invoke a function that returns an integer representing the
FMIStatus return value.
|
void |
invoke(java.lang.String name,
java.lang.Object[] arguments,
java.lang.String message)
Invoke a function that returns an integer representing the
FMIStatus return value.
|
abstract void |
simulate(java.lang.String fmuFileName,
double endTime,
double stepSize,
boolean enableLogging,
char csvSeparator,
java.lang.String outputFileName)
Perform co-simulation or model exchange using the named
Functional Mock-up Unit (FMU) file.
|
char _csvSeparator
boolean _enableLogging
double _endTime
double _fmiVersion
java.lang.String _fmuFileName
java.lang.String _modelIdentifier
com.sun.jna.NativeLibrary _nativeLibrary
java.lang.String _outputFileName
double _stepSize
@Deprecated public com.sun.jna.Function getFunction(java.lang.String name)
name
- The name of the function. The value of the
modelIdentifier is prepended to the value of this parameter to
yield the function name.public void invoke(FMIModelDescription fmiModelDescription, java.lang.String name, java.lang.Object[] arguments, java.lang.String message) throws java.lang.UnsatisfiedLinkError, java.io.IOException
fmiModelDescription
- The FMIModelDescription used to
look up the function by name.name
- The name of the function.arguments
- The arguments to be passed to the function.message
- The error message to be used if there is a problem.
The message should end with ": " because the return value
of the function will be printed after the error message.java.lang.UnsatisfiedLinkError
- If the function is not found using either format.java.io.IOException
- If the native library cannot be found.public void invoke(java.lang.String name, java.lang.Object[] arguments, java.lang.String message)
name
- The name of the function.arguments
- The arguments to be passed to the function.message
- The error message to be used if there is a problem.
The message should end with ": " because the return value
of the function will be printed after the error message.public void invoke(com.sun.jna.Function function, java.lang.Object[] arguments, java.lang.String message)
function
- The function to be invoked.arguments
- The arguments to be passed to the function.message
- The error message to be used if there is a problem.
The message should end with ": " because the return value
of the function will be printed after the error message.public abstract void simulate(java.lang.String fmuFileName, double endTime, double stepSize, boolean enableLogging, char csvSeparator, java.lang.String outputFileName) throws java.lang.Exception
Derived classes should implement this method.
fmuFileName
- The pathname of the co-simulation .fmu fileendTime
- The ending time in seconds.stepSize
- The step size in seconds.enableLogging
- True if logging is enabled.csvSeparator
- The character used for separating fields.
Note that sometimes the decimal point in floats is converted to ','.outputFileName
- The output file.java.lang.Exception
- If there is a problem parsing the .fmu file or invoking
the methods in the shared library.protected void _processArgs(java.lang.String[] args) throws java.lang.Exception
The command line arguments have the following meaning:
The format of the arguments is based on the fmusim command from the fmusdk by QTronic Gmbh.
args
- The arguments: file.fmu [endTime] [stepTime]
[loggingOn] [csvSeparator] [outputFile]java.lang.Exception
- If there is a problem parsing the .fmu file or invoking
the methods in the shared library.protected void _setEnableLogging(boolean enableLogging)
enableLogging
- the value of the enable logging field.