y = dlldynamic(filename,functionname,x);
Given a function (functionname) of a dll (filename), the dll function returns the output values (X) for a given input (Y).
Users can write their own source code using a native compiler such as Visual C++ or Borland C++. With these compilers it is possible to create DLL’s with user defined functions that have an input- output relation which can be embedded in simulation code.
string dllName = 'demoDynamicDll.dll';
string functionName = 'SFunctionCalculate';
x = [ramp(1);ramp(2)];
y = dlldynamic(dllName,functionName,x);
The filename and functionname must be string parameters. Note that the size of Y and X (scalars or matrices) must correspond with the size that is expected for the given dll-function.
20-sim uses the following search order for the dll-file:
|1.||The bin directory of 20-sim (usually C:\Program Files\20-sim 4.8\bin).|
|2.||The current directory.|
|3.||A directory that is entered in list of paths in the General Properties dialog (choose Tools - Options - Folders - DLL Search Paths). Use this option to store DLL's in a central location.|
|4.||The Windows system directory.|
|5.||The Windows directory.|
|6.||The directories that are listed in the PATH environment variable.|
The simplest place to put the dlldynamic-file is the bin directory, but it is always possible to give a complete path for the dll filename.
This function is not supported in Matlab M-code or C-code generation.