--- /dev/null
+#ifndef fmiFunctions_h\r
+#define fmiFunctions_h\r
+\r
+/* This header file must be utilized when compiling a FMU.\r
+ It defines all functions of Co-Simulation Interface.\r
+ In order to have unique function names even if several FMUs\r
+ are compiled together (e.g. for embedded systems), every "real" function name\r
+ is constructed by prepending the function name by\r
+ "MODEL_IDENTIFIER" + "_" where "MODEL_IDENTIFIER" is the short name\r
+ of the model used as the name of the zip-file where the model is stored.\r
+ Therefore, the typical usage is:\r
+\r
+ #define MODEL_IDENTIFIER MyModel\r
+ #include "fmiFunctions.h"\r
+\r
+ As a result, a function that is defined as "fmiGetDerivatives" in this header file,\r
+ is actually getting the name "MyModel_fmiGetDerivatives".\r
+\r
+ Revisions:\r
+ - November 4, 2010: Adapted to specification text:\r
+ o fmiGetModelTypesPlatform renamed to fmiGetTypesPlatform\r
+ o fmiInstantiateSlave: Argument GUID replaced by fmuGUID\r
+ Argument mimetype replaced by mimeType\r
+ o tabs replaced by spaces\r
+ - October 16, 2010: First public Version\r
+\r
+\r
+ Copyright © 2008-2010, MODELISAR consortium. All rights reserved.\r
+ This file is licensed by the copyright holders under the BSD License\r
+ (http://www.opensource.org/licenses/bsd-license.html):\r
+\r
+ ----------------------------------------------------------------------------\r
+ Redistribution and use in source and binary forms, with or without\r
+ modification, are permitted provided that the following conditions are met:\r
+\r
+ - Redistributions of source code must retain the above copyright notice,\r
+ this list of conditions and the following disclaimer.\r
+ - Redistributions in binary form must reproduce the above copyright notice,\r
+ this list of conditions and the following disclaimer in the documentation\r
+ and/or other materials provided with the distribution.\r
+ - Neither the name of the copyright holders nor the names of its\r
+ contributors may be used to endorse or promote products derived\r
+ from this software without specific prior written permission.\r
+\r
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\r
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ ----------------------------------------------------------------------------\r
+*/\r
+\r
+#include "fmiPlatformTypes.h"\r
+#include <stdlib.h>\r
+\r
+/* Export fmi functions on Windows */\r
+#ifdef _MSC_VER\r
+#define DllExport __declspec( dllexport )\r
+#else\r
+#define DllExport\r
+#endif\r
+\r
+/* Macros to construct the real function name\r
+ (prepend function name by MODEL_IDENTIFIER + "_") */\r
+\r
+#define fmiPaste(a,b) a ## b\r
+#define fmiPasteB(a,b) fmiPaste(a,b)\r
+#define fmiFullName(name) fmiPasteB(MODEL_IDENTIFIER, name)\r
+\r
+/***************************************************\r
+Common Functions\r
+****************************************************/\r
+#define fmiGetTypesPlatform fmiFullName(_fmiGetTypesPlatform)\r
+#define fmiGetVersion fmiFullName(_fmiGetVersion)\r
+#define fmiSetDebugLogging fmiFullName(_fmiSetDebugLogging)\r
+\r
+/*Data Exchange*/\r
+#define fmiSetReal fmiFullName(_fmiSetReal)\r
+#define fmiSetInteger fmiFullName(_fmiSetInteger)\r
+#define fmiSetBoolean fmiFullName(_fmiSetBoolean)\r
+#define fmiSetString fmiFullName(_fmiSetString)\r
+\r
+#define fmiGetReal fmiFullName(_fmiGetReal)\r
+#define fmiGetInteger fmiFullName(_fmiGetInteger)\r
+#define fmiGetBoolean fmiFullName(_fmiGetBoolean)\r
+#define fmiGetString fmiFullName(_fmiGetString)\r
+\r
+/***************************************************\r
+Functions for FMI for Co-Simulation\r
+****************************************************/\r
+#define fmiInstantiateSlave fmiFullName(_fmiInstantiateSlave)\r
+#define fmiInitializeSlave fmiFullName(_fmiInitializeSlave)\r
+#define fmiTerminateSlave fmiFullName(_fmiTerminateSlave)\r
+#define fmiResetSlave fmiFullName(_fmiResetSlave)\r
+#define fmiFreeSlaveInstance fmiFullName(_fmiFreeSlaveInstance)\r
+#define fmiSetRealInputDerivatives fmiFullName(_fmiSetRealInputDerivatives)\r
+#define fmiGetRealOutputDerivatives fmiFullName(_fmiGetRealOutputDerivatives)\r
+#define fmiDoStep fmiFullName(_fmiDoStep)\r
+#define fmiCancelStep fmiFullName(_fmiCancelStep)\r
+#define fmiGetStatus fmiFullName(_fmiGetStatus)\r
+#define fmiGetRealStatus fmiFullName(_fmiGetRealStatus)\r
+#define fmiGetIntegerStatus fmiFullName(_fmiGetIntegerStatus)\r
+#define fmiGetBooleanStatus fmiFullName(_fmiGetBooleanStatus)\r
+#define fmiGetStringStatus fmiFullName(_fmiGetStringStatus)\r
+\r
+/* Version number */\r
+#define fmiVersion "1.0"\r
+\r
+/* make sure all compiler use the same alignment policies for structures */\r
+#ifdef WIN32\r
+#pragma pack(push,8)\r
+#endif\r
+\r
+\r
+/* Type definitions */\r
+ typedef enum {fmiOK,\r
+ fmiWarning,\r
+ fmiDiscard,\r
+ fmiError,\r
+ fmiFatal,\r
+ fmiPending} fmiStatus;\r
+\r
+ typedef void (*fmiCallbackLogger) (fmiComponent c, fmiString instanceName, fmiStatus status,\r
+ fmiString category, fmiString message, ...);\r
+ typedef void* (*fmiCallbackAllocateMemory)(size_t nobj, size_t size);\r
+ typedef void (*fmiCallbackFreeMemory) (void* obj);\r
+ typedef void (*fmiStepFinished) (fmiComponent c, fmiStatus status);\r
+\r
+ typedef struct {\r
+ fmiCallbackLogger logger;\r
+ fmiCallbackAllocateMemory allocateMemory;\r
+ fmiCallbackFreeMemory freeMemory;\r
+ fmiStepFinished stepFinished;\r
+ } fmiCallbackFunctions;\r
+\r
+ typedef struct {\r
+ fmiBoolean iterationConverged;\r
+ fmiBoolean stateValueReferencesChanged;\r
+ fmiBoolean stateValuesChanged;\r
+ fmiBoolean terminateSimulation;\r
+ fmiBoolean upcomingTimeEvent;\r
+ fmiReal nextEventTime;\r
+ } fmiEventInfo;\r
+\r
+/* reset alignment policy to the one set before reading this file */\r
+#ifdef WIN32\r
+#pragma pack(pop)\r
+#endif\r
+\r
+/***************************************************\r
+Common Functions\r
+****************************************************/\r
+\r
+/* Inquire version numbers of header files */\r
+ DllExport const char* fmiGetTypesPlatform();\r
+ DllExport const char* fmiGetVersion();\r
+\r
+ DllExport fmiStatus fmiSetDebugLogging (fmiComponent c, fmiBoolean loggingOn);\r
+\r
+/* Data Exchange Functions*/\r
+ DllExport fmiStatus fmiGetReal (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiReal value[]);\r
+ DllExport fmiStatus fmiGetInteger(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiInteger value[]);\r
+ DllExport fmiStatus fmiGetBoolean(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiBoolean value[]);\r
+ DllExport fmiStatus fmiGetString (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiString value[]);\r
+\r
+ DllExport fmiStatus fmiSetReal (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal value[]);\r
+ DllExport fmiStatus fmiSetInteger (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiInteger value[]);\r
+ DllExport fmiStatus fmiSetBoolean (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiBoolean value[]);\r
+ DllExport fmiStatus fmiSetString (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiString value[]);\r
+\r
+/***************************************************\r
+Functions for FMI for Co-Simulation\r
+****************************************************/\r
+\r
+/* Creation and destruction of slave instances and setting debug status */\r
+ DllExport fmiComponent fmiInstantiateSlave(fmiString instanceName,\r
+ fmiString fmuGUID,\r
+ fmiString fmuLocation,\r
+ fmiString mimeType,\r
+ fmiReal timeout,\r
+ fmiBoolean visible,\r
+ fmiBoolean interactive,\r
+ fmiCallbackFunctions functions,\r
+ fmiBoolean loggingOn);\r
+\r
+ DllExport fmiStatus fmiInitializeSlave(fmiComponent c,\r
+ fmiReal tStart,\r
+ fmiBoolean StopTimeDefined,\r
+ fmiReal tStop);\r
+\r
+ DllExport fmiStatus fmiTerminateSlave (fmiComponent c);\r
+ DllExport fmiStatus fmiResetSlave (fmiComponent c);\r
+ DllExport void fmiFreeSlaveInstance(fmiComponent c);\r
+\r
+ DllExport fmiStatus fmiSetRealInputDerivatives(fmiComponent c,\r
+ const fmiValueReference vr[],\r
+ size_t nvr,\r
+ const fmiInteger order[],\r
+ const fmiReal value[]);\r
+\r
+ DllExport fmiStatus fmiGetRealOutputDerivatives(fmiComponent c,\r
+ const fmiValueReference vr[],\r
+ size_t nvr,\r
+ const fmiInteger order[],\r
+ fmiReal value[]);\r
+\r
+ DllExport fmiStatus fmiCancelStep(fmiComponent c);\r
+ DllExport fmiStatus fmiDoStep (fmiComponent c,\r
+ fmiReal currentCommunicationPoint,\r
+ fmiReal communicationStepSize,\r
+ fmiBoolean newStep);\r
+\r
+\r
+ typedef enum {fmiDoStepStatus,\r
+ fmiPendingStatus,\r
+ fmiLastSuccessfulTime} fmiStatusKind;\r
+\r
+ DllExport fmiStatus fmiGetStatus (fmiComponent c, const fmiStatusKind s, fmiStatus* value);\r
+ DllExport fmiStatus fmiGetRealStatus (fmiComponent c, const fmiStatusKind s, fmiReal* value);\r
+ DllExport fmiStatus fmiGetIntegerStatus(fmiComponent c, const fmiStatusKind s, fmiInteger* value);\r
+ DllExport fmiStatus fmiGetBooleanStatus(fmiComponent c, const fmiStatusKind s, fmiBoolean* value);\r
+ DllExport fmiStatus fmiGetStringStatus (fmiComponent c, const fmiStatusKind s, fmiString* value);\r
+\r
+\r
+#endif // fmiFunctions_h\r