Implement user-written subroutines in C
The method you use to implement user-written subroutines in the C programming language depends on the source files you choose to run the simulation. To generate a DLL automatically, use the USER1.c file that contains the C source code in the run directory. To use a generated DLL that you can share with others users, use the tmgopen_user.dll(so) file.
- Add the INPF file to your run directory.
-
Verify that the INPF file contains and ends with:
PARAM USERDLL -1 -1
- Add the USER1.c file to the run directory.
-
(Optional) To use a DLL that you can share with others users, generate the tmgopen_user.dll(so) file as follows:
- Add the createUserDllC.cmd (Windows) or createUserDllC.com (Linux) scripts to the run directory.
- Run the script without any arguments in the run directory.
- Delete the USER1.c file.
During the run, the tmgopen_user.dll(so) file will be used according to its implemented functionality instead of generating the DLL automatically from the USER1.c file.
- Run the simulation.