Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FMUSim GUI #539

Closed
wants to merge 153 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
389d5db
Add initial project
t-sommer May 21, 2024
2dc9c49
Move project to parent directory
t-sommer May 21, 2024
dc75510
Use xmlFree() in FMIModelDescription.c
t-sommer May 21, 2024
3eeac80
Load model description
t-sommer May 21, 2024
677c925
Extract FMU
t-sommer May 21, 2024
148e493
Add class ModelVariablesItemModel
t-sommer May 24, 2024
0f60c15
Add dock widget
t-sommer May 24, 2024
cfc151e
Add header data to model
t-sommer May 28, 2024
2909935
Add icons
t-sommer May 28, 2024
de1c233
Add columns
t-sommer May 28, 2024
91c8637
Add file view
t-sommer May 28, 2024
af02ed3
Add documentation view
t-sommer May 28, 2024
fba8bfa
Add plot
t-sommer May 28, 2024
c3966b5
Add page buttons
t-sommer May 28, 2024
156cc7e
Add styling
t-sommer May 28, 2024
9e7746d
Add remaining columns and units
t-sommer May 30, 2024
af6da32
Fix variability values
t-sommer May 30, 2024
4b40105
Add simulation controls and fix column widths
t-sommer May 30, 2024
3a68e69
Add open unzip directory action
t-sommer May 30, 2024
89fe865
Add simulation, plot, and log
t-sommer May 31, 2024
d08f6c9
Add FMIDemoRecorder
t-sommer Jun 5, 2024
58832cb
Add start values and collapse columns
t-sommer Jun 6, 2024
f9f8755
Add start values
t-sommer Jun 7, 2024
e2094d0
Add FMISimulation.c and stopTime
t-sommer Jun 12, 2024
cee4ed6
Add plot to resources and disable buttons
t-sommer Jun 12, 2024
33e77f6
Try dark mode and plot
t-sommer Jun 14, 2024
9125a99
Use dark icons
t-sommer Jun 14, 2024
8db9451
Add start page
t-sommer Jun 14, 2024
d7254cc
Use xmlFree() in ModelDescription.c
t-sommer Jun 17, 2024
afb0bd1
Add drag & drop
t-sommer Jun 17, 2024
e06cc95
Add dark variable icons
t-sommer Jun 17, 2024
9bd1e99
Add in-memory recording
t-sommer Jun 20, 2024
f570f50
Add traces
t-sommer Jun 20, 2024
5480a5e
Toggle side bar
t-sommer Jun 20, 2024
f8f0574
Add visible, logging, and startTime
t-sommer Jun 21, 2024
427c710
Rename FMIVersion to FMIMajorVersion
t-sommer Jun 21, 2024
69f3045
Add FMI version string to Model Description
t-sommer Jun 24, 2024
73097b8
Merge changes from main
t-sommer Jun 25, 2024
e937bee
Merge changes from main
t-sommer Jun 25, 2024
454e0da
Merge changes from main
t-sommer Jun 25, 2024
9d3a20b
Add type defintions
t-sommer Jun 25, 2024
054effa
Merge changes from main
t-sommer Jun 25, 2024
a5e81a6
Merge changes from main
t-sommer Jun 26, 2024
8e80181
Merge changes from main
t-sommer Jun 26, 2024
85986b1
Make play button green
t-sommer Jun 26, 2024
41af734
Add FMISimulation.{h|c}
t-sommer Jun 27, 2024
94db066
Rename fmusim_* to FMI*
t-sommer Jun 27, 2024
9d1ee37
Update filenames in GUI
t-sommer Jun 27, 2024
37544a0
Rename simulateFMI*() to FMI*Simulate()
t-sommer Jun 27, 2024
9085796
Fix generationDateAndTime in ModelDescription.c
t-sommer Jun 27, 2024
53e563c
Add interfaces to Model Info
t-sommer Jun 27, 2024
270ca3e
Merge changes from main
t-sommer Jun 27, 2024
bc70304
Add input file
t-sommer Jun 27, 2024
3a96ea7
Merge changes from main
t-sommer Jun 28, 2024
db0ff17
Add plot column
t-sommer Jul 1, 2024
cf0a11a
Add output interval
t-sommer Jul 2, 2024
b1ba025
Add VariableInfo struct
t-sommer Jul 3, 2024
e23662b
Add FMIRecorderUpdateSizes()
t-sommer Jul 3, 2024
e5bfa15
Add Binary type
t-sommer Jul 4, 2024
616abe0
Add String type, FMIDuplicateString(), FMIDuplicateBuffer()
t-sommer Jul 4, 2024
91d984a
Remove file from Recorder
t-sommer Jul 4, 2024
ebd6d6f
Clean up
t-sommer Jul 4, 2024
fd9ce77
Rename parameter "result" to "recorder"
t-sommer Jul 4, 2024
c7b855c
Update GUI
t-sommer Jul 4, 2024
da8d512
Fix variable index in fmi3{Get|Set}Binary()
t-sommer Jul 5, 2024
02faa9d
Plot Int32
t-sommer Jul 5, 2024
85ba007
Add interger and boolean plots
t-sommer Jul 9, 2024
84de1d8
Show plot page after simulation
t-sommer Jul 9, 2024
434f4c1
Make page buttons checkable
t-sommer Jul 9, 2024
00b6b20
Add tolerance to FMIDefaultExperiment
t-sommer Jul 9, 2024
c0b82b6
Add solvers
t-sommer Jul 9, 2024
084ccce
Set tolerance
t-sommer Jul 9, 2024
6013c2f
Use QPainTextEdit for logging
t-sommer Jul 9, 2024
5744da1
Fix default value of interface type combo box
t-sommer Jul 10, 2024
7c7c740
Rename checkbox to Logging On
t-sommer Jul 10, 2024
63709f4
Add valueReferences to FMIRecorder
t-sommer Jul 12, 2024
a3342ca
Rename parameter result to recorder
t-sommer Jul 12, 2024
42e90eb
Remove nValues, values, and sizes from FMIRecorder
t-sommer Jul 12, 2024
6cf7db7
Fix FMIFreeRecorder()
t-sommer Jul 12, 2024
2e254a8
Warm up web engine
t-sommer Jul 12, 2024
f7f9096
Pass unzipdir to FMISimulate()
t-sommer Jul 12, 2024
72c533b
Fix model identifier and side bar
t-sommer Jul 12, 2024
de10f4d
Add visible and loggingOn to FMISimulationSettings
t-sommer Jul 15, 2024
8aa7fdc
Add variable time to plot
t-sommer Jul 15, 2024
9ece656
Disable context menus for web engine views
t-sommer Jul 15, 2024
8515905
Log FMU messages
t-sommer Jul 15, 2024
418ebc9
Hide scrollbars in plot
t-sommer Jul 15, 2024
2a305b5
Fix light mode
t-sommer Jul 16, 2024
a2c6bca
Add variables filters
t-sommer Jul 16, 2024
f6def90
Show optional columns
t-sommer Jul 16, 2024
d00e7d3
Sort variables by name
t-sommer Jul 16, 2024
cf9c7f5
Add simulation time
t-sommer Jul 16, 2024
1d534e4
Add Event Mode Used and Early Return Allowed
t-sommer Jul 16, 2024
7cef251
Add tool icons
t-sommer Jul 18, 2024
55cf19e
Add platforms label
t-sommer Jul 18, 2024
5151860
Add light tool icons
t-sommer Jul 18, 2024
0f9f56d
Add SimulationThread
t-sommer Jul 18, 2024
9a749d2
Add progress dialog
t-sommer Jul 18, 2024
8f7f808
Rename checkbox labels
t-sommer Jul 19, 2024
c5f93ca
Sort variables case insensitive
t-sommer Jul 19, 2024
57f42df
Remove excess argument from FMICreateRecorder()
t-sommer Jul 19, 2024
371d887
Call stepFinished() in FMI*Simulate()
t-sommer Jul 19, 2024
1bb9e9d
Add recent files
t-sommer Jul 19, 2024
34cd64c
Check units, display units, and type defintions
t-sommer Jul 22, 2024
36e6a5e
Add info page
t-sommer Jul 22, 2024
78853cf
Merge changes from main
t-sommer Jul 24, 2024
74aa9b2
Add spacer to start page
t-sommer Jul 24, 2024
0dc67ea
Load image from unzipdir
t-sommer Jul 24, 2024
45d6e4b
Add icon to info button
t-sommer Jul 24, 2024
1428ef9
Add "New Window" action
t-sommer Jul 25, 2024
5692e40
Add build scripts
t-sommer Jul 25, 2024
edac0d0
Move instantiation to SimulationThread
t-sommer Jul 26, 2024
aa9266e
Clean up
t-sommer Jul 26, 2024
4d7c8fd
Fix FMIFreeModelDescription()
t-sommer Jul 26, 2024
abe2551
Clean up memory
t-sommer Jul 26, 2024
e53bfae
Add CI config
t-sommer Jul 26, 2024
5cc90ff
Install requests
t-sommer Jul 26, 2024
79184ee
Use windows-2019
t-sommer Jul 26, 2024
29a1813
Convert Paths to str
t-sommer Jul 26, 2024
f010852
Use Python 3.10
t-sommer Jul 26, 2024
4ff18cf
List environment variables
t-sommer Jul 29, 2024
f169f79
Use powershell commands
t-sommer Jul 29, 2024
3777d94
Build cmake project
t-sommer Jul 29, 2024
1842dc9
Install qtwebengine
t-sommer Jul 29, 2024
f670864
Install qtwebchannel
t-sommer Jul 29, 2024
94e5784
Install qtpositioning module
t-sommer Jul 29, 2024
5152794
Copy binaries to build dir
t-sommer Jul 29, 2024
dbea833
Add application version
t-sommer Jul 29, 2024
56debe3
Clean up
t-sommer Jul 29, 2024
d8a93d2
Clean up
t-sommer Jul 29, 2024
ac47afa
Disable show plot in loadFMU()
t-sommer Jul 29, 2024
ac25053
Clean up button icons
t-sommer Jul 29, 2024
e2d3fd8
Remove old icons
t-sommer Jul 29, 2024
aabb253
Add license file
t-sommer Jul 30, 2024
f28b800
Check if platform binary was loaded
t-sommer Jul 30, 2024
ff740b7
Make unit column wider
t-sommer Jul 30, 2024
5c64b8f
Plot at most 5 variable by default
t-sommer Jul 30, 2024
93eacdf
Group settings by interface type
t-sommer Jul 30, 2024
824f844
Handle (count == 0 || size == 0) in FMICalloc()
t-sommer Jul 30, 2024
e488c97
Add log errors in FMIDuplicateBuffer()
t-sommer Jul 30, 2024
60c360d
Log error messages in SimulationThread
t-sommer Jul 30, 2024
b219b14
Bump copyright year in LICENSE.txt
t-sommer Jul 30, 2024
aff60be
Dummy commit
t-sommer Jul 30, 2024
9c82f19
Adjust column widths
t-sommer Jul 30, 2024
5dc4f78
Set title font size
t-sommer Jul 30, 2024
282028c
Use monospace font for log
t-sommer Jul 31, 2024
ccdc8da
Add unloadFMU()
t-sommer Jul 31, 2024
52b7811
Add app icon
t-sommer Jul 31, 2024
8afb787
Set working directory
t-sommer Jul 31, 2024
b61689f
Add Qt license
t-sommer Aug 2, 2024
7cb4846
Rename artifact
t-sommer Aug 2, 2024
51e9c33
Install Python after Qt
t-sommer Aug 2, 2024
7394697
Replace non-ASCII characters
t-sommer Aug 2, 2024
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: 42 additions & 0 deletions .github/workflows/build-fmusim-gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build the FMUSim GUI

