diff --git a/BouncingBall/FMI3.xml b/BouncingBall/FMI3.xml index 71a7f315..c9374107 100644 --- a/BouncingBall/FMI3.xml +++ b/BouncingBall/FMI3.xml @@ -1,6 +1,6 @@ @@ -56,8 +56,8 @@ - - + + diff --git a/Clocks/FMI3.xml b/Clocks/FMI3.xml index 63db5139..5bea4467 100644 --- a/Clocks/FMI3.xml +++ b/Clocks/FMI3.xml @@ -1,5 +1,5 @@ - + diff --git a/Dahlquist/FMI3.xml b/Dahlquist/FMI3.xml index e847e5fa..c1157d61 100644 --- a/Dahlquist/FMI3.xml +++ b/Dahlquist/FMI3.xml @@ -1,5 +1,5 @@ - + - + diff --git a/Feedthrough/FMI3.xml b/Feedthrough/FMI3.xml index a07d4200..1a5ab478 100644 --- a/Feedthrough/FMI3.xml +++ b/Feedthrough/FMI3.xml @@ -1,5 +1,5 @@ - + - + - + - + - + - - + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 78cc46aa..644617a5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,5 @@ variables: - fmpy: https://github.com/CATIA-Systems/FMPy/archive/7cd84fda1ba90b0b731d56ecb4ba2d4c5834f582.zip + fmpy: https://github.com/CATIA-Systems/FMPy/archive/3993b05922b6d49a6935c6ddb5575b721eeb85ad.zip conda.packages: python=3.7 dask lark-parser lxml numpy pathlib pip pytest requests scipy jobs: diff --git a/examples/model_exchange.c b/examples/model_exchange.c index fb5d7405..5ca766ac 100644 --- a/examples/model_exchange.c +++ b/examples/model_exchange.c @@ -165,7 +165,7 @@ while (!terminateSimulation) { } // compute derivatives - CHECK_STATUS(M_fmi3GetDerivatives(m, der_x, NX)); + CHECK_STATUS(M_fmi3GetContinuousStateDerivatives(m, der_x, NX)); // advance time h = min(fixedStep, tNext - time); diff --git a/include/fmi3FunctionTypes.h b/include/fmi3FunctionTypes.h index 3587b52f..71030947 100644 --- a/include/fmi3FunctionTypes.h +++ b/include/fmi3FunctionTypes.h @@ -4,11 +4,11 @@ #include "fmi3PlatformTypes.h" /* -This header file defines the data and function types of FMI 3.0-alpha.6. +This header file defines the data and function types of FMI 3.0-beta.1. It must be used when compiling an FMU or an FMI importer. Copyright (C) 2011 MODELISAR consortium, - 2012-2020 Modelica Association Project "FMI" + 2012-2021 Modelica Association Project "FMI" All rights reserved. This file is licensed by the copyright holders under the 2-Clause BSD License @@ -61,12 +61,12 @@ typedef enum { /* tag::DependencyKind[] */ typedef enum { - fmi3Independent = 0, - fmi3Constant = 1, - fmi3Fixed = 2, - fmi3Tunable = 3, - fmi3Discrete = 4, - fmi3Dependent = 5 + fmi3Independent, + fmi3Constant, + fmi3Fixed, + fmi3Tunable, + fmi3Discrete, + fmi3Dependent } fmi3DependencyKind; /* end::DependencyKind[] */ @@ -79,29 +79,29 @@ typedef enum { /* end::IntervalQualifier[] */ /* tag::CallbackLogMessage[] */ -typedef void (*fmi3CallbackLogMessage) (fmi3InstanceEnvironment instanceEnvironment, - fmi3String instanceName, - fmi3Status status, - fmi3String category, - fmi3String message); +typedef void (*fmi3CallbackLogMessage) (fmi3InstanceEnvironment instanceEnvironment, + fmi3String instanceName, + fmi3Status status, + fmi3String category, + fmi3String message); /* end::CallbackLogMessage[] */ /* tag::CallbackIntermediateUpdate[] */ typedef void (*fmi3CallbackIntermediateUpdate) ( fmi3InstanceEnvironment instanceEnvironment, - fmi3Float64 intermediateUpdateTime, - fmi3Boolean clocksTicked, - fmi3Boolean intermediateVariableSetRequested, - fmi3Boolean intermediateVariableGetAllowed, - fmi3Boolean intermediateStepFinished, - fmi3Boolean canReturnEarly, - fmi3Boolean *earlyReturnRequested, - fmi3Float64 *earlyReturnTime); + fmi3Float64 intermediateUpdateTime, + fmi3Boolean clocksTicked, + fmi3Boolean intermediateVariableSetRequested, + fmi3Boolean intermediateVariableGetAllowed, + fmi3Boolean intermediateStepFinished, + fmi3Boolean canReturnEarly, + fmi3Boolean* earlyReturnRequested, + fmi3Float64* earlyReturnTime); /* end::CallbackIntermediateUpdate[] */ /* tag::CallbackPreemptionLock[] */ -typedef void (*fmi3CallbackLockPreemption) (); -typedef void (*fmi3CallbackUnlockPreemption) (); +typedef void (*fmi3CallbackLockPreemption) (); +typedef void (*fmi3CallbackUnlockPreemption) (); /* end::CallbackPreemptionLock[] */ /* Define fmi3 function pointer types to simplify dynamic loading */ @@ -116,10 +116,10 @@ typedef const char* fmi3GetVersionTYPE(void); /* end::GetVersion[] */ /* tag::SetDebugLogging[] */ -typedef fmi3Status fmi3SetDebugLoggingTYPE(fmi3Instance instance, - fmi3Boolean loggingOn, - size_t nCategories, - const fmi3String categories[]); +typedef fmi3Status fmi3SetDebugLoggingTYPE(fmi3Instance instance, + fmi3Boolean loggingOn, + size_t nCategories, + const fmi3String categories[]); /* end::SetDebugLogging[] */ /* Creation and destruction of FMU instances and setting debug status */ @@ -465,63 +465,63 @@ typedef fmi3Status fmi3ExitConfigurationModeTYPE(fmi3Instance instance); typedef fmi3Status fmi3GetIntervalDecimalTYPE(fmi3Instance instance, const fmi3ValueReference valueReferences[], size_t nValueReferences, - fmi3Float64 interval[], - fmi3IntervalQualifier qualifier[], - size_t nValues); + fmi3Float64 intervals[], + fmi3IntervalQualifier qualifiers[], + size_t nIntervals); /* end::GetIntervalDecimal[] */ /* tag::GetIntervalFraction[] */ typedef fmi3Status fmi3GetIntervalFractionTYPE(fmi3Instance instance, const fmi3ValueReference valueReferences[], size_t nValueReferences, - fmi3UInt64 intervalCounter[], - fmi3UInt64 resolution[], - fmi3IntervalQualifier qualifier[], - size_t nValues); + fmi3UInt64 intervalCounters[], + fmi3UInt64 resolutions[], + fmi3IntervalQualifier qualifiers[], + size_t nIntervals); /* end::GetIntervalFraction[] */ /* tag::GetShiftDecimal[] */ typedef fmi3Status fmi3GetShiftDecimalTYPE(fmi3Instance instance, - const fmi3ValueReference valueReferences[], - size_t nValueReferences, - fmi3Float64 shift[], - size_t nValues); + const fmi3ValueReference valueReferences[], + size_t nValueReferences, + fmi3Float64 shifts[], + size_t nShifts); /* end::GetShiftDecimal[] */ /* tag::GetShiftFraction[] */ typedef fmi3Status fmi3GetShiftFractionTYPE(fmi3Instance instance, - const fmi3ValueReference valueReferences[], - size_t nValueReferences, - fmi3UInt64 shiftCounter[], - fmi3UInt64 resolution[], - size_t nValues); + const fmi3ValueReference valueReferences[], + size_t nValueReferences, + fmi3UInt64 shiftCounters[], + fmi3UInt64 resolutions[], + size_t nShifts); /* end::GetShiftFraction[] */ /* tag::SetIntervalDecimal[] */ typedef fmi3Status fmi3SetIntervalDecimalTYPE(fmi3Instance instance, const fmi3ValueReference valueReferences[], size_t nValueReferences, - const fmi3Float64 interval[], - size_t nValues); + const fmi3Float64 intervals[], + size_t nIntervals); /* end::SetIntervalDecimal[] */ /* tag::SetIntervalFraction[] */ typedef fmi3Status fmi3SetIntervalFractionTYPE(fmi3Instance instance, const fmi3ValueReference valueReferences[], size_t nValueReferences, - const fmi3UInt64 intervalCounter[], - const fmi3UInt64 resolution[], - size_t nValues); + const fmi3UInt64 intervalCounters[], + const fmi3UInt64 resolutions[], + size_t nIntervals); /* end::SetIntervalFraction[] */ /* tag::UpdateDiscreteStates[] */ typedef fmi3Status fmi3UpdateDiscreteStatesTYPE(fmi3Instance instance, - fmi3Boolean *discreteStatesNeedUpdate, - fmi3Boolean *terminateSimulation, - fmi3Boolean *nominalsOfContinuousStatesChanged, - fmi3Boolean *valuesOfContinuousStatesChanged, - fmi3Boolean *nextEventTimeDefined, - fmi3Float64 *nextEventTime); + fmi3Boolean* discreteStatesNeedUpdate, + fmi3Boolean* terminateSimulation, + fmi3Boolean* nominalsOfContinuousStatesChanged, + fmi3Boolean* valuesOfContinuousStatesChanged, + fmi3Boolean* nextEventTimeDefined, + fmi3Float64* nextEventTime); /* end::UpdateDiscreteStates[] */ /*************************************************** @@ -534,7 +534,7 @@ typedef fmi3Status fmi3EnterContinuousTimeModeTYPE(fmi3Instance instance); /* tag::CompletedIntegratorStep[] */ typedef fmi3Status fmi3CompletedIntegratorStepTYPE(fmi3Instance instance, - fmi3Boolean noSetFMUStatePriorToCurrentPoint, + fmi3Boolean noSetFMUStatePriorToCurrentPoint, fmi3Boolean* enterEventMode, fmi3Boolean* terminateSimulation); /* end::CompletedIntegratorStep[] */ @@ -552,9 +552,9 @@ typedef fmi3Status fmi3SetContinuousStatesTYPE(fmi3Instance instance, /* Evaluation of the model equations */ /* tag::GetDerivatives[] */ -typedef fmi3Status fmi3GetDerivativesTYPE(fmi3Instance instance, - fmi3Float64 derivatives[], - size_t nContinuousStates); +typedef fmi3Status fmi3GetContinuousStateDerivativesTYPE(fmi3Instance instance, + fmi3Float64 derivatives[], + size_t nContinuousStates); /* end::GetDerivatives[] */ /* tag::GetEventIndicators[] */ diff --git a/include/fmi3Functions.h b/include/fmi3Functions.h index 25dcd34c..3e3aa670 100644 --- a/include/fmi3Functions.h +++ b/include/fmi3Functions.h @@ -2,7 +2,7 @@ #define fmi3Functions_h /* -This header file declares the functions of FMI 3.0-alpha.6. +This header file declares the functions of FMI 3.0-beta.1. It must be used when compiling an FMU. In order to have unique function names even if several FMUs @@ -13,15 +13,15 @@ Therefore, the typical usage is: #define FMI3_FUNCTION_PREFIX MyModel_ #include "fmi3Functions.h" -As a result, a function that is defined as "fmi3GetDerivatives" in this header file, -is actually getting the name "MyModel_fmi3GetDerivatives". +As a result, a function that is defined as "fmi3GetContinuousStateDerivatives" in this header file, +is actually getting the name "MyModel_fmi3GetContinuousStateDerivatives". This only holds if the FMU is shipped in C source code, or is compiled in a static link library. For FMUs compiled in a DLL/sharedObject, the "actual" function names are used and "FMI3_FUNCTION_PREFIX" must not be defined. Copyright (C) 2008-2011 MODELISAR consortium, - 2012-2020 Modelica Association Project "FMI" + 2012-2021 Modelica Association Project "FMI" All rights reserved. This file is licensed by the copyright holders under the 2-Clause BSD License @@ -93,7 +93,7 @@ it may be set to __declspec(dllimport). #endif /* FMI version */ -#define fmi3Version "3.0-alpha.6" +#define fmi3Version "3.0-beta.1" /*************************************************** Common Functions @@ -185,7 +185,7 @@ Functions for Model Exchange #define fmi3SetContinuousStates fmi3FullName(fmi3SetContinuousStates) /* Evaluation of the model equations */ -#define fmi3GetDerivatives fmi3FullName(fmi3GetDerivatives) +#define fmi3GetContinuousStateDerivatives fmi3FullName(fmi3GetContinuousStateDerivatives) #define fmi3GetEventIndicators fmi3FullName(fmi3GetEventIndicators) #define fmi3GetContinuousStates fmi3FullName(fmi3GetContinuousStates) #define fmi3GetNominalsOfContinuousStates fmi3FullName(fmi3GetNominalsOfContinuousStates) @@ -292,7 +292,7 @@ FMI3_Export fmi3SetTimeTYPE fmi3SetTime; FMI3_Export fmi3SetContinuousStatesTYPE fmi3SetContinuousStates; /* Evaluation of the model equations */ -FMI3_Export fmi3GetDerivativesTYPE fmi3GetDerivatives; +FMI3_Export fmi3GetContinuousStateDerivativesTYPE fmi3GetContinuousStateDerivatives; FMI3_Export fmi3GetEventIndicatorsTYPE fmi3GetEventIndicators; FMI3_Export fmi3GetContinuousStatesTYPE fmi3GetContinuousStates; FMI3_Export fmi3GetNominalsOfContinuousStatesTYPE fmi3GetNominalsOfContinuousStates; diff --git a/include/fmi3PlatformTypes.h b/include/fmi3PlatformTypes.h index 213aec89..42547ee5 100644 --- a/include/fmi3PlatformTypes.h +++ b/include/fmi3PlatformTypes.h @@ -2,11 +2,11 @@ #define fmi3PlatformTypes_h /* -This header file defines the data types of FMI 3.0-alpha.6. +This header file defines the data types of FMI 3.0-beta.1. It must be used by both FMU and FMI master. Copyright (C) 2008-2011 MODELISAR consortium, - 2012-2020 Modelica Association Project "FMI" + 2012-2021 Modelica Association Project "FMI" All rights reserved. This file is licensed by the copyright holders under the 2-Clause BSD License @@ -37,20 +37,21 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- */ -/* Include the integer type definitions */ +/* Include the integer and boolean type definitions */ #include +#include /* tag::Component[] */ -typedef void* fmi3Instance; /* Pointer to FMU instance */ +typedef void* fmi3Instance; /* Pointer to the FMU instance */ /* end::Component[] */ /* tag::ComponentEnvironment[] */ -typedef void* fmi3InstanceEnvironment; /* Pointer to FMU environment */ +typedef void* fmi3InstanceEnvironment; /* Pointer to the FMU environment */ /* end::ComponentEnvironment[] */ /* tag::FMUState[] */ -typedef void* fmi3FMUState; /* Pointer to internal FMU state */ +typedef void* fmi3FMUState; /* Pointer to the internal FMU state */ /* end::FMUState[] */ /* tag::ValueReference[] */ @@ -68,7 +69,7 @@ typedef int32_t fmi3Int32; /* 32-bit signed integer */ typedef uint32_t fmi3UInt32; /* 32-bit unsigned integer */ typedef int64_t fmi3Int64; /* 64-bit signed integer */ typedef uint64_t fmi3UInt64; /* 64-bit unsigned integer */ -typedef _Bool fmi3Boolean; /* Data type to be used with fmi3True and fmi3False */ +typedef bool fmi3Boolean; /* Data type to be used with fmi3True and fmi3False */ typedef char fmi3Char; /* Data type for one character */ typedef const fmi3Char* fmi3String; /* Data type for character strings ('\0' terminated, UTF-8 encoded) */ @@ -76,16 +77,16 @@ typedef uint8_t fmi3Byte; /* Smallest addressable unit of the machin (typically one byte) */ typedef const fmi3Byte* fmi3Binary; /* Data type for binary data (out-of-band length terminated) */ -typedef _Bool fmi3Clock; /* Data type to be used with fmi3ClockActive and +typedef bool fmi3Clock; /* Data type to be used with fmi3ClockActive and fmi3ClockInactive */ /* Values for fmi3Boolean */ -#define fmi3True 1 -#define fmi3False 0 +#define fmi3True true +#define fmi3False false /* Values for fmi3Clock */ -#define fmi3ClockActive 1 -#define fmi3ClockInactive 0 +#define fmi3ClockActive true +#define fmi3ClockInactive false /* end::VariableTypes[] */ #endif /* fmi3PlatformTypes_h */ diff --git a/src/fmi3Functions.c b/src/fmi3Functions.c index d24ca33b..020ad5db 100644 --- a/src/fmi3Functions.c +++ b/src/fmi3Functions.c @@ -131,12 +131,12 @@ #define MASK_fmi3SetContinuousStates ContinuousTimeMode /* Evaluation of the model equations */ -#define MASK_fmi3GetDerivatives (InitializationMode | EventMode | ContinuousTimeMode | Terminated) -#define MASK_fmi3GetEventIndicators MASK_fmi3GetDerivatives -#define MASK_fmi3GetContinuousStates MASK_fmi3GetDerivatives -#define MASK_fmi3GetNominalsOfContinuousStates MASK_fmi3GetDerivatives -#define MASK_fmi3GetNumberOfEventIndicators MASK_fmi3GetDerivatives -#define MASK_fmi3GetNumberOfContinuousStates MASK_fmi3GetDerivatives +#define MASK_fmi3GetContinuousStateDerivatives (InitializationMode | EventMode | ContinuousTimeMode | Terminated) +#define MASK_fmi3GetEventIndicators MASK_fmi3GetContinuousStateDerivatives +#define MASK_fmi3GetContinuousStates MASK_fmi3GetContinuousStateDerivatives +#define MASK_fmi3GetNominalsOfContinuousStates MASK_fmi3GetContinuousStateDerivatives +#define MASK_fmi3GetNumberOfEventIndicators MASK_fmi3GetContinuousStateDerivatives +#define MASK_fmi3GetNumberOfContinuousStates MASK_fmi3GetContinuousStateDerivatives /* Functions for Co-Simulation */ @@ -991,14 +991,14 @@ fmi3Status fmi3SetContinuousStates(fmi3Instance instance, const fmi3Float64 x[], } /* Evaluation of the model equations */ -fmi3Status fmi3GetDerivatives(fmi3Instance instance, fmi3Float64 derivatives[], size_t nContinuousStates) { +fmi3Status fmi3GetContinuousStateDerivatives(fmi3Instance instance, fmi3Float64 derivatives[], size_t nContinuousStates) { - ASSERT_STATE(GetDerivatives) + ASSERT_STATE(GetContinuousStateDerivatives) - if (invalidNumber(S, "fmi3GetDerivatives", "nContinuousStates", nContinuousStates, NX)) + if (invalidNumber(S, "fmi3GetContinuousStateDerivatives", "nContinuousStates", nContinuousStates, NX)) return fmi3Error; - if (nullPointer(S, "fmi3GetDerivatives", "derivatives[]", derivatives)) + if (nullPointer(S, "fmi3GetContinuousStateDerivatives", "derivatives[]", derivatives)) return fmi3Error; getDerivatives(S, derivatives, nContinuousStates);