Marine systems simulation
|
FhSim is a software tool and an API for describing and simulating real world systems. The systems are formulated as ordinary differential equations, and FhSim uses for time-domain integration for the simulation. The integration can be performed by several integration routines. FhSim offers 3D visualization based on the open source rendering engine Ogre3D. A user will typically build a system from several predefined SimObjects, which are sub-models typically modeling a physical system or some characteristics of such a system. The term SimObject
is a simplification of "Simulation
Object". These SimObjects can be used to compose different systems. Each SimObject is defined through both internal models and external properties, such as input ports, output ports and parameters. Each SimObject also contains its own visualization, making its visualization valid regardless of the rest of the system.
The composition of the system to simulate, as well as controlling how the simulation is to be performed, is defined through XML input files or specialized applications.
FhSim is built especially to satisfy the following conditions:
The various FhSim Model libraries collect FhSim models in pre-compiled libraries. Some libraries will be publicly available, some are closed and other have their own licensing terms, see Model libraries.
The FhSim API is written in C++. It is possible to write SimObjects in other languages, as long as it is possible to compile these into shared libraries or call them from the C language. The model development is, however, in practice usually done in C++, as existing methods make this the simplest choice.
The open source rendering engine Ogre3D is used for the visualization. Ogre3D is built into FhSim, and should not be installed by users of the FhSim libraries. For the basic usage of FhSim only a fundamental understanding of Ogre3D is needed.
To fulfill the goals of being embeddable and fast, while giving the opportunity to use visualization either as a mean for simpler model development or for presentation of results, the API is compiled in two configurations; one with, and one without visualization. The structure without visualization is shown in the figure below.
If the API is compiled with visualization capabilities, the only change is that additional methods are called. In practice, this is done by checking for the preprocessor definition FH_VISUALIZATION
. If this is defined, the visualization methods are used, if not they are omitted. The next figure shows the additional components that are added if compiled with visualization, and which of the original components that are affected.
For details, please refer to Software components.
Complex systems are modeled as a set of objects with input ports, output ports and parameters. Each of these objects is referred to as a SimObject
, short for simulation object. A SimObject implements its own differential equations. Several SimObjects are connected through their input and output ports. The connections between the different SimObjects are defined through input files and/or xml strings.
The FhSim API is written in C++. The SimObjects are usually also written in C++ and compiled into a loadable shared library (dll or so). It is possible to write SimObjects in other languages, as long as it is possible to compile these into shared libraries or call them from the C language. The model development is, however, in practice usually done in C++, as existing methods make this the simplest choice.
To fulfill the goals of being embeddable and fast, the visualization API can be disabled a compile time.
To facilitate greater adoption and easier integration with other software, FhSim is in the process of being made available for the public. The license terms are therefore also changing. Currently, the license terms are different for distinct parts of FhSim. Some elements are available for academic use, others available for everyone, while yet other elements are only available for paying customers.
The source code for the FhSim main code base will be made available both as an assurance for its users, simplify development and to facilitate extending it as desired.