Skip to content

Commit

Permalink
Update API to FMI 3.0-beta.1 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sommer authored Apr 18, 2021
1 parent a44212b commit 09cb993
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 102 deletions.
6 changes: 3 additions & 3 deletions BouncingBall/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription
fmiVersion="3.0-alpha.6"
fmiVersion="3.0-beta.1"
modelName="BouncingBall"
description="This model calculates the trajectory, over time, of a ball dropped from a height of 1 m."
instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f003}">
Expand Down Expand Up @@ -56,8 +56,8 @@
<ModelStructure>
<Output valueReference="1"/>
<Output valueReference="3"/>
<StateDerivative valueReference="2"/>
<StateDerivative valueReference="4"/>
<ContinuousStateDerivative valueReference="2"/>
<ContinuousStateDerivative valueReference="4"/>
<InitialUnknown valueReference="2" dependencies="3" dependenciesKind="constant"/>
<InitialUnknown valueReference="4" dependencies="5" dependenciesKind="constant"/>
<EventIndicator valueReference="1"/>
Expand Down
2 changes: 1 addition & 1 deletion Clocks/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="Clocks" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="Clocks" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">
<ScheduledExecution modelIdentifier="Clocks"/>
<LogCategories>
<Category name="logEvents" description="Log events"/>
Expand Down
4 changes: 2 additions & 2 deletions Dahlquist/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="Dahlquist" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="Dahlquist" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">

<ModelExchange
modelIdentifier="Dahlquist"
Expand Down Expand Up @@ -30,7 +30,7 @@

<ModelStructure>
<Output valueReference="0"/>
<StateDerivative valueReference="1"/>
<ContinuousStateDerivative valueReference="1"/>
<InitialUnknown valueReference="1"/>
</ModelStructure>

Expand Down
2 changes: 1 addition & 1 deletion Feedthrough/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="Feedthrough" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f004}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="Feedthrough" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f004}">

<ModelExchange
modelIdentifier="Feedthrough"
Expand Down
2 changes: 1 addition & 1 deletion LinearTransform/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="LinearTransform" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="LinearTransform" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f000}">

<ModelExchange
modelIdentifier="LinearTransform"
Expand Down
2 changes: 1 addition & 1 deletion Resource/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="Resource" instantiationToken="{7b9c2114-2ce5-4076-a138-2cbc69e069e5}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="Resource" instantiationToken="{7b9c2114-2ce5-4076-a138-2cbc69e069e5}">

<ModelExchange
modelIdentifier="Resource"
Expand Down
2 changes: 1 addition & 1 deletion Stair/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="Stair" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f008}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="Stair" instantiationToken="{8c4e810f-3df3-4a00-8276-176fa3c9f008}">

<ModelExchange
modelIdentifier="Stair"
Expand Down
6 changes: 3 additions & 3 deletions VanDerPol/FMI3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0-alpha.6" modelName="van der Pol oscillator" instantiationToken="{8c4e810f-3da3-4a00-8276-176fa3c9f000}">
<fmiModelDescription fmiVersion="3.0-beta.1" modelName="van der Pol oscillator" instantiationToken="{8c4e810f-3da3-4a00-8276-176fa3c9f000}">

<ModelExchange
modelIdentifier="VanDerPol"
Expand Down Expand Up @@ -33,8 +33,8 @@
<ModelStructure>
<Output valueReference="0"/>
<Output valueReference="2"/>
<StateDerivative valueReference="1"/>
<StateDerivative valueReference="3"/>
<ContinuousStateDerivative valueReference="1"/>
<ContinuousStateDerivative valueReference="3"/>
<InitialUnknown valueReference="1"/>
<InitialUnknown valueReference="3"/>
</ModelStructure>
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/model_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
116 changes: 58 additions & 58 deletions include/fmi3FunctionTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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[] */

Expand All @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -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[] */

/***************************************************
Expand All @@ -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[] */
Expand All @@ -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[] */
Expand Down
14 changes: 7 additions & 7 deletions include/fmi3Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 09cb993

Please sign in to comment.