Skip to content

Commit

Permalink
use import instead of redefinitions of functions and constants
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke committed Mar 2, 2015
1 parent bb0593f commit d70808e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions PowerSystems/Basic/Math.mo
Expand Up @@ -12,7 +12,7 @@ package Math "Mathematical functions"
protected
Real c;
Real s;
function atan2=Modelica.Math.atan2;
import Modelica.Math.atan2;

algorithm
c := cos(-alpha);
Expand All @@ -34,7 +34,7 @@ for arbitrary (time-dependent) input argument alpha.</p>
input Real[2] x_dot "time-derivative of x";
output Real omega "angular velocity of x";
protected
constant Real eps = Modelica.Constants.eps;
import Modelica.Constants.eps;

algorithm
omega :=(x[1]*x_dot[2] - x_dot[1]*x[2])/(x*x + eps);
Expand Down Expand Up @@ -191,7 +191,7 @@ The table contains the argument-vector as first column xy_tab[1,:].</p>
Integer n0;
Real[N, N] A;
Real[N+1] C;
function eigenval = Modelica.Math.Matrices.eigenValues;
import Modelica.Math.Matrices.eigenValues;

algorithm
N0 := N "determine true degree of polymomial";
Expand All @@ -214,7 +214,7 @@ The table contains the argument-vector as first column xy_tab[1,:].</p>
A[2:n,1:n-1] := diagonal(ones(n-1));
A[2:n,n] := zeros(n-1);
r[1:n0,:] := zeros(n0,2);
r[n0+1:n0+n,:] := eigenval(A[1:n, 1:n]);
r[n0+1:n0+n,:] := eigenValues(A[1:n, 1:n]);
end if;
annotation (Documentation(info="<html>
<p>The function determines the root vector r of a polynomial of degree N with coefficient vector c.</p>
Expand Down
18 changes: 9 additions & 9 deletions PowerSystems/Basic/Precalculation.mo
Expand Up @@ -527,12 +527,12 @@ with real time constants <tt>T</tt>. It calculates the <tt>n</tt> coefficients o
output SI.Angle[size(a,1)] T "time constant";
output Boolean Tisreal "true if all time constants real";
protected
constant Real eps=Modelica.Constants.eps;
import Modelica.Constants.eps;
parameter Integer n=size(a,1);
Real[n, n] A;
Real[n,2] lam "2nd index=1:2, real and imaginary part";
function eigenValues = Modelica.Math.Matrices.eigenValues;
function sortDown = PowerSystems.Basic.Math.sortDown;
import Modelica.Math.Matrices.eigenValues;
import PowerSystems.Basic.Math.sortDown;

algorithm
A[1, 1:n] := -cat(1, a[n-1:-1:1], {1})/a[n];
Expand Down Expand Up @@ -728,7 +728,7 @@ It determines first the root vector <pre> r[k] = -1/T[k], k in 1:n</p> and here
Real[n] gsig_prx;
Real dasig;
Real dgsig;
function inv = Modelica.Math.Matrices.inv;
import Modelica.Math.Matrices.inv;

algorithm
iter := 0;
Expand Down Expand Up @@ -817,7 +817,7 @@ A different choice is not meaningful, as long as we only have 2 parameters (comp
Real[n] Tsig;
Real[n] xsig;
Boolean result;
function fminSearch = PowerSystems.Basic.Math.fminSearch;
import PowerSystems.Basic.Math.fminSearch;

algorithm
if n==0 then
Expand Down Expand Up @@ -903,7 +903,7 @@ A different choice is not meaningful, as long as we only have 2 parameters (comp
Real[n] Tsig;
Real dif;
Boolean result;
function fminSearch = PowerSystems.Basic.Math.fminSearch;
import PowerSystems.Basic.Math.fminSearch;

algorithm
xm := cat(1, zeros(n), {x - xsig_s});
Expand Down Expand Up @@ -952,15 +952,15 @@ A different choice is not meaningful, as long as we only have 2 parameters (comp
output SI.Angle[n] To "time constant open-loop";
output SIpu.Reactance[n] xtr(each unit="1") "transient reactance";
protected
constant Real eps=Modelica.Constants.eps;
import Modelica.Constants.eps;
Real[n+1] xm;
Real[n+1,n+1] X;
Real[n,n] X11;
Real[n,n] X11ac;
Real[n] sRinv;
Real[n,2] lam "2nd index=1:2, real and imaginary part";
function eigenValues = Modelica.Math.Matrices.eigenValues;
function sortDown = PowerSystems.Basic.Math.sortDown;
import Modelica.Math.Matrices.eigenValues;
import PowerSystems.Basic.Math.sortDown;

algorithm
xm := cat(1, {0}, xm2_n, {x - xsig_s});
Expand Down

0 comments on commit d70808e

Please sign in to comment.