DLL Block
The general DLL block allows users to write code in C or C++, compile it as a Windows DLL, and link it to DSIM. There are four exported functions. Three of them are used by the DSIM simulation engine, and one is used by the user interface.
DLL Block in DSIM
In this case, the DLL element, discrete controlled current source, and voltage sensor are employed to model a custom inductor. DLL element takes the measured voltage of voltage sensor as input, realizes the mathematical model of inductance using C++, and connects to the power circuit with the controlled current source. In order to validate the accuracy of the modeling, the voltage and current characteristics of the DLL custom inductor are compared with the inductor of the same inductance in the same circuit.
The following figure shows the current and voltage contrast curves of the DLL custom inductor and the inductor of the same inductance respectively.
A Case of the DLL Block
The user interface function is REQUESTUSERDATA. The three simulation functions are: SimulationStep, SimulationBegin, and SimulationEnd. There are two additional functions: GetDSIMValue and GetDSIMText that can be called in the simulation functions to retrieve information such as time step, total time, schematic file path, and other circuit parameters. Each function has the non‐Unicode version and the Unicode version.
● Parameters:
| File | Name of the DLL file. |
| Data | Input data file of the DLL routine, save as the last element of the array pszParameters[nParameterCount - 1] (optional) |
| Number of Input Nodes | Number of input nodes (optional) |
| Number of Output Nodes | Number of output nodes (optional) |
| Variables | Parameters passed into the DLL routine, save as the element of the array pszParameters (optional) |