Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
fmi2FunctionTypes.h
Go to the documentation of this file.
1#ifndef fmi2FunctionTypes_h
2#define fmi2FunctionTypes_h
3
4#include "fmi2TypesPlatform.h"
5
6/* This header file must be utilized when compiling an FMU or an FMI master.
7 It declares data and function types for FMI 2.0.1
8
9 Revisions:
10 - Sep. 30, 2019: License changed to 2-clause BSD License (without extensions)
11 - Jul. 5, 2019: Remove const modifier from fields of fmi2CallbackFunctions (#216)
12 - Sep. 6, 2018: Parameter names added to function prototypes
13 - Apr. 9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
14 - Apr. 3, 2014: Added #include <stddef.h> for size_t definition
15 - Mar. 27, 2014: Added #include "fmiTypesPlatform.h" (#179)
16 - Mar. 26, 2014: Introduced function argument "void" for the functions (#171)
17 fmiGetTypesPlatformTYPE and fmiGetVersionTYPE
18 - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
19 fmiInstantiateModelTYPE , fmiInstantiateSlaveTYPE -> fmiInstantiateTYPE
20 fmiFreeModelInstanceTYPE, fmiFreeSlaveInstanceTYPE -> fmiFreeInstanceTYPE
21 fmiEnterModelInitializationModeTYPE, fmiEnterSlaveInitializationModeTYPE -> fmiEnterInitializationModeTYPE
22 fmiExitModelInitializationModeTYPE , fmiExitSlaveInitializationModeTYPE -> fmiExitInitializationModeTYPE
23 fmiTerminateModelTYPE , fmiTerminateSlaveTYPE -> fmiTerminate
24 fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
25 Functions renamed
26 fmiUpdateDiscreteStatesTYPE -> fmiNewDiscreteStatesTYPE
27 Renamed elements of the enumeration fmiEventInfo
28 upcomingTimeEvent -> nextEventTimeDefined // due to generic naming scheme: varDefined + var
29 newUpdateDiscreteStatesNeeded -> newDiscreteStatesNeeded;
30 - June 13, 2013: Changed type fmiEventInfo
31 Functions removed:
32 fmiInitializeModelTYPE
33 fmiEventUpdateTYPE
34 fmiCompletedEventIterationTYPE
35 fmiInitializeSlaveTYPE
36 Functions added:
37 fmiEnterModelInitializationModeTYPE
38 fmiExitModelInitializationModeTYPE
39 fmiEnterEventModeTYPE
40 fmiUpdateDiscreteStatesTYPE
41 fmiEnterContinuousTimeModeTYPE
42 fmiEnterSlaveInitializationModeTYPE;
43 fmiExitSlaveInitializationModeTYPE;
44 - Feb. 17, 2013: Added third argument to fmiCompletedIntegratorStepTYPE
45 Changed function name "fmiTerminateType" to "fmiTerminateModelType" (due to #113)
46 Changed function name "fmiGetNominalContinuousStateTYPE" to
47 "fmiGetNominalsOfContinuousStatesTYPE"
48 Removed fmiGetStateValueReferencesTYPE.
49 - Nov. 14, 2011: First public Version
50
51
52 Copyright (C) 2008-2011 MODELISAR consortium,
53 2012-2019 Modelica Association Project "FMI"
54 All rights reserved.
55
56 This file is licensed by the copyright holders under the 2-Clause BSD License
57 (https://opensource.org/licenses/BSD-2-Clause):
58
59 ----------------------------------------------------------------------------
60 Redistribution and use in source and binary forms, with or without
61 modification, are permitted provided that the following conditions are met:
62
63 - Redistributions of source code must retain the above copyright notice,
64 this list of conditions and the following disclaimer.
65
66 - Redistributions in binary form must reproduce the above copyright notice,
67 this list of conditions and the following disclaimer in the documentation
68 and/or other materials provided with the distribution.
69
70 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
72 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
73 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
74 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
75 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
76 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
77 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
78 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
79 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
80 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81 ----------------------------------------------------------------------------
82*/
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87
88/* make sure all compiler use the same alignment policies for structures */
89#if defined _MSC_VER || defined __GNUC__
90#pragma pack(push,8)
91#endif
92
93/* Include stddef.h, in order that size_t etc. is defined */
94#include <stddef.h>
95
96
97/* Type definitions */
106
111
118
119typedef void (*fmi2CallbackLogger) (fmi2ComponentEnvironment componentEnvironment,
120 fmi2String instanceName,
121 fmi2Status status,
122 fmi2String category,
123 fmi2String message,
124 ...);
125typedef void* (*fmi2CallbackAllocateMemory)(size_t nobj, size_t size);
126typedef void (*fmi2CallbackFreeMemory) (void* obj);
127typedef void (*fmi2StepFinished) (fmi2ComponentEnvironment componentEnvironment,
128 fmi2Status status);
129
137
146
147
148/* reset alignment policy to the one set before reading this file */
149#if defined _MSC_VER || defined __GNUC__
150#pragma pack(pop)
151#endif
152
153
154/* Define fmi2 function pointer types to simplify dynamic loading */
155
156/***************************************************
157Types for Common Functions
158****************************************************/
159
160/* Inquire version numbers of header files and setting logging status */
161 typedef const char* fmi2GetTypesPlatformTYPE(void);
162 typedef const char* fmi2GetVersionTYPE(void);
164 fmi2Boolean loggingOn,
165 size_t nCategories,
166 const fmi2String categories[]);
167
168/* Creation and destruction of FMU instances and setting debug status */
170 fmi2Type fmuType,
171 fmi2String fmuGUID,
172 fmi2String fmuResourceLocation,
173 const fmi2CallbackFunctions* functions,
174 fmi2Boolean visible,
175 fmi2Boolean loggingOn);
177
178/* Enter and exit initialization mode, terminate and reset */
180 fmi2Boolean toleranceDefined,
181 fmi2Real tolerance,
182 fmi2Real startTime,
183 fmi2Boolean stopTimeDefined,
184 fmi2Real stopTime);
189
190/* Getting and setting variable values */
191 typedef fmi2Status fmi2GetRealTYPE (fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Real value[]);
192 typedef fmi2Status fmi2GetIntegerTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Integer value[]);
193 typedef fmi2Status fmi2GetBooleanTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Boolean value[]);
194 typedef fmi2Status fmi2GetStringTYPE (fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2String value[]);
195
196 typedef fmi2Status fmi2SetRealTYPE (fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Real value[]);
197 typedef fmi2Status fmi2SetIntegerTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer value[]);
198 typedef fmi2Status fmi2SetBooleanTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Boolean value[]);
199 typedef fmi2Status fmi2SetStringTYPE (fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2String value[]);
200
201/* Getting and setting the internal FMU state */
207 typedef fmi2Status fmi2DeSerializeFMUstateTYPE (fmi2Component c, const fmi2Byte serializedState[], size_t size, fmi2FMUstate* FMUstate);
208
209/* Getting partial derivatives */
211 const fmi2ValueReference vUnknown_ref[], size_t nUnknown,
212 const fmi2ValueReference vKnown_ref[], size_t nKnown,
213 const fmi2Real dvKnown[],
214 fmi2Real dvUnknown[]);
215
216/***************************************************
217Types for Functions for FMI2 for Model Exchange
218****************************************************/
219
220/* Enter and exit the different modes */
225 fmi2Boolean noSetFMUStatePriorToCurrentPoint,
226 fmi2Boolean* enterEventMode,
227 fmi2Boolean* terminateSimulation);
228
229/* Providing independent variables and re-initialization of caching */
232
233/* Evaluation of the model equations */
234 typedef fmi2Status fmi2GetDerivativesTYPE (fmi2Component c, fmi2Real derivatives[], size_t nx);
235 typedef fmi2Status fmi2GetEventIndicatorsTYPE (fmi2Component c, fmi2Real eventIndicators[], size_t ni);
238
239
240/***************************************************
241Types for Functions for FMI2 for Co-Simulation
242****************************************************/
243
244/* Simulating the slave */
246 const fmi2ValueReference vr[], size_t nvr,
247 const fmi2Integer order[],
248 const fmi2Real value[]);
250 const fmi2ValueReference vr[], size_t nvr,
251 const fmi2Integer order[],
252 fmi2Real value[]);
254 fmi2Real currentCommunicationPoint,
255 fmi2Real communicationStepSize,
256 fmi2Boolean noSetFMUStatePriorToCurrentPoint);
258
259/* Inquire slave status */
265
266
267#ifdef __cplusplus
268} /* end of extern "C" { */
269#endif
270
271#endif /* fmi2FunctionTypes_h */
fmi2Status fmi2SetDebugLoggingTYPE(fmi2Component c, fmi2Boolean loggingOn, size_t nCategories, const fmi2String categories[])
fmi2Status fmi2TerminateTYPE(fmi2Component c)
fmi2Status fmi2SerializeFMUstateTYPE(fmi2Component c, fmi2FMUstate FMUstate, fmi2Byte[], size_t size)
fmi2Status fmi2CancelStepTYPE(fmi2Component c)
fmi2Status fmi2ResetTYPE(fmi2Component c)
void fmi2FreeInstanceTYPE(fmi2Component c)
@ fmi2ModelExchange
@ fmi2CoSimulation
fmi2Status fmi2SetContinuousStatesTYPE(fmi2Component c, const fmi2Real x[], size_t nx)
void(* fmi2StepFinished)(fmi2ComponentEnvironment componentEnvironment, fmi2Status status)
fmi2Status fmi2GetRealOutputDerivativesTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer order[], fmi2Real value[])
const char * fmi2GetTypesPlatformTYPE(void)
fmi2Status fmi2SetFMUstateTYPE(fmi2Component c, fmi2FMUstate FMUstate)
fmi2Status fmi2FreeFMUstateTYPE(fmi2Component c, fmi2FMUstate *FMUstate)
fmi2Status fmi2SetRealInputDerivativesTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer order[], const fmi2Real value[])
fmi2Status fmi2GetBooleanStatusTYPE(fmi2Component c, const fmi2StatusKind s, fmi2Boolean *value)
fmi2Status fmi2DeSerializeFMUstateTYPE(fmi2Component c, const fmi2Byte serializedState[], size_t size, fmi2FMUstate *FMUstate)
fmi2Status fmi2SerializedFMUstateSizeTYPE(fmi2Component c, fmi2FMUstate FMUstate, size_t *size)
fmi2Status fmi2EnterInitializationModeTYPE(fmi2Component c)
fmi2Status fmi2ExitInitializationModeTYPE(fmi2Component c)
fmi2Component fmi2InstantiateTYPE(fmi2String instanceName, fmi2Type fmuType, fmi2String fmuGUID, fmi2String fmuResourceLocation, const fmi2CallbackFunctions *functions, fmi2Boolean visible, fmi2Boolean loggingOn)
fmi2Status fmi2EnterContinuousTimeModeTYPE(fmi2Component c)
fmi2Status fmi2GetStatusTYPE(fmi2Component c, const fmi2StatusKind s, fmi2Status *value)
const char * fmi2GetVersionTYPE(void)
void *(* fmi2CallbackAllocateMemory)(size_t nobj, size_t size)
fmi2Status fmi2GetBooleanTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Boolean value[])
fmi2Status fmi2SetStringTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2String value[])
fmi2Status fmi2GetContinuousStatesTYPE(fmi2Component c, fmi2Real x[], size_t nx)
fmi2Status fmi2SetTimeTYPE(fmi2Component c, fmi2Real time)
void(* fmi2CallbackLogger)(fmi2ComponentEnvironment componentEnvironment, fmi2String instanceName, fmi2Status status, fmi2String category, fmi2String message,...)
@ fmi2Fatal
@ fmi2OK
@ fmi2Pending
@ fmi2Error
@ fmi2Discard
@ fmi2Warning
fmi2Status fmi2GetFMUstateTYPE(fmi2Component c, fmi2FMUstate *FMUstate)
fmi2Status fmi2GetStringStatusTYPE(fmi2Component c, const fmi2StatusKind s, fmi2String *value)
fmi2Status fmi2DoStepTYPE(fmi2Component c, fmi2Real currentCommunicationPoint, fmi2Real communicationStepSize, fmi2Boolean noSetFMUStatePriorToCurrentPoint)
fmi2Status fmi2SetRealTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Real value[])
fmi2Status fmi2GetIntegerTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Integer value[])
fmi2Status fmi2GetNominalsOfContinuousStatesTYPE(fmi2Component c, fmi2Real x_nominal[], size_t nx)
fmi2Status fmi2GetDerivativesTYPE(fmi2Component c, fmi2Real derivatives[], size_t nx)
fmi2Status fmi2GetDirectionalDerivativeTYPE(fmi2Component c, const fmi2ValueReference vUnknown_ref[], size_t nUnknown, const fmi2ValueReference vKnown_ref[], size_t nKnown, const fmi2Real dvKnown[], fmi2Real dvUnknown[])
fmi2Status fmi2NewDiscreteStatesTYPE(fmi2Component c, fmi2EventInfo *fmi2eventInfo)
void(* fmi2CallbackFreeMemory)(void *obj)
fmi2Status fmi2GetStringTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2String value[])
fmi2Status fmi2SetBooleanTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Boolean value[])
fmi2StatusKind
@ fmi2Terminated
@ fmi2DoStepStatus
@ fmi2LastSuccessfulTime
@ fmi2PendingStatus
fmi2Status fmi2SetupExperimentTYPE(fmi2Component c, fmi2Boolean toleranceDefined, fmi2Real tolerance, fmi2Real startTime, fmi2Boolean stopTimeDefined, fmi2Real stopTime)
fmi2Status fmi2SetIntegerTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer value[])
fmi2Status fmi2GetIntegerStatusTYPE(fmi2Component c, const fmi2StatusKind s, fmi2Integer *value)
fmi2Status fmi2GetRealTYPE(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Real value[])
fmi2Status fmi2CompletedIntegratorStepTYPE(fmi2Component c, fmi2Boolean noSetFMUStatePriorToCurrentPoint, fmi2Boolean *enterEventMode, fmi2Boolean *terminateSimulation)
fmi2Status fmi2GetEventIndicatorsTYPE(fmi2Component c, fmi2Real eventIndicators[], size_t ni)
fmi2Status fmi2GetRealStatusTYPE(fmi2Component c, const fmi2StatusKind s, fmi2Real *value)
fmi2Status fmi2EnterEventModeTYPE(fmi2Component c)
int fmi2Integer
void * fmi2ComponentEnvironment
void * fmi2FMUstate
double fmi2Real
unsigned int fmi2ValueReference
char fmi2Byte
void * fmi2Component
int fmi2Boolean
const fmi2Char * fmi2String
fmi2CallbackAllocateMemory allocateMemory
fmi2CallbackLogger logger
fmi2CallbackFreeMemory freeMemory
fmi2ComponentEnvironment componentEnvironment
fmi2StepFinished stepFinished
fmi2Boolean newDiscreteStatesNeeded
fmi2Boolean nominalsOfContinuousStatesChanged
fmi2Boolean valuesOfContinuousStatesChanged
fmi2Boolean terminateSimulation
fmi2Boolean nextEventTimeDefined