on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]

jobs:
build-fmusim-gui:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.7.1'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
modules: 'qtpositioning qtwebchannel qtwebengine'
- run: python -m pip install fmpy requests
- run: python fmusim-gui/build/build_cvode.py
- run: python fmusim-gui/build/build_libxml2.py
- run: python fmusim-gui/build/build_zlib.py
- run: cmake -D CMAKE_PREFIX_PATH=${{env.QT_ROOT_DIR}} -S fmusim-gui -B fmusim-gui/build/fmusim-gui
- run: cmake --build fmusim-gui/build/fmusim-gui --config Release
- run: ${{env.QT_ROOT_DIR}}\bin\windeployqt.exe fmusim-gui\build\fmusim-gui\Release\fmusim-gui.exe
- run: Copy-Item -Path fmusim-gui\build\libxml2-x86_64-windows\install\bin\libxml2.dll -Destination fmusim-gui\build\fmusim-gui\Release\
- run: Copy-Item -Path fmusim-gui\build\zlib-x86_64-windows\install\bin\zlib.dll -Destination fmusim-gui\build\fmusim-gui\Release\
- run: Copy-Item -Path fmusim-gui\LICENSE.txt -Destination fmusim-gui\build\fmusim-gui\Release\
- run: Copy-Item -Path fmusim-gui\LICENSE_QT.txt -Destination fmusim-gui\build\fmusim-gui\Release\
- uses: actions/upload-artifact@v4
with:
name: fmusim-gui-x86_64-windows
path: fmusim-gui/build/fmusim-gui/Release
if-no-files-found: error

