Marine systems simulation
Create a new SimObject library

SimObject libraries are loadable modules (dll or so files) that contain one or more classes inheriting from the SimObject interface. These modules get loaded by FhSim at runtime and their SimObjects made available for the simulation.

Herein, a sketch of the procedure for creating a new SimObject library with a set of SimObjects. In practice, it is recommended to use the SimObject template tool. This tool makes it easier to create a new SimObject library that follow good coding practices, see SimObject template tool. Alternatively, one could consider to base new library on an existing library.

Creating a new SimObject library

Each implemented SimObject must be referenced using ADD_SIMOBJECT_REF or ADD_SIMOBJECT_REF3 macros in a CMake MODULE target. The MODULE target must link to the target FhSim::fhsim, which contains the SimObject base implementation. Suppose fhsim_example.cpp contains a class my::deep::space::VanDerPol and Pendulum, both implementing the SimObject interface. To create a SimObject library with these models, we add to fhsim_example.cpp:

#include <dllLib.h>
IMPORT_EXPORT SimObject* getSimObject(std::string subClassName,
std::sttring simObjectName, ISimObjectCreator* creator)
return nullptr;
Definition: Pendulum.h:66

An excerpt of the CMakeLists.txt is:

find_package(FhSim CONFIG REQUIRED)
add_library(fhsim_example MODULE fhsim_example.cpp fhsim_example.h)
target_link_libraries(fhsim_example PRIVATE FhSim::fhsim)

The resulting dll/so is now a SimObject library with two SimObjects: Oscillator/VanDerPol and Oscillator/Pendulum.

SimObject template tool

The simobject template tool is a command line interface that help create a minimal SimObject library, with ready-made scripts for CMake, conan and documentation. If you are lucky, you are almost completely relieved the burden of writing build system scripts.


Install it from the following URL:

python -m pip install

If you have access to the git repository, install the development version from there:

python -m pip install git+ssh://


Run simobject --help to get available commands. A user scenario is typically

  1. simobject new config_dir
  2. Edit config_dir/simobject.cfg in a text editor. A simobject.cfg file will be on the format:
name = fhsim_awesome
short_name = fhawe
author = John Doe
author_email =
url =
homepage =
description = A SimObjectLibrary for the purpose of learning how to develop in FhSim.
topics = FhSim, Simulation, Marine, Robotics, Cybernetics
  1. simobject create config_dir --output-folder generated_dir
  2. cd generated_dir && git init
  3. mkdir build && cd build
  4. conan install .. && conan build ..
  • If required system packages are missing, the conan execution might abort with error messages displayed. See Conan docs on how to control this behaviour.
  1. Write you own SimObjects, see and in the generated directory.