Difference between revisions of "Van der Pol Oscillator (JModelica)"
From mintOC
(Created page with "This page contains the source code to solve the Van der Pol Oscillator problem with JModelica. The automatic differentiation tool CasADI and the solver IPOPT were used to solv...") |
FelixMueller (Talk | contribs) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | This page contains the source code to solve the Van der Pol Oscillator problem with JModelica. The automatic differentiation tool CasADI and the solver IPOPT were used to solve the problem. | + | This page contains the source code to solve the [[Van der Pol Oscillator]] problem with JModelica. The automatic differentiation tool CasADI and the solver IPOPT were used to solve the problem. |
− | <source lang=" | + | Model file (VDP_Opt.mop) |
− | + | <source lang="Optimica"> | |
− | + | //------------------------------------------------------------------------- | |
− | + | //Van der Pol Oscillator with direct collocation using JModelica | |
− | + | //(c) Madeleine Schroter | |
+ | //-------------------------------------------------------------------------- | ||
optimization VDP_Opt(objectiveIntegrand = y^2+x^2+u^2, startTime = 0, finalTime = 20) | optimization VDP_Opt(objectiveIntegrand = y^2+x^2+u^2, startTime = 0, finalTime = 20) | ||
Line 27: | Line 28: | ||
</source> | </source> | ||
+ | |||
+ | Run file | ||
+ | <source lang ="Python"> | ||
+ | #Import the function for transfering a model to CasADiInterface | ||
+ | from pyjmi import transfer_optimization_problem | ||
+ | |||
+ | op=transfer_optimization_problem("VDP_Opt", "VDP_Opt.mop") | ||
+ | |||
+ | res=op.optimize() | ||
+ | |||
+ | </source> | ||
+ | |||
+ | [[Category:JModelica]] |
Latest revision as of 14:58, 19 January 2016
This page contains the source code to solve the Van der Pol Oscillator problem with JModelica. The automatic differentiation tool CasADI and the solver IPOPT were used to solve the problem.
Model file (VDP_Opt.mop)
//------------------------------------------------------------------------- //Van der Pol Oscillator with direct collocation using JModelica //(c) Madeleine Schroter //-------------------------------------------------------------------------- optimization VDP_Opt(objectiveIntegrand = y^2+x^2+u^2, startTime = 0, finalTime = 20) //The states Real x(start=1, fixed=true); //position coordinate Real y(start=0, fixed=true); //The control signal input Real u; //damping of the oscillation equation der(y) = (1-x^2) * y - x +u; der(x) = y; constraint u<=0.75; end VDP_Opt;
Run file
#Import the function for transfering a model to CasADiInterface from pyjmi import transfer_optimization_problem op=transfer_optimization_problem("VDP_Opt", "VDP_Opt.mop") res=op.optimize()