| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- #ifndef BUILDFMU
- /* needed for source code export */
- #include "conf.h"
- #endif
- #ifdef FMI_2
- #include "fmiFunctions_.h"
- #include "fmi2Functions_fwd.h"
- /* This file contains wrappers for all FMI functions and is provided in
- the Dymola distribution instead of the actual implementation. This is
- necessary to avoid exposing the latter. */
- DYMOLA_STATIC void __enableResultStoring(fmi2Component c);
- /***************************************************
- Common Functions
- ****************************************************/
- const char* fmi2GetTypesPlatform()
- {
- return fmiGetTypesPlatform_();
- }
- /* ------------------------------------------------------ */
- const char* fmi2GetVersion()
- {
- return fmiGetVersion_();
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetDebugLogging(fmi2Component c, fmi2Boolean loggingOn, size_t nCategories, const fmi2String categories[])
- {
- return fmiSetDebugLogging_(c, loggingOn, nCategories, categories);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetReal(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Real value[])
- {
- return fmiGetReal_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetInteger(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Integer value[])
- {
- return fmiGetInteger_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetBoolean(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2Boolean value[])
- {
- return fmiGetBoolean_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetString(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, fmi2String value[])
- {
- return fmiGetString_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetReal(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Real value[])
- {
- return fmiSetReal_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetInteger(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer value[])
- {
- return fmiSetInteger_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetBoolean(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2Boolean value[])
- {
- return fmiSetBoolean_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetString(fmi2Component c, const fmi2ValueReference vr[], size_t nvr, const fmi2String value[])
- {
- return fmiSetString_(c, vr, nvr, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetFMUstate(fmi2Component c, fmi2FMUstate* FMUstate)
- {
- return fmiGetFMUstate_(c, FMUstate);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetFMUstate(fmi2Component c, fmi2FMUstate FMUstate)
- {
- return fmiSetFMUstate_(c, FMUstate);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2FreeFMUstate(fmi2Component c, fmi2FMUstate* FMUstate)
- {
- return fmiFreeFMUstate_(c, FMUstate);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SerializedFMUstateSize(fmi2Component c, fmi2FMUstate FMUstate, size_t *size)
- {
- return fmiSerializedFMUstateSize_(c, FMUstate, size);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SerializeFMUstate(fmi2Component c, fmi2FMUstate FMUstate, fmi2Byte serializedState[], size_t size)
- {
- return fmiSerializeFMUstate_(c, FMUstate, serializedState, size);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2DeSerializeFMUstate(fmi2Component c, const fmi2Byte serializedState[], size_t size, fmi2FMUstate* FMUstate)
- {
- return fmiDeSerializeFMUstate_(c, serializedState, size, FMUstate);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetDirectionalDerivative(fmi2Component c,
- const fmi2ValueReference z_ref[],
- size_t nz,
- const fmi2ValueReference v_ref[],
- size_t nv,
- const fmi2Real dv[],
- fmi2Real dz[])
- {
- return fmiGetDirectionalDerivative_(c, z_ref, nz, v_ref, nv, dv, dz);
- }
- fmi2Component fmi2Instantiate(fmi2String instanceName,
- fmi2Type fmuType,
- fmi2String fmuGUID,
- fmi2String fmuResourceLocation,
- const fmi2CallbackFunctions* functions,
- fmi2Boolean visible,
- fmi2Boolean loggingOn)
- {
- fmi2Component comp = fmiInstantiate_(instanceName, fmuType, fmuGUID, fmuResourceLocation, functions, visible, loggingOn);
- #ifndef FMU_SOURCE_CODE_EXPORT
- if (comp != NULL) {
- /* determine whether to store results or not */
- #include "dsmodel_fmuconf.h"
- }
- #endif /* FMU_SOURCE_CODE_EXPORT */
- return comp;
- }
- void fmi2FreeInstance(fmi2Component c)
- {
- fmiFreeInstance_(c);
- }
- fmi2Status fmi2SetupExperiment(fmi2Component c,
- fmi2Boolean relativeToleranceDefined,
- fmi2Real relativeTolerance,
- fmi2Real tStart,
- fmi2Boolean tStopDefined,
- fmi2Real tStop)
- {
- return fmiSetupExperiment_(c, relativeToleranceDefined, relativeTolerance, tStart, tStopDefined, tStop);
- }
- fmi2Status fmi2EnterInitializationMode(fmi2Component c)
- {
- return fmiEnterInitializationMode_(c);
- }
- fmi2Status fmi2ExitInitializationMode(fmi2Component c)
- {
- return fmiExitInitializationMode_(c);
- }
- fmi2Status fmi2Terminate(fmi2Component c)
- {
- return fmiTerminate_(c);
- }
- fmi2Status fmi2Reset(fmi2Component c)
- {
- return fmiReset_(c);
- }
- /***************************************************
- Functions for FMI for Model Exchange
- ****************************************************/
- #ifndef FMU_SKIP_MODEL_EXCHANGE
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetTime(fmi2Component c, fmi2Real time)
- {
- return fmiSetTime_(c, time);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetContinuousStates(fmi2Component c, const fmi2Real x[], size_t nx)
- {
- return fmiSetContinuousStates_(c, x, nx);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2EnterEventMode(fmi2Component c)
- {
- return fmiEnterEventMode_(c);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2NewDiscreteStates(fmi2Component c, fmi2EventInfo* eventInfo)
- {
- return fmiNewDiscreteStates_(c, eventInfo);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2EnterContinuousTimeMode(fmi2Component c)
- {
- return fmiEnterContinuousTimeMode_(c);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetNominalsOfContinuousStates(fmi2Component c, fmi2Real x_nominal[], size_t nx)
- {
- return fmiGetNominalsOfContinuousStates_(c, x_nominal, nx);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2CompletedIntegratorStep(fmi2Component c,
- fmi2Boolean noSetFMUStatePriorToCurrentPoint,
- fmi2Boolean* enterEventMode,
- fmi2Boolean* terminateSimulation)
- {
- return fmiCompletedIntegratorStep_(c, noSetFMUStatePriorToCurrentPoint, enterEventMode, terminateSimulation);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetDerivatives(fmi2Component c, fmi2Real derivatives[], size_t nx)
- {
- return fmiGetDerivatives_(c, derivatives, nx);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetEventIndicators(fmi2Component c, fmi2Real eventIndicators[], size_t ni)
- {
- return fmiGetEventIndicators_(c, eventIndicators, ni);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetContinuousStates(fmi2Component c, fmi2Real states[], size_t nx)
- {
- return fmiGetContinuousStates_(c, states, nx);
- }
- #endif /* FMU_SKIP_MODEL_EXCHANGE */
- /***************************************************
- Functions for FMI for Co-Simulation
- ****************************************************/
- #ifndef FMU_SKIP_CO_SIM
- /* ------------------------------------------------------ */
- fmi2Status fmi2SetRealInputDerivatives(fmi2Component c,
- const fmi2ValueReference vr[],
- size_t nvr,
- const fmi2Integer order[],
- const fmi2Real value[])
- {
- return fmiSetRealInputDerivatives_(c, vr, nvr, order, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetRealOutputDerivatives(fmi2Component c,
- const fmi2ValueReference vr[],
- size_t nvr,
- const fmi2Integer order[],
- fmi2Real value[])
- {
- return fmiGetRealOutputDerivatives_(c, vr, nvr, order, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2DoStep(fmi2Component c,
- fmi2Real currentCommunicationPoint,
- fmi2Real communicationStepSize,
- fmi2Boolean noSetFMUStatePriorToCurrentPoint)
- {
- return fmiDoStep_(c, currentCommunicationPoint, communicationStepSize, noSetFMUStatePriorToCurrentPoint);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2CancelStep(fmi2Component c)
- {
- return fmiCancelStep_(c);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetStatus(fmi2Component c, const fmi2StatusKind s, fmi2Status* value)
- {
- return fmiGetStatus_(c, s, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetRealStatus(fmi2Component c, const fmi2StatusKind s, fmi2Real* value)
- {
- return fmiGetRealStatus_(c, s, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetIntegerStatus(fmi2Component c, const fmi2StatusKind s, fmi2Integer* value)
- {
- return fmiGetIntegerStatus_(c, s, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetBooleanStatus(fmi2Component c, const fmi2StatusKind s, fmi2Boolean* value)
- {
- return fmiGetBooleanStatus_(c, s, value);
- }
- /* ------------------------------------------------------ */
- fmi2Status fmi2GetStringStatus(fmi2Component c, const fmi2StatusKind s, fmi2String* value)
- {
- return fmiGetStringStatus_(c, s, value);
- }
- #endif /* FMU_SKIP_CO_SIM */
- #endif /* FMI_2 */
|