4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
image: ubuntu-20.04
arch: aarch64
- name: x86_64-darwin
image: macos-11
image: macos-12
arch: x86_64
- name: aarch64-darwin
image: macos-11
image: macos-12
arch: aarch64
runs-on: ${{ matrix.image }}
needs: lint-files
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (MSVC)
endif ()

# hide internal functions
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
if (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, Modelica Association Project "FMI".
Copyright (c) 2024, Modelica Association Project "FMI".
All rights reserved.

The Reference FMUs and FMUSim are released under the 2-Clause BSD license:
Expand Down
2 changes: 1 addition & 1 deletion examples/simulate_fmi2_me.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main(int argc, char* argv[]) {

fmi2EventInfo eventInfo = { 0 };

// intial event iteration
// initial event iteration
do {

CALL(FMI2NewDiscreteStates(S, &eventInfo));
Expand Down
2 changes: 1 addition & 1 deletion examples/simulate_fmi3_me.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {

CALL(FMI3ExitInitializationMode(S));

// intial event iteration
// initial event iteration
while (discreteStatesNeedUpdate) {

CALL(FMI3UpdateDiscreteStates(S,
Expand Down
74 changes: 74 additions & 0 deletions fmusim-gui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash

# qtcreator generated files
*.pro.user*
CMakeLists.txt.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

160 changes: 160 additions & 0 deletions fmusim-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
cmake_minimum_required(VERSION 3.5)

project(fmusim-gui VERSION 0.1 LANGUAGES C CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
set(CVODE_DIR ${CMAKE_SOURCE_DIR}/build/cvode-x86_64-windows/install)
set(LIBXML2_DIR ${CMAKE_SOURCE_DIR}/build/libxml2-x86_64-windows/install)
set(ZLIB_DIR ${CMAKE_SOURCE_DIR}/build/zlib-x86_64-windows/install)

set(ZLIB_SRC_DIR ${CMAKE_SOURCE_DIR}/build/zlib-1.3)

find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)

set(PROJECT_SOURCES
main.cpp
MainWindow.cpp
MainWindow.h
MainWindow.ui
../src/FMI.c
../include/FMI.h
../fmusim/FMIZip.c
../fmusim/FMIZip.h
../fmusim/miniunzip.c
${ZLIB_SRC_DIR}/contrib/minizip/unzip.c
${ZLIB_SRC_DIR}/contrib/minizip/ioapi.c
${ZLIB_SRC_DIR}/contrib/minizip/iowin32.c
../fmusim/FMIModelDescription.c
../fmusim/FMIModelDescription.h
../src/structured_variable_name.tab.c
../src/structured_variable_name.yy.c
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(fmusim-gui
MANUAL_FINALIZATION
${PROJECT_SOURCES}
ModelVariablesItemModel.h
ModelVariablesItemModel.cpp
plot.html
../src/FMI1.c
../src/FMI2.c
../include/FMI1.h
../include/FMI2.h
../src/FMI3.c
../include/FMI3.h
../fmusim/FMIUtil.c
../fmusim/FMIUtil.h
../fmusim/csv.c
../fmusim/csv.h

../fmusim/FMIStaticInput.h
../fmusim/FMIStaticInput.c

../fmusim/FMI1CSSimulation.h
../fmusim/FMI1CSSimulation.c
../fmusim/FMI1MESimulation.h
../fmusim/FMI1MESimulation.c

../fmusim/FMI2CSSimulation.h
../fmusim/FMI2CSSimulation.c
../fmusim/FMI2MESimulation.h
../fmusim/FMI2MESimulation.c

../fmusim/FMI3CSSimulation.h
../fmusim/FMI3CSSimulation.c
../fmusim/FMI3MESimulation.h
../fmusim/FMI3MESimulation.c

../fmusim/FMIRecorder.h
../fmusim/FMIRecorder.c

../fmusim/FMISimulation.h
../fmusim/FMISimulation.c

../fmusim/FMIEuler.h
../fmusim/FMIEuler.c

../fmusim/FMICVode.h
../fmusim/FMICVode.c

buttons.qrc
plot.qrc
icons/variables/variables.qrc
VariablesFilterModel.h VariablesFilterModel.cpp
SimulationThread.h SimulationThread.cpp
resources.qrc
)

target_include_directories(fmusim-gui PRIVATE
../include
../fmusim
${LIBXML2_DIR}/include/libxml2
${ZLIB_DIR}/include
${ZLIB_SRC_DIR}/contrib/minizip
${CVODE_DIR}/include
)

target_compile_definitions(fmusim-gui PRIVATE
YY_NO_UNISTD_H
)

target_link_libraries(fmusim-gui PRIVATE
Qt6::WebEngineWidgets
${LIBXML2_DIR}/lib/libxml2.lib
${ZLIB_DIR}/lib/zlib.lib
${CVODE_DIR}/lib/sundials_cvode.lib
)

# Define target properties for Android with Qt 6 as:
# set_property(TARGET fmusim-gui APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(fmusim-gui SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(fmusim-gui
${PROJECT_SOURCES}
)
endif()
endif()

target_link_libraries(fmusim-gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.fmusim-gui)
endif()
set_target_properties(fmusim-gui PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)

include(GNUInstallDirs)
install(TARGETS fmusim-gui
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(fmusim-gui)
endif()
Loading