- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Non linear equation system
Non linear equation system
Non linear equation system
Hi,
Im an engineering student in France working on the simulation of load flow on power grids in permanent state (no time involved)
I have a non-linear equation system to solve ( non linearity comes from sine and cosine). I am new to OpenModelica, so can anyone help me with this? is OpenModelica able to solve the system all by itself or should i program the algorithm (in this case Newton-Raphson) ?
Thanks
Re: Non linear equation system
Code:
class A
Real c = 0.2;
Real x = (1-c)*sin(x) + c*cos(x);
end A;
-or-
Code:
class A
parameter Real c = 0.2;
Real x = (1-c)*sin(x) + c*cos(x);
end A;
The first example solves the equation in each time step (using the previous value as an initial guess, so it basically only verifies that the equation is solved in all time steps except the first). It uses Powell's Hybrid method.
The second examples solves the non-linear equation during initialization. The default initialization method uses simplex.
Note that a Modelica tool is free to choose any algorithm it wants to solve an equation system, and tool-specific tweaks need to be used if you need to change the defaults
- sjoelund.se
- 1700 Posts
Re: Non linear equation system
Modelica is a simulation language and therefore is designed to solve over time.
However, maybe it is good enough to solve load flow equations in the initial equation section.
For instance the following simple two equation set finds "gammaBase" and "wElBase" that are the optimal gamma angle and the electrical base speed of a permanent-magnet synchronous electric drive, for nominal current Inom (maybe as an electric engineering student you know what I mean).
Vnom, Inom, Ld, Lq, IpmRMS are known in advance. They play the role of resistances and inductances in load flow, while gammaBase and wElBase are the unknowns (they can be for instance theta and V in a P-Q node in a load flow problem)
Code:
parameter Real Vnom, Ld, Psi, Lq;
parameter Real nBase(fixed=false), gammaBase(fixed=false);
initial equation
Unom^2 = wElBase^2*((Ld*(IpmRMS - Inom)*sin(gammaBase))^2 + (Lq*Inom*cos(
gammaBase))^2);
0 = (-Ld*IpmRMS*sin(gammaBase)) + (Lq - Ld)*Inom*cos(2*gammaBase);
- ceraolo
- 147 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Non linear equation system