Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/build-fmusim-gui.yml

This file was deleted.

68 changes: 41 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
jobs:

lint-files:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- run: python3 build/lint_files.py

build:
Expand All @@ -32,83 +32,97 @@ jobs:
image: ubuntu-22.04
arch: aarch64
- name: x86_64-darwin
image: macos-13
image: macos-14
arch: x86_64
- name: aarch64-darwin
image: macos-13
image: macos-14
arch: aarch64
runs-on: ${{ matrix.image }}
needs: lint-files
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.12'
- run: which python
- run: python -m pip install fmpy==0.3.21 pytest requests scipy
- if: matrix.name == 'aarch64-linux'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu qemu-user
- run: cmake --version
- run: python build/build_cvode.py ${{ matrix.name }}
- run: python build/build_libxml2.py ${{ matrix.name }}
- run: python build/build_zlib.py ${{ matrix.name }}
- run: python build/build.py ${{ matrix.name }}
- if: matrix.name != 'aarch64-darwin'
run: pytest tests --platform ${{ matrix.name }}
- uses: actions/upload-artifact@v4
# - if: matrix.name != 'aarch64-darwin'
# run: pytest tests --platform ${{ matrix.name }}
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.name }}
path: build/fmus
if-no-files-found: error

merge-fmus:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: s-weigand/setup-conda@v1
- name: Install fmusim
run: |
curl -LsSf https://raw.githubusercontent.com/modelica/fmusim/refs/heads/main/install.sh | sh

- name: Set up Python
uses: actions/setup-python@v6
with:
conda-channels: conda-forge
- run: python -m pip install fmpy==0.3.20 pytest scipy kaleido markdown2 plotly pytz
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install fmpy==0.3.20 pytest scipy kaleido markdown2 plotly pytz

- uses: actions/checkout@v7

- uses: actions/download-artifact@v8
with:
name: x86-windows
path: dist-x86-windows
- uses: actions/download-artifact@v4

- uses: actions/download-artifact@v8
with:
name: x86_64-windows
path: dist-x86_64-windows
- uses: actions/download-artifact@v4

- uses: actions/download-artifact@v8
with:
name: x86_64-linux
path: dist-x86_64-linux
- uses: actions/download-artifact@v4

- uses: actions/download-artifact@v8
with:
name: aarch64-linux
path: dist-aarch64-linux
- uses: actions/download-artifact@v4

- uses: actions/download-artifact@v8
with:
name: x86_64-darwin
path: dist-x86_64-darwin
- uses: actions/download-artifact@v4

- uses: actions/download-artifact@v8
with:
name: aarch64-darwin
path: dist-aarch64-darwin
- run: chmod +x dist-x86_64-linux/fmusim-x86_64-linux/fmusim

- run: git status --porcelain --untracked=no
- run: git tag --contains
- run: git rev-parse --short HEAD

- run: python3 build/merge_binaries.py
- name: Run merge binaries script
run: |
python build/merge_binaries.py

- run: git status --porcelain --untracked=no
- run: git tag --contains
- run: git rev-parse --short HEAD

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: Reference-FMUs
path: dist-merged
Expand Down
47 changes: 0 additions & 47 deletions BouncingBall/FMI1CS.xml

This file was deleted.

41 changes: 0 additions & 41 deletions BouncingBall/FMI1ME.xml

This file was deleted.

