Skip to content

Commit a9ff8d0

Browse files
committed
fix variabilities of numbers of rotor circuits for AC3ph machine coefficients
1 parent abea7eb commit a9ff8d0

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

PowerSystems/AC3ph/Machines.mo

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,8 @@ More info see at 'Machines.Asynchron' and 'Machines.Synchron'.</p>
674674
annotation (Placement(transformation(extent={{-60,60},{
675675
-40,80}})));
676676
protected
677-
final parameter Integer n_r=if par.transDat then size(par.tc,1) else size(par.xsig_r,1)
678-
"number of rotor circuits d- and q-axis";
679-
final parameter Coefficients.Asynchron c=Basic.Precalculation.machineAsyn(
680-
par,n_r,top.scale);
677+
final parameter Integer n_r = par.n_r "number of rotor circuits d- and q-axis";
678+
final parameter Coefficients.Asynchron c = Basic.Precalculation.machineAsyn(par, top.scale);
681679
parameter SI.Inductance L_m[n_r] = c.L_m;
682680
parameter SI.Resistance R_r[n_r] = c.R_r;
683681
parameter SI.Resistance R_m[n_r] = c.R_m;
@@ -957,12 +955,9 @@ where <tt>psi_pm</tt> relates to the induced armature voltage <tt>v_op</tt> at o
957955
"machine parameter"
958956
annotation (Placement(transformation(extent={{-60,60},{-40,80}})));
959957
protected
960-
final parameter Integer n_d=if par.transDat then size(par.tc_d,1) else size(par.xsig_rd,1)
961-
"number of rotor circuits d-axis";
962-
final parameter Integer n_q=if par.transDat then size(par.tc_q,1) else size(par.xsig_rq,1)
963-
"number of rotor circuits q-axis";
964-
final parameter Coefficients.Synchron c=Basic.Precalculation.machineSyn(
965-
par,n_d,n_q,top.scale);
958+
final parameter Integer n_d = par.n_d "number of rotor circuits d-axis";
959+
final parameter Integer n_q = par.n_q "number of rotor circuits q-axis";
960+
final parameter Coefficients.Synchron c = Basic.Precalculation.machineSyn(par, top.scale);
966961
parameter SI.Inductance[n_d, n_d] L_rd = c.L_rd "L matrix rotor";
967962
parameter SI.Inductance[n_q, n_q] L_rq = c.L_rq "L matrix rotor";
968963
parameter SI.Inductance[n_d] L_md = c.L_md "L matrix mutual d-axis";

PowerSystems/Basic/Precalculation.mo

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,11 @@ The secondary side is winding-reduced to the primary, as the equations are writt
346346

347347
input AC3ph.Machines.Parameters.Asynchron p
348348
"parameters asynchronous machine";
349-
input Integer n_r "number of rotor circuits";
350349
input Integer scale=1 "scaling factor topology (Y:1, Delta:3)";
351-
output AC3ph.Machines.Coefficients.Asynchron c(n_r=n_r)
350+
output AC3ph.Machines.Coefficients.Asynchron c(n_r=p.n_r)
352351
"coefficient matrices asynchronous machine";
353352
protected
353+
final parameter Integer n_r=p.n_r "number of rotor circuits";
354354
final parameter SI.AngularFrequency omega_nom=2*pi*p.f_nom;
355355
final parameter Real[2] RL_base=Basic.Precalculation.baseRL(
356356
p.puUnits, p.V_nom, p.S_nom, omega_nom, scale)
@@ -425,13 +425,13 @@ See also equivalent circuit on 'Diagram layer' of
425425
extends PowerSystems.Basic.Icons.Function;
426426

427427
input AC3ph.Machines.Parameters.Synchron p "parameters synchronous machine";
428-
input Integer n_d "number of rotor circuits d-axis";
429-
input Integer n_q "number of rotor circuits q-axis";
430428
input Integer scale=1 "scaling factor topology (Y:1, Delta:3)";
431-
output AC3ph.Machines.Coefficients.Synchron c(n_d=n_d, n_q=n_q)
429+
output AC3ph.Machines.Coefficients.Synchron c(n_d=p.n_d, n_q=p.n_q)
432430
"coefficient matrices synchronous machine";
433431

434432
protected
433+
final parameter Integer n_d=p.n_d "number of rotor circuits d-axis";
434+
final parameter Integer n_q=p.n_q "number of rotor circuits q-axis";
435435
final parameter SI.AngularFrequency omega_nom=2*pi*p.f_nom;
436436
final parameter Real[2] RL_base=Basic.Precalculation.baseRL(
437437
p.puUnits, p.V_nom, p.S_nom, omega_nom, scale)
@@ -567,7 +567,7 @@ It determines first the root vector <pre> r[k] = -1/T[k], k in 1:n</p> and here
567567

568568
algorithm
569569
if n==0 then
570-
xtr:=fill(0, 0);
570+
xtr := fill(0, n);
571571
elseif n==1 then
572572
y[1] := -(Tc[1] - To[1])/Tc[1];
573573
xtr[1] := x/(1 + y[1]);
@@ -622,8 +622,8 @@ It determines first the root vector <pre> r[k] = -1/T[k], k in 1:n</p> and here
622622
Boolean Treal;
623623

624624
algorithm
625-
if n ==0 then
626-
To := fill(0,0);
625+
if n == 0 then
626+
To := fill(0, n);
627627
else
628628
y := x./xtr;
629629
y := y - cat(1, {1}, y[1:end-1]);
@@ -908,8 +908,8 @@ A different choice is not meaningful, as long as we only have 2 parameters (comp
908908
algorithm
909909
xm := cat(1, zeros(n), {x - xsig_s});
910910
if n==0 then
911-
r_r := fill(0,0);
912-
xsig_r := fill(0,0);
911+
r_r := fill(0, n);
912+
xsig_r := fill(0, n);
913913
else
914914
ac := polyCoef(Tc);
915915
ao := polyCoef(To);

0 commit comments

Comments
 (0)