|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ptolemy.fmi.driver.FMUDriver
public abstract class FMUDriver
Base class to invoke a Functional Mock-up Unit (.fmu) file as either co-simulation or model exchange.
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) |
Field Summary | |
---|---|
(package private) static char |
_csvSeparator
The comma separated value separator. |
(package private) static boolean |
_enableLogging
True if logging is enabled. |
(package private) static double |
_endTime
The end time, in seconds. |
(package private) FMULibrary.FMUAllocateMemory |
_fmuAllocateMemory
Memory allocator callback. |
(package private) static 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) static java.lang.String |
_outputFileName
The output file name. |
(package private) static double |
_stepSize
The step size, in seconds. |
Constructor Summary | |
---|---|
FMUDriver()
|
Method Summary | |
---|---|
protected static void |
_processArgs(java.lang.String[] args)
Process command line arguments for co-simulation or model exchange of Functional Mock-up Unit (.fmu) files. |
protected static void |
_setEnableLogging(boolean enableLogging)
Set the _enableLogging field. |
com.sun.jna.Function |
getFunction(java.lang.String name)
Return a function by name. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static char _csvSeparator
static boolean _enableLogging
static double _endTime
FMULibrary.FMUAllocateMemory _fmuAllocateMemory
static java.lang.String _fmuFileName
java.lang.String _modelIdentifier
com.sun.jna.NativeLibrary _nativeLibrary
static java.lang.String _outputFileName
static double _stepSize
Constructor Detail |
---|
public FMUDriver()
Method Detail |
---|
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(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 static 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 static void _setEnableLogging(boolean enableLogging)
enableLogging
- the value of the enable logging field.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |