.GNU_ScientificLibrary.Examples.integration.IntegrationUsersGuide

Information

IMPORTANT!!!: An integrand-setup model (e.g., 'ExampleIntegral.CreateIntegrand' or a duplicate) must be run before using GSL integration routines within a larger Modelica model. (Alternatively, one could edit integrand.c directly and then compile "by hand" in a command window:
gcc -fPIC -c integrand.c integration_mi.c
gcc -shared integration.o integration_mi.o -o libgsl_integration_MI.so  [.dll for windows])

Integrand-setup-model USAGE: To create an integrand, simply duplicate one of the example models (like 'CreateIntegrand') and change the String 'C_integrand' for the desired mathematical function in standard C-syntax. This setup model then needs to be "simulated" (it actually only copies/creates files, compiles and archives them) before the simulation of a larger model. The larger model may then include multiple uses of the relevant 'integrand' (e.g., in qag or other GSL integration routines).

example function:  c*e-p*x*x = c*exp(-p*x2
in C-syntax:      "par[0]*exp(-par[1]*x*x)" 

Note the possibility to place parameters (always with 'par' and always starting with index 0). The values of these can then be set during the larger model runtime (see the integration blocks). In other words, the parameters and the integration endpoints can be functions of time.

[A bit more info: If one is not already present in the model, a direct call to a GSL function appears to be required to have the GSL library load along with the GSL/Modelica interface ('gsl_integration_MI'). E.g.,... 
final parameter Real kludge = Functions.specfunc.gamma(1); 
These are put in at the integration function level, so no further action should be necessary on the user's part.] 

Generated at 2024-12-04T19:25:49Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos