Skip to content

Commit 1ba8629

Browse files
committed
Fixing review comments from CodeRabbit
* .github/workflows/build-fmus.yml: also trigger builds on push to main (not just tags/PRs). * reference-FMUs/CMakeLists.txt: package the FMI headers into sources/ (so the FMU is rebuildable), pre-create build dirs. * reference-FMUs/SimpleDAE/README.md: fixed the documented output path for the built FMU. * reference-FMUs/SimpleDAE/config.h: dropped GET_PARTIAL_DERIVATIVE. * reference-FMUs/SimpleDAE/fmi-ls-manifest.xml: schemaLocation now points at the GitHub-hosted schema instead of a local relative path. * reference-FMUs/SimpleDAE/model.c: removed the dead getPartialDerivative stub that returned OK without setting the output. * reference-FMUs/SimpleDAE/modelDescription.xml: providesDirectionalDerivatives/providesAdjointDerivatives now false, matching actual (non-)support.
1 parent 4c13b4d commit 1ba8629

7 files changed

Lines changed: 14 additions & 36 deletions

File tree

.github/workflows/build-fmus.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Build and test reference FMUs
22

33
on:
44
push:
5+
branches: [ main ]
56
tags:
67
- '*'
78
pull_request:

reference-FMUs/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ add_library(${MODEL_NAME} SHARED
7272
${MODEL_NAME}/buildDescription.xml
7373
)
7474

75+
if (UNIX AND NOT APPLE)
76+
target_link_libraries(${MODEL_NAME} PRIVATE m)
77+
endif ()
78+
7579
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fmus)
7680

7781
target_compile_definitions(${MODEL_NAME} PRIVATE
@@ -99,6 +103,10 @@ target_include_directories(${MODEL_NAME} PRIVATE
99103
)
100104

101105
set(FMU_BUILD_DIR temp/${MODEL_NAME})
106+
file(MAKE_DIRECTORY
107+
"${FMU_BUILD_DIR}/sources"
108+
"${FMU_BUILD_DIR}/extra/org.fmi-standard.fmi-ls-dae"
109+
)
102110

103111
set_target_properties(${MODEL_NAME} PROPERTIES
104112
RUNTIME_OUTPUT_DIRECTORY "${FMU_BUILD_DIR}/binaries/${FMI_PLATFORM}"
@@ -131,7 +139,7 @@ foreach (SOURCE_FILE config.h model.c)
131139
endforeach ()
132140

133141
# shared headers
134-
foreach (SOURCE_FILE model.h)
142+
foreach (SOURCE_FILE model.h fmi3Functions.h fmi3FunctionTypes.h fmi3PlatformTypes.h)
135143
add_custom_command(TARGET ${MODEL_NAME} POST_BUILD
136144
COMMAND ${CMAKE_COMMAND} -E copy
137145
"${CMAKE_CURRENT_SOURCE_DIR}/include/${SOURCE_FILE}"

reference-FMUs/SimpleDAE/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ cmake -B build
5151
cmake --build build --config Release
5252
```
5353

54-
The FMU is written to `build/cmake/fmus/SimpleDAE.fmu`.
54+
The FMU is written to `build/fmus/SimpleDAE.fmu`.
5555

5656
By default CMake detects the host architecture. To cross-compile, pass `-DFMI_ARCHITECTURE=<arch>` where `<arch>` is one of `x86_64` or `aarch64`.
5757

reference-FMUs/SimpleDAE/config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define SET_FLOAT64
1414
#define GET_BOOLEAN
1515
#define SET_BOOLEAN
16-
#define GET_PARTIAL_DERIVATIVE
1716

1817
#define FIXED_SOLVER_STEP 1e-2
1918
#define DEFAULT_STOP_TIME 20

reference-FMUs/SimpleDAE/fmi-ls-manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<fmi-ls-dae
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://fmi-standard.org/fmi-ls-manifest ../../schema/fmi3LayeredStandardDaeManifest.xsd"
4+
xsi:schemaLocation="http://fmi-standard.org/fmi-ls-manifest https://raw.githubusercontent.com/modelica/fmi-ls-dae/main/schema/fmi3LayeredStandardDaeManifest.xsd"
55
xmlns="http://fmi-standard.org/fmi-ls-manifest"
66
xmlns:fmi-ls="http://fmi-standard.org/fmi-ls-manifest"
77
fmi-ls:fmi-ls-name="org.fmi-standard.fmi-ls-dae"

reference-FMUs/SimpleDAE/model.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -134,36 +134,6 @@ Status getDerivatives(ModelInstance *comp, double dx[], size_t nx) {
134134
return OK;
135135
}
136136

137-
Status getPartialDerivative(ModelInstance *comp, ValueReference unknown, ValueReference known, double *partialDerivative) {
138-
UNUSED(comp);
139-
UNUSED(unknown);
140-
UNUSED(known);
141-
UNUSED(partialDerivative);
142-
143-
if (M(ode_dae)) {
144-
145-
}
146-
else {
147-
148-
}
149-
150-
/*if (unknown == vr_der_x1 && known == vr_x1) {
151-
*partialDerivative = 0;
152-
} else if (unknown == vr_der_x1 && known == vr_x2) {
153-
*partialDerivative = 1;
154-
} else if (unknown == vr_der_x2 && known == vr_x1) {
155-
*partialDerivative = -2 * M(x1) * M(x2) * M(mu) - 1;
156-
} else if (unknown == vr_der_x2 && known == vr_x2) {
157-
*partialDerivative = M(mu) * (1 - M(x1) * M(x1));
158-
} else if (unknown == vr_der_x2 && known == vr_mu && comp->state == InitializationMode) {
159-
*partialDerivative = (1 - M(x1) * M(x1)) * M(x2);
160-
} else {
161-
*partialDerivative = 0;
162-
}
163-
*/
164-
return OK;
165-
}
166-
167137
Status eventUpdate(ModelInstance *comp) {
168138

169139
comp->valuesOfContinuousStatesChanged = false;

reference-FMUs/SimpleDAE/modelDescription.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
modelIdentifier="SimpleDAE"
1313
canGetAndSetFMUState="true"
1414
canSerializeFMUState="true"
15-
providesDirectionalDerivatives="true"
16-
providesAdjointDerivatives="true" />
15+
providesDirectionalDerivatives="false"
16+
providesAdjointDerivatives="false" />
1717

1818
<LogCategories>
1919
<Category name="logEvents" description="Log events" />

0 commit comments

Comments
 (0)