The QSS Solver is a modeling and simulation environment for continuous and hybrid systems and it's optimized for large scale model simulation. The solver is implemented as a set of modules coded in plain C language, simulations can be performed using one of the following integration methods:
- QSS methods (the entire family is supported)
- DASSL
- DOPRI
- CVODE
- IDA
Models are described using a subset of the standard Modelica language called μ–Modelica (the language specification can be found here), the compiler extracts all the structural information needed and automatically generates the plain C code that contains an appropiate model definition needed by the QSS Solver engine together with all the configuration files (makefiles, config, etc.).
The QSS Solver has a simple GUI interface that allows the end-user to access all the developed tools in a unified way.
The GUI has the following features:
- It has a text editor, where models in μ-Modelica can be defined.
- It invokes the corresponding tools to compile and run simulations.
- It provides debug information in case of errors during the model generation.
- It invokes GnuPlot to plot the simulation output trajectories.
- It shows statistics about simulations (number of steps, simulation time, etc.).
[8] Ernesto Kofman, Joaquin Fernandez, Denise Marzorati. Compact sparse symbolic Jacobian computation in large systems of ODEs Applied Mathematics and Computation
[7] Franco Di Pietro, Joaquin Fernandez, Gustavo Migoni, Ernesto Kofman. Mixed-mode state–time discretization in ODE numerical integration Journal of Computational and Applied Mathematics
[6] Gustavo Migoni, Ernesto Kofman, Federico Bergero, Joaquin Fernandez. Quantization-based simulation of switched mode power supplies Simulation
[5] Federico Bergero, Joaquin Fernandez, Ernesto Kofman, Margarita Portapila. Time discretization versus state quantization in the simulation of a one-dimensional advection–diffusion–reaction equation Simulation
[4] Federico Bergero, Francesco Casella, Ernesto Kofman, Joaquin Fernandez. On the efficiency of quantization-based integration methods for building simulation Building Simulation
[3] Joaquin Fernandez, Ernesto Kofman, Federico Bergero. A parallel Quantized State System Solver for ODEs Journal of Parallel and Distributed Computing
[2] Federico Bergero, Xenofon Floros, Joaquin Fernandez, Ernesto Kofman, Francois Cellier. Simulating Modelica models with a Stand–Alone Quantized State Systems Solver Proceedings of the 9th International Modelica Conference
[1] Joaquin Fernandez, Ernesto Kofman. A stand-alone quantized state system solver for continuous system simulation Simulation
The MicroModelica compiler allows the user to describe models using a subset of the standard Modelica language called μ–Modelica (the language specification can be found here), the compiler extracts all the structural information needed and automatically generates the plain C code that contains an appropiate model definition needed by the QSS Solver engine together with all the configuration files (makefiles, config, etc.). The compiler documentation can be found here
The QSS Engine is a library that allows the simulation of continuous and hybrid systems and it's optimized for large scale model simulation. The solver is implemented as a set of modules coded in plain C language, where the simulated models can contain time and state discontinuities. Simulations can be performed using one of the following integration methods:
- QSS methods (the entire family is supported)
- DASSL
- DOPRI
- CVODE
- IDA
In order to obtain an executable model, a plain C file that contains the following functions must be provided:
- Model definition.
- Model settings.
- Model dependencies (for QSS methods).
- Model Jacobian.
- Model zero-crossing function.
- Model event handlers.
- A function in charge of the simulator data structure initialization.
The signature of these functions and the data structures that are used depends on the integration method used and they can ve viewed here
Finally, the file containing the model has to be compiled and linked with the engine library.
The QSS Solver GUI is a simple interface that allows the end-user of the QSS Solver to access all the developed tools in a unified way.
The GUI has the following features:
- It has a text editor, where models in μ-Modelica can be defined.
- It invokes the corresponding tools to compile and run simulations.
- It provides debug information in case of errors during the model generation.
- It invokes GnuPlot to plot the simulation output trajectories.
- It shows statistics about simulations (number of steps, simulation time, etc.).
The GUI documentation can be found here
MicroModelica packages with math helper functions and file manipulation functions that uses the C user libraries described bellow.
These packages are included in qss-solver, so that in order to use them no aditional annotation has to be used (such as package location, include paths, etc), just import the package into the corresponding model.
Available packages:
- math.mo: That contains math utility functions.
- file.mo: That contains file manipulation functions.
Both files are located in the packages folder in the root install location.
C libraries that contains helper functions used in MicroModelica packages. The Makefile included compiles the source files and generates the static library in the lib folder of the qss-solver. To compile a new user library, follow these steps:
-
Put the header file in the include directory.
-
Put the source file in the src directory.
-
Add the source file and the target library name in the Makefile.
-
Finally, run make to generate the corresponding static lib.
The generated lib is stored in the default path that the MMOC looks for, so the lib can be directly accesed from MicroModelica functions.
These are generic installation instructions.
In order to be able to install and compile the QSS Solver, the following dependencies must be installed (Ubuntu 24.04):
- bison++
- cmake
- g++
- gfortran
- gnuplot
- libatlas-base-dev
- libboost1.83-dev
- libcln-dev
- libconfig-dev
- libginac-dev
- libgsl-dev
- libmetis-dev
- libsbml5-dev
- libscotch-dev
- libsuitesparse-dev
- pkgconf
- python3
- qtbase5-dev
- qtbase5-dev-tools
- rapidjson-dev
Additionally, flex-old must be installed:
sudo apt install ${QSS_SOLVER_ROOT}/src/mmoc/3rd-party/flex/flex-old.deb
The simplest way to compile this package is:
-
cdto the directory containing the package's source code (src) and createbuilddirectory to compile the binaries and libraries. -
cdto thebuilddirectory and runcmake ..to install all the binary files and the libraries. -
Type
maketo build the libraries and binary files. -
Type
make installto install the package, the binaries are located in the bin folder and the libraries are located in the lib folder.
- Type
make helpto check the available targets and compile options.
QSS Solver runs on Windows 11 inside Ubuntu under the Windows Subsystem for Linux (WSL). The GUI is displayed through WSLg, which is included in Windows 11, so no X server is needed.
- Ubuntu must run under WSL2 (WSL1 cannot display the GUI). In PowerShell, run
wsl -l -vand check that the VERSION column says2. If it does not, runwsl --set-version Ubuntu 2. - Update WSL once, so that the GUI support is current:
wsl --update, thenwsl --shutdown, and reopen Ubuntu.
-
Check your Ubuntu version with
lsb_release -dand download the matching package:- Ubuntu 24.04:
qss-solver-X.Y.Z.deb - Ubuntu 22.04:
qss-solver-X.Y.Z-u22.deb
- Ubuntu 24.04:
-
Copy the package into your Linux home folder and install it with
apt, which also installs the required dependencies (dpkg -idoes not):cp /mnt/c/Users/<windows-user>/Downloads/qss-solver-X.Y.Z.deb ~/ sudo apt install ~/qss-solver-X.Y.Z.deb
-
Start QSS Solver from an Ubuntu terminal.
run.shmust be run from its own folder:cd /opt/CIFASIS-CONICET/qss-solver/bin && ./run.sh
On the first run, the application is copied to
~/qss-solver.
No folder mapping is needed. Keep your models inside Ubuntu, under ~/qss-solver/models:
- To open them from Windows, go to
\\wsl$\Ubuntu\home\<linux-user>\qss-solverin File Explorer. - Windows drives are available inside Ubuntu under
/mnt(for example,C:is/mnt/c). To bring existing models in, copy them:cp -r /mnt/c/path/to/models ~/qss-solver/models/.
Do not install, build or simulate from /mnt/c. On Windows drives, symbolic links and file permissions do not
work as on Linux, and compiling is much slower.
error while loading shared libraries: libqtermwidget5.so.0: the package is not installed inside Ubuntu,qss-solverwas started directly instead of throughrun.sh, or the files were copied or extracted from Windows and their symbolic links were lost. Install the.debas described above and start the application withrun.sh.- The window does not appear: check that Ubuntu runs under WSL2 and update WSL (see Prerequisites).
- Generate algebraic loop code for variable arrays definition.
- Code generation for multi-loop 2D array equations .
- Code generation for array variable start modifier.
- New VS code extension that can be used instead of the GUI.
- Solve loop variable assignment segfault is fixed.
- Code Scanning alerts from GitHub fixed.
- Differential-mode single-phase PWM inverters closed loop models.
Please see the file called LICENSE.
Report bugs to: fernandez@cifasis-conicet.gov.ar