Modeling complex phenomenon such as heat transfer or pressure drop sometimes requires using specific correlations representing companies’ know-how in the domain.
The code opening feature allows you replacing LMS Imagine.Lab Amesim standard correlations for heat transfer and pressure drop with your own ones (empirical or from literature) and share them with third parties while ensuring IP protection.
This feature is currently available for some generic heat transfer/pressure drop components and a generic tool was designed to help the user: the dynamic library compiler tool.
The dynamic library compiler tool guides you through the different steps of the external function creation:
When available, an “external user-defined function” option appears for heat exchange or pressure drop definition.
Selecting this option leads to a dedicated parameter group display.
This editable parameter group is composed of:
The "New" button allows loading and saving the source code skeleton.
A preview of the code is displayed in the tool (read-only).
The "Open" button allows browsing and opening a previously modified external function file.
The “Edit” button allows opening the source code into the preferred '.c' file editor for modification.
Find bellow an example reproducing the standard heat transfer correlation for circular pipe:
Note that the reserved zone for private code allows you focusing on the correlation definition. Inputs/outputs management is already handled by the skeleton.
A large number of available LMS Amesim documented public utilities can be directly used. Math expressions are recognized too.
Once modified, the external function has to be compiled to be well interpreted by the component at run time.
The compilation follows three steps:
Select an available compiler on your current installation.
Tips: Prefer using the same compiler as the one set for the sketch compilation.
Use the "Compile" button to launch the complete compilation process.
The compilation process appends the log window with every available information.
Tips: Those displayed information are important for compilation failure understanding and code correction.
Once created, the dynamic library embedding the external function is to be applied to the component.
Using the "Apply and close" button allows applying the file path to the dynamic library related text parameter.
As illustrated in this article, to create an external user-defined function in LMS Amesim, these steps must be followed:
This external function definition allows validating the implemented correlation at once and then sharing it. This file can be used into several components on a same sketch.