Skip to content

Commit e015604

Browse files
committed
remove unnecessary conditional equations from transformer models
1 parent 61d1c37 commit e015604

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

PowerSystems/AC1ph_DC/Transformers.mo

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ and eddy current losses.</p>
268268
annotation(Evaluate=true, Dialog(tab="Initialization"));
269269
parameter SI.Current i1_start = 0 "start value of primary current"
270270
annotation(Dialog(tab="Initialization"));
271-
parameter SI.Current i2_start = i1_start "start value of secondary current"
271+
parameter SI.Current i2_start = i1_start
272+
"start value of secondary current"
272273
annotation(Dialog(tab="Initialization"));
273274

274275
parameter Boolean dynTC=false "enable dynamic tap-changing" annotation(Evaluate=true, choices(__Dymola_checkBox=true));
@@ -308,9 +309,9 @@ and eddy current losses.</p>
308309
annotation(Evaluate=true);
309310
final parameter Real[:] W1=cat(1, {1}, par.v_tc1*V_base[1]/par.V_nom[1]) annotation(Evaluate=true);
310311
final parameter Real[:] W2=cat(1, {1}, par.v_tc2*V_base[2]/par.V_nom[2])*W_nom annotation(Evaluate=true);
311-
Real w1_set=if not use_tap_p then W1[1] else W1[1 + tap_p_internal]
312+
Real w1_set=W1[1 + tap_p_internal]
312313
"1: set voltage ratio to nominal primary";
313-
Real w2_set=if not use_tap_n then W2[1] else W2[1 + tap_n_internal]
314+
Real w2_set=W2[1 + tap_n_internal]
314315
"2: set voltage ratio to nominal primary";
315316

316317
initial equation
@@ -355,12 +356,11 @@ and eddy current losses.</p>
355356
Text(
356357
extent={{-120,80},{-80,40}},
357358
lineColor={0,0,0},
358-
textString=
359-
"1"),
359+
textString="1"),
360360
Text(
361361
extent={{80,80},{120,40}},
362362
lineColor={0,0,0},
363-
textString= "2"),
363+
textString="2"),
364364
Line(
365365
points={{-80,0},{-40,0}},
366366
color={176,0,0},
@@ -531,11 +531,11 @@ For variable transformer ratio tap changer input needed.</p>
531531
final parameter Real[:] W2a=cat(1, {1}, par.v_tc2a*V_base[2]/par.V_nom[2])*Wa_nom
532532
annotation(Evaluate=true);
533533
final parameter Real[:] W2b=cat(1, {1}, par.v_tc2b*V_base[3]/par.V_nom[3])*Wb_nom annotation(Evaluate=true);
534-
Real w1_set=if not use_tap_p then W1[1] else W1[1 + tap_p_internal]
534+
Real w1_set=W1[1 + tap_p_internal]
535535
"1: set voltage ratio to nominal primary";
536-
Real w2a_set=if not use_tap_n then W2a[1] else W2a[1 + tap_n_internal[1]]
536+
Real w2a_set=W2a[1 + tap_n_internal[1]]
537537
"2a: set voltage ratio to nominal primary";
538-
Real w2b_set=if not use_tap_n then W2b[1] else W2b[1 + tap_n_internal[2]]
538+
Real w2b_set=W2b[1 + tap_n_internal[2]]
539539
"2b: set voltage ratio to nominal primary";
540540

541541
initial equation
@@ -583,12 +583,11 @@ For variable transformer ratio tap changer input needed.</p>
583583
Text(
584584
extent={{-120,80},{-80,40}},
585585
lineColor={0,0,0},
586-
textString=
587-
"1"),
586+
textString="1"),
588587
Text(
589588
extent={{80,20},{120,-20}},
590589
lineColor={0,0,0},
591-
textString= "2"),
590+
textString="2"),
592591
Line(
593592
points={{-80,0},{-40,0}},
594593
color={176,0,0},

PowerSystems/AC3ph/Transformers.mo

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ Delta topology: impedance is defined as winding-impedance (see info package Tran
310310

311311
parameter Boolean stIni_en=true "enable steady-state initial equation"
312312
annotation(Evaluate=true, Dialog(tab="Initialization"));
313-
parameter SI.Current[3] i1_start = zeros(3) "start value of primary current"
313+
parameter SI.Current[3] i1_start = zeros(3)
314+
"start value of primary current"
314315
annotation(Dialog(tab="Initialization"));
315-
parameter SI.Current[3] i2_start = i1_start "start value of secondary current"
316+
parameter SI.Current[3] i2_start = i1_start
317+
"start value of secondary current"
316318
annotation(Dialog(tab="Initialization"));
317319

318320
parameter Boolean dynTC=false "enable dynamic tap-changing" annotation(Evaluate=true, choices(__Dymola_checkBox=true));
@@ -359,9 +361,9 @@ Delta topology: impedance is defined as winding-impedance (see info package Tran
359361
final parameter SI.Resistance R_n1=par.r_n1*RL_base[1,1];
360362
final parameter SI.Resistance R_n2=par.r_n2*RL_base[2,1];
361363
SI.AngularFrequency[2] omega;
362-
Real w1_set=if not use_tap_p then W1[1] else W1[1 + tap_p_internal]
364+
Real w1_set=W1[1 + tap_p_internal]
363365
"1: set voltage ratio to nominal primary";
364-
Real w2_set=if not use_tap_n then W2[1] else W2[1 + tap_n_internal]
366+
Real w2_set=W2[1 + tap_n_internal]
365367
"2: set voltage ratio to nominal secondary";
366368

367369
initial equation
@@ -662,11 +664,11 @@ For variable transformer ratio tap changer input needed.</p>
662664
final parameter SI.Resistance R_n2a=par.r_n2a*RL_base[2,1];
663665
final parameter SI.Resistance R_n2b=par.r_n2b*RL_base[3,1];
664666
SI.AngularFrequency omega[2];
665-
Real w1_set=if not use_tap_p then W1[1] else W1[1 + tap_p_internal]
667+
Real w1_set=W1[1 + tap_p_internal]
666668
"1: set voltage ratio to nominal primary";
667-
Real w2a_set=if not use_tap_n then W2a[1] else W2a[1 + tap_n_internal[1]]
669+
Real w2a_set=W2a[1 + tap_n_internal[1]]
668670
"2a: set voltage ratio to nominal secondary";
669-
Real w2b_set=if not use_tap_n then W2b[1] else W2b[1 + tap_n_internal[2]]
671+
Real w2b_set=W2b[1 + tap_n_internal[2]]
670672
"2b: set voltage ratio to nominal secondary";
671673

672674
initial equation

0 commit comments

Comments
 (0)