Skip to content

Commit

Permalink
Rename fmi3TypesPlatform.h to fmi3PlatformTypes.h (#594)
Browse files Browse the repository at this point in the history
to align with fmi3FunctionTypes.h
  • Loading branch information
t-sommer authored Jul 20, 2019
1 parent 2eb1cd9 commit 198ede0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions docs/2_1_common_api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ An FMU might temporarily change the floating point control word and get notified
Three header files are provided that define the interface of an FMU.
In all header files the convention is used that all C function and type definitions start with the prefix "[underline]#fmi3#":

`fmi3TypesPlatform.h`::
`fmi3PlatformTypes.h`::
contains the type definitions of the input and output arguments of the functions.
This header file must
be used both by the FMU and by the target simulator.
Expand All @@ -44,7 +44,7 @@ _[Example for a definition in this header file: +
contains the function prototypes of an FMU that can be accessed in simulation environments and that are defined in <<fmi-common-concepts>>, <<fmi-for-model-exchange>> and
<<fmi-for-co-simulation>>.

This header file includes `fmi3TypesPlatform.h` and `fmi3FunctionTypes.h`.
This header file includes `fmi3PlatformTypes.h` and `fmi3FunctionTypes.h`.
The header file version number for which the model was compiled, can be inquired in the target simulator with `fmi3GetVersion` (see <<inquire-platform-and-version-number>>). +
_[Example for a definition in this header file_ footnote:[For Microsoft and Cygwin compilers; `FMI3_Export` is defined as `pass:[__]declspec(dllexport)` and for Gnu-Compilers `FMI3_Export` is defined as `pass:[__]attribute__ ( ( visibility("default") ) )` in order to export the name for dynamic loading.
Otherwise it is an empty definition.]: +
Expand Down Expand Up @@ -97,40 +97,40 @@ Basically, this means that it should be short.
For example, the Windows API only supports full path-names of a file up to 260 characters (see: http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx).


==== Platform Dependent Definitions (fmi3TypesPlatform.h)
==== Platform Dependent Definitions (fmi3PlatformTypes.h)

To simplify porting, no C types are used in the function interfaces, but the alias types are defined in this section.
All definitions in this section are provided in the header file `fmi3TypesPlatform.h`.
All definitions in this section are provided in the header file `fmi3PlatformTypes.h`.
It is required to use this definition for all binary FMUs.
_[Only for source code FMUs, a change might be useful in some cases.]_:

[source, C]
----
include::../headers/fmi3TypesPlatform.h[tags=Component]
include::../headers/fmi3PlatformTypes.h[tags=Component]
----

This is a pointer to an FMU specific data structure that contains the information needed to process the model equations or to process the co-simulation of the respective slave.
This data structure is implemented by the environment that provides the FMU; in other words, the calling environment does not know its content, and the code to process it must be provided by the FMU generation environment and must be shipped with the FMU.

[source, C]
----
include::../headers/fmi3TypesPlatform.h[tags=ComponentEnvironment]
include::../headers/fmi3PlatformTypes.h[tags=ComponentEnvironment]
----

This is a pointer to a data structure in the simulation environment that calls the FMU.
Using this pointer, data from the `modelDescription.xml` file _[for example, mapping of `valueReference`pass:[s] to variable names]_ can be transferred between the simulation environment and the `logMessage` function (see <<creation-destruction-and-logging>>).

[source, C]
----
include::../headers/fmi3TypesPlatform.h[tags=FMUState]
include::../headers/fmi3PlatformTypes.h[tags=FMUState]
----

This is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.
This allows to restart a simulation from a previous FMU state (see <<get-set-fmu-state>>).

[source, C]
----
include::../headers/fmi3TypesPlatform.h[tags=ValueReference]
include::../headers/fmi3PlatformTypes.h[tags=ValueReference]
----

This is a handle to a (base type) variable value of the model.
Expand All @@ -146,13 +146,13 @@ If a function in the following sections is called with a wrong `fmi3ValueReferen

[source, C]
----
include::../headers/fmi3TypesPlatform.h[tags=VariableTypes]
include::../headers/fmi3PlatformTypes.h[tags=VariableTypes]
----

These are the basic data types used in the interfaces of the C functions.
More data types might be included in future versions of the interface.
In order to keep flexibility, especially for embedded systems or for high performance computers, the exact data types or the word length of a number are not standardized.
Instead, the precise definition (in other words, the header file `fmi3TypesPlatform.h`) is provided by the environment where the FMU shall be used.
Instead, the precise definition (in other words, the header file `fmi3PlatformTypes.h`) is provided by the environment where the FMU shall be used.
In most cases, the definition above will be used.
If the target environment has different definitions and the FMU is distributed in binary format, it must be newly compiled and linked with this target header file.

Expand Down
6 changes: 3 additions & 3 deletions docs/2_3_fmu_distribution.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ documentation // directory containing the documentation (optiona
<other documentation files>
sources // directory containing the C sources (optional)
// all needed C sources and C header files to compile and link the FMU
// with exception of: fmi3TypesPlatform.h, fmi3FunctionTypes.h and fmi3Functions.h
// with exception of: fmi3PlatformTypes.h, fmi3FunctionTypes.h and fmi3Functions.h
// The files to be compiled (but not the files included from these files)
// have to be reported in the XML file under the structure
// <ModelExchange><SourceFiles> ... and <CoSimulation><SourceFiles>
Expand Down Expand Up @@ -212,9 +212,9 @@ The actual file names in the ZIP file to access the data files can either be har
_[Note that the absolute file name of the resource directory is provided by the initialization functions]_.
In the case of a co-simulation implementation of `needsExecutionTool = "true"` type, the `resources` directory can contain the model file in the tool specific file format.

_[Note that the header files `fmi3TypesPlatform.h` and `fmi3FunctionTypes.h/fmi3Functions.h` are not included in the FMU due to the following reasons:_
_[Note that the header files `fmi3PlatformTypes.h` and `fmi3FunctionTypes.h/fmi3Functions.h` are not included in the FMU due to the following reasons:_

_pass:[]`fmi3TypesPlatform.h` makes no sense in the `sources` directory, because if sources are provided, then the target simulator defines this header file and not the FMU. +
_pass:[]`fmi3PlatformTypes.h` makes no sense in the `sources` directory, because if sources are provided, then the target simulator defines this header file and not the FMU. +
This header file is not included in the `binaries` directory, because it is implicitly defined by the platform directory (for example, i686-windows for a 32-bit machine or x86_64-linux for a 64-bit machine)._

_pass:[]`fmi3FunctionTypes.h` / `fmi3Functions.h` are not needed in the `sources` directory, because they are implicitly defined by attribute `fmiVersion` in file `modelDescription.xml`.
Expand Down
2 changes: 1 addition & 1 deletion headers/fmi3FunctionTypes.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef fmi3FunctionTypes_h
#define fmi3FunctionTypes_h

#include "fmi3TypesPlatform.h"
#include "fmi3PlatformTypes.h"

/*
This header file must be utilized when compiling an FMU or an FMI master.
Expand Down
2 changes: 1 addition & 1 deletion headers/fmi3Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" {
#endif

#include "fmi3TypesPlatform.h"
#include "fmi3PlatformTypes.h"
#include "fmi3FunctionTypes.h"
#include <stdlib.h>

Expand Down
6 changes: 3 additions & 3 deletions headers/fmi3TypesPlatform.h → headers/fmi3PlatformTypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef fmi3TypesPlatform_h
#define fmi3TypesPlatform_h
#ifndef fmi3PlatformTypes_h
#define fmi3PlatformTypes_h

/*
Standard header file to define the argument types of the
Expand Down Expand Up @@ -84,4 +84,4 @@ typedef const fmi3Byte* fmi3Binary; /* Data type for binary data
#define fmi3False 0
/* end::VariableTypes[] */

#endif /* fmi3TypesPlatform_h */
#endif /* fmi3PlatformTypes_h */

0 comments on commit 198ede0

Please sign in to comment.