|
FhSim
3.1.0
Marine systems simulation
|
FhSim can be driven from software you write yourself, instead of from the standalone executables. Three routes exist, and this section covers all three.
| Embed the shared library | Export an FMU | Run the standalone executable | |
|---|---|---|---|
| Control granularity | Per step, or per slice of model time. The host sets inputs, advances, and reads outputs in its own loop. | Per co-simulation communication point, decided by the FMI master, not by you. | None during the run. The scenario runs start to finish. |
| Deployment model | Your program loads fhSimDll/fhVisDll from an FhSim installation at runtime. | A single .fmu file that bundles the FhSim binaries and resources it needs. | An FhSim installation plus your XML. |
| What the host must provide | C++ code that loads the library, and one System/ExternalLinkStandard object in the model for data exchange. | An FMI 2.0 co-simulation master. The model needs an ExternalLinkStandard object; FhFmuExport can synthesise one with --guess-input-interface / --guess-output-interface. | Nothing but the XML scenario. Results come out through the observers configured in it. |
| How results come out | Return values of the port and state calls, in process. | FMI variables read by the master. | Observer output files configured in the XML. |
| Limits | The host and the library must be built for the same platform and ABI. | FMI 2.0 co-simulation only. The exported FMU contains binaries only for the platform the exporter was built on, and only the 64-bit platforms are actively maintained. | No interaction with a host program. |
Start here: if you only need results out of a scenario, use the standalone executable and an observer — see Running simulations. Add one of the API routes only when your own software has to be inside the loop. Of those two, embed the shared library when you own the host program and it is C++; export an FMU when the model has to plug into someone else's co-simulation tool.
System/ExternalLinkStandard SimObject in the model, whose input ports the host writes and whose output ports the host reads. A model with no such object can be run, but not steered.