8 changes: 0 additions & 8 deletions BouncingBall/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,53 +58,45 @@ Status setFloat64(ModelInstance* comp, ValueReference vr, const double value[],
switch (vr) {

case vr_h:
#if FMI_VERSION > 1
if (comp->state != Instantiated &&
comp->state != InitializationMode &&
comp->state != ContinuousTimeMode &&
comp->state != EventMode) {
logError(comp, "Variable \"h\" can only be set in Instantiated Mode, Initialization Mode, Continuous Time Mode, and Event Mode.");
return Error;
}
#endif
M(h) = value[(*index)++];
return OK;

case vr_v:
#if FMI_VERSION > 1
if (comp->state != Instantiated &&
comp->state != InitializationMode &&
comp->state != ContinuousTimeMode &&
comp->state != EventMode) {
logError(comp, "Variable \"v\" can only be set in Instantiated Mode, Initialization Mode, Continuous Time Mode, and Event Mode.");
return Error;
}
#endif
M(v) = value[(*index)++];
return OK;

case vr_g:
#if FMI_VERSION > 1
if (comp->type == ModelExchange &&
comp->state != Instantiated &&
comp->state != InitializationMode) {
logError(comp, "Variable g can only be set after instantiation or in initialization mode.");
return Error;
}
#endif
M(g) = value[(*index)++];
return OK;

case vr_e:
#if FMI_VERSION > 1
if (comp->type == ModelExchange &&
comp->state != Instantiated &&
comp->state != InitializationMode &&
comp->state != EventMode) {
logError(comp, "Variable e can only be set after instantiation, in initialization mode or event mode.");
return Error;
}
#endif
M(e) = value[(*index)++];
return OK;

Expand Down
30 changes: 4 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ ENDFUNCTION()

project (Reference-FMUs)

set(FMI_VERSION 2 CACHE STRING "FMI Version")
set_property(CACHE FMI_VERSION PROPERTY STRINGS 1 2 3)

set(FMI_TYPE ME CACHE STRING "FMI Type (FMI 1.0 only)")
set_property(CACHE FMI_TYPE PROPERTY STRINGS ME CS)

if (${FMI_VERSION} GREATER 1)
set(FMI_TYPE "")
endif ()
set(FMI_VERSION 3 CACHE STRING "FMI Version")
set_property(CACHE FMI_VERSION PROPERTY STRINGS 2 3)

set(FMI_ARCHITECTURE "" CACHE STRING "FMI Architecture")
set_property(CACHE FMI_ARCHITECTURE PROPERTY STRINGS "" "aarch64" "x86" "x86_64")
Expand All @@ -32,8 +25,6 @@ if (NOT FMI_ARCHITECTURE)
endif ()
endif ()

set(WITH_FMUSIM OFF CACHE BOOL "Add fmusim project")

if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)

Expand Down Expand Up @@ -102,11 +93,7 @@ if (${FMI_VERSION} LESS 3)
")
endif ()

set (MODEL_NAMES BouncingBall Dahlquist Stair Feedthrough VanDerPol)

if (${FMI_VERSION} GREATER 1 OR "${FMI_TYPE}" STREQUAL "CS")
set (MODEL_NAMES ${MODEL_NAMES} Resource)
endif ()
set (MODEL_NAMES BouncingBall Dahlquist Feedthrough Resource Stair VanDerPol)

if (${FMI_VERSION} GREATER 2)
set (MODEL_NAMES ${MODEL_NAMES} StateSpace Clocks)
Expand Down Expand Up @@ -147,7 +134,6 @@ SET(SOURCES
add_library(${TARGET_NAME} SHARED
${HEADERS}
${SOURCES}
${MODEL_NAME}/FMI${FMI_VERSION}${FMI_TYPE}.xml
${MODEL_NAME}/buildDescription.xml
)

Expand All @@ -172,10 +158,6 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
target_link_options(${TARGET_NAME} PRIVATE "-static-intel" "-static-libgcc")
endif()

if (${FMI_VERSION} EQUAL 1 AND "${FMI_TYPE}" STREQUAL CS)
target_compile_definitions(${TARGET_NAME} PRIVATE FMI_COSIMULATION)
endif()

target_include_directories(${TARGET_NAME} PRIVATE
include
${MODEL_NAME}
Expand All @@ -202,7 +184,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)

# modelDescription.xml
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_NAME}/FMI${FMI_VERSION}${FMI_TYPE}.xml
${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_NAME}/FMI${FMI_VERSION}.xml
"${FMU_BUILD_DIR}/modelDescription.xml"
)

Expand Down Expand Up @@ -276,7 +258,3 @@ endforeach(MODEL_NAME)

# Examples
include(examples/Examples.cmake)

if (WITH_FMUSIM)
add_subdirectory(fmusim)
endif ()
Loading