The C Function block is available for the inputted file made by Julia code or C code which user defined.
•The function format of C Function has to be extern "C" __declspec(dllexport) int __cdecl C_Function(double *y, double *u) and the solver calls only C_Function in the C code. Here, y is the outputted array and u is the inputted array. The return value is the error code and it will be used later on.
extern "C" __declspec(dllexport) int __cdecl C_Function(double* y, double* u) { y[0] = 2.5*u[0]; y[1] = 2.0*u[1]; return 1; } |
•The function format of Julia Function has to be function Jl_Function(y, u) and the solver calls only “Jl_Function” function in the Julia code. Here, y is the output array and u is the input array. The return value is the error code and it will be used later on.
function Jl_Function( y,
u) #y : output from the
block y[2] =
2.0*u[2] |
To see the contents supported the Julia Script.
Dialog box
Figure 1 C Function dialog box
Parameters
Parameter(s) |
Description |
Input Data Size |
Enters the number of inputted double value |
Output Data Size |
Enters the number of outputted double value |
Type |
When the user uses the Julia code, select “Jl Function” and when the user uses the DLL, select “C DLL”. |
File |
When Type is the “Jl Function”, the Jl file can be selected. when Type is “C DLL”, the DLL file can be selected. |