pik1432

230 Reputation

6 Badges

3 years, 342 days

MaplePrimes Activity


These are replies submitted by pik1432

Hello all, 

Thank you for all your answers. The attached worksheet is the recap of them. 

@Thomas Richard , yes there are different ways of addressing the issue. The last portion of the attached worksheet shows one possbiel way

restart;

with(LinearAlgebra):

interface(imaginaryunit=j):

Amat := Matrix(2, 2, [[-0.1428571428*K__D, -0.1081971238], [376.9911185, 0]]);

Matrix(2, 2, {(1, 1) = -.1428571428*`#msub(mi("K"),mi("D",fontstyle = "normal"))`, (1, 2) = -.1081971238, (2, 1) = 376.9911185, (2, 2) = 0})

(1)

A_eig := Eigenvalues(Amat);

Vector(2, {(1) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`+0.2000000000e-9*sqrt(0.1275510203e18*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-0.1019733868e22), (2) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`-0.2000000000e-9*sqrt(0.1275510203e18*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-0.1019733868e22)})

(2)

Desired := sqrt((2.000000000*10^(-10))^2 * (1.275510203*10^17*K__D^2 - 1.019733868*10^21));

(0.5102040812e-2*K__D^2-40.78935472)^(1/2)

(3)

# by C_R

(identify@expand@factor)~(A_eig);

Vector(2, {(1) = -(1/14)*`#msub(mi("K"),mi("D",fontstyle = "normal"))`+(1/14)*sqrt(`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-7994.713532), (2) = -(1/14)*`#msub(mi("K"),mi("D",fontstyle = "normal"))`-(1/14)*sqrt(`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-7994.713532)})

(4)

# by Acer

evalindets(A_eig, &*(float,`+`^(1/2)),u->signum(op(1,u))*(op([2,1],u)*op(1,u)^2)^(1/2));

Vector(2, {(1) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`+sqrt(0.5102040812e-2*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-40.78935472), (2) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`-sqrt(0.5102040812e-2*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-40.78935472)})

(5)

# for Thomas Richard

restart;

with(LinearAlgebra):

with(DynamicSystems):

interface(imaginaryunit=j):

A11 := -K__D / (2*H_gen);

-(1/2)*K__D/H_gen

(6)

A12 := -K__S / (2*H_gen);

-(1/2)*K__S/H_gen

(7)

A21 := omega__0;

omega__0

(8)

A22 := 0;

0

(9)

Amat := <<A11|A12>,<A21|A22>>;

Matrix(2, 2, {(1, 1) = -(1/2)*K__D/H_gen, (1, 2) = -(1/2)*K__S/H_gen, (2, 1) = `&omega;__0`, (2, 2) = 0})

(10)

Bmat := <1/(2*H_gen), 0>;

Vector(2, {(1) = (1/2)/H_gen, (2) = 0})

(11)

sys_gen := StateSpace(Amat, Bmat);

Amat_eigenVals := Eigenvalues(Amat);

Vector(2, {(1) = -(1/4)*(K__D-sqrt(-8*H_gen*K__S*`&omega;__0`+K__D^2))/H_gen, (2) = -(1/4)*(K__D+sqrt(-8*H_gen*K__S*`&omega;__0`+K__D^2))/H_gen})

(12)

char_poly_gen := CharacteristicPolynomial(sys_gen);

s^2+(1/2)*K__D*s/H_gen+(1/2)*omega__0*K__S/H_gen

(13)

# Given system parameters

Freq := 60;

60

(14)

sys_MVA_base := MVA * 4;

4*MVA

(15)

H_genx := 3.5;

3.5

(16)

omega__0x := evalf(2*Pi*Freq);

376.9911185

(17)

P_gen := 0.9; # in pu

.9

(18)

Q_gen := 0.3; # in pu

.3

(19)

E__t := polar(1.0, convert(36*degrees, radians));

polar(1.0, (1/5)*Pi)

(20)

E__b := polar(0.995, convert(0*degrees, radians));

polar(.995, 0)

(21)

Xd__p := j * 0.3;

.3*I

(22)

Xtr := j * 0.15;

.15*I

(23)

Xckt1 := j * 0.5;

.5*I

(24)

Hgen := 3.5;

3.5

(25)

######

I__t := conjugate(P_gen +j*Q_gen) / abs(E__t);

.9000000000-.3000000000*I

(26)

Xd__p * I__t;

0.9000000000e-1+.2700000000*I

(27)

abs(E__t) + Xd__p * I__t;

1.090000000+.2700000000*I

(28)

E__p := convert(abs(E__t) + Xd__p * I__t, polar);

polar(1.122942563, .2428188393)

(29)

temp := convert(argument(E__p), degrees);

13.91249468*degrees

(30)

delta__0 := 36*degrees + temp;

49.91249468*degrees

(31)

X__T := Xd__p + Xtr + Xckt1;

.95*I

(32)

# from eq. 12.76

K__Sx := (abs(E__p) * abs(E__b) / abs(X__T)) * cos (convert(delta__0, radians));

.7573798663

(33)

Amat_eigenValsNumeric := subs({H_gen=H_genx, K__S=K__Sx, omega__0 = omega__0x}, Amat_eigenVals);

Vector(2, {(1) = -0.7142857142e-1*K__D+0.7142857142e-1*sqrt(K__D^2-7994.713520), (2) = -0.7142857142e-1*K__D-0.7142857142e-1*sqrt(K__D^2-7994.713520)})

(34)

 

Download Q20230110_m1_answers.mw

I tried. 

Thank you for your valuable answers, Carl Love and Christian Wolinski!

Here is the recap of your answers. 

restart;

with(LinearAlgebra):

interface(imaginaryunit=j):

eq_5_22 := Psi__ad = -L__ad*L__fd*i__d*1/(L__ad + L__fd) + L__ad*Psi__fd*1/(L__ad + L__fd);

Psi__ad = -L__ad*L__fd*i__d/(L__ad+L__fd)+L__ad*Psi__fd/(L__ad+L__fd)

(1)

eq_5_23x := L__ad__p = 1 / (1/L__ad + 1/L__fd);

L__ad__p = 1/(1/L__ad+1/L__fd)

(2)

eq_5_23 := L__ad__p = evala(rhs(eq_5_23x));

L__ad__p = L__ad*L__fd/(L__ad+L__fd)

(3)

eq_5_22a := Psi__ad = collect(expand(solve(eq_5_18x, Psi__ad)), rhs(eq_5_23)); # error

Error, invalid input: expand expects 1 argument, but received 0

 

eq_5_22_desired := Psi__ad = -L__ad__p*i__d + L__ad__p*Psi__fd/L__fd;

Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd

(4)

# from Carl Love - 1

solve(eq_5_23, {L__ad}); # step 1

{L__ad = L__ad__p*L__fd/(L__fd-L__ad__p)}

(5)

eval(eq_5_22, %); # step 2

Psi__ad = -L__ad__p*L__fd^2*i__d/((L__fd-L__ad__p)*(L__ad__p*L__fd/(L__fd-L__ad__p)+L__fd))+L__ad__p*L__fd*Psi__fd/((L__fd-L__ad__p)*(L__ad__p*L__fd/(L__fd-L__ad__p)+L__fd))

(6)

simplify(%); # step 3

Psi__ad = -(L__fd*i__d-Psi__fd)*L__ad__p/L__fd

(7)

expand(%); # step 4

Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd

(8)

expand(simplify(eval(eq_5_22, solve(eq_5_23, {L__ad})))); # single line - combined

Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd

(9)

# from Carl Love - 2

expand(simplify(eq_5_22, {eq_5_23}, [L__ad])); # using simplify/siderels

Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd

(10)

# from Christian Wolinski

convert(eliminate({eq_5_23, eq_5_23x, eq_5_22}, {Psi__ad, L__ad})[1], parfrac, L__fd);

{L__ad = L__ad__p+L__ad__p^2/(L__fd-L__ad__p), Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd}

(11)

 

Download Q20220812_w_Answers2.mw

@acer You are absolutely right. It does matter!

@acer Thank you for the answer and the way of using the collect command with no recursion. As noted in the answer to 'tomleslie', it did not matter to me whether the notation 'p' is treated as a function call or a standalone multiplicative factor. 

@tomleslie Thank you for the extra note. The purpose is to check the steps of deriving the final expression, from a series of expressions given in a text book, there is practically no distinction between the two. In other words, if a way becomes preferrable, then it would be utilized for the necessary facilitation. 

Yes. the p() with the 'Delta*delta' causes the blockage. Perhaps one way to go around it is to re-write that part from p(Delta*delta) as p*(Delta*delta), which worked with the nested 'collect' command. 

@Carl Love Thank you for your correction and sorry for my misunderstanding. 

Here is the comparison. '1' is your correction, while '2' shows my misunderstanding. 

 

######

# 1

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):

_Envdiffopdomain:=[Dt,t]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*Dt*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*Dt*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(1)

diffop2de(eq_e5_9, f(t));

psi__d0*Delta__delta(t)*f(t)+psi__q0*Delta__delta(t)*(diff(f(t), t))/omega__0 = (p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(t)

(2)

######

# 2

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):

_Envdiffopdomain:=[Dt,t]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(3)

diffop2de(eq_e5_9, f(t));

(psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0)*f(t) = (p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(t)

(4)

 


 

Download Q20220428.mw

 

@Carl Love : Thank you for your answer. I was able to re-iterate it by using the attached worksheet (below). 

However, still, my question is not fully addressed yet. What I wanted to achieve is the expression labeled as  '(e5.13p) ' in the attached PDF file('Ex5_1_simple.pdf'). Then, if the differentiator operator works as expected, those differentiations associated with constants would go away by themselves. 

######

# 1

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):

_Envdiffopdomain:=[Dt,t]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(1)

diffop2de(eq_e5_9, f(t));

(psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0)*f(t) = (p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(t)

(2)

######

# 2

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(3)

diffop2de(eq_e5_9, f(t));

Error, (in DEtools/diffop2de) differential algebra not specified

 

######

# 3

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):

_Envdiffopdomain:=[Dx,x]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(4)

diffop2de(eq_e5_9, f(t));

(psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0)*f(x) = (p_*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(x)

(5)

 

Download Q20220427.mw

Ex5_1_simple.pdf

@acer: Thank you for your point. I should have thought that when I posted the question. 

Regarding the desired form, please have a look at the following worksheet. 

 
 

######

# E5.13 - 3

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):
_Envdiffopdomain:=[Dt,t]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = D*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = D*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(1)

diffop2de(eq_e5_9, f(t));

(psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0)*f(t) = (D*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(t)

(2)

eq_e5_9_disired := psi__d0*Delta__delta(t) + psi__q0/omega__0*diff(Delta__delta(t),t) = 1/omega__0*diff(Delta__psi__d(t),t) - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*(diff(Delta__delta(t), t))/omega__0 = (diff(Delta__psi__d(t), t))/omega__0-Delta__psi__q(t)

(3)

 


 

Download Q20220426.mw

@acer Thank you for your message and sorry for that missing worksheet. I thought I attached it, but perhaps something went wrong. Here is the worksheet file. 

######

# E5.13 - 2

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):
_Envdiffopdomain:=[Dt,t]:

eq_e5_9 := psi__d0*Delta__delta(t) + psi__q0*D*Delta__delta(t)/omega__0 = D*Delta__psi__d(t)/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0 = D*Delta__psi__d(t)/omega__0-Delta__psi__q(t)

(1)

diffop2de(eq_e5_9, f(t));

(psi__d0*Delta__delta(t)+psi__q0*D*Delta__delta(t)/omega__0)*f(t) = (D*Delta__psi__d(t)/omega__0-Delta__psi__q(t))*f(t)

(2)

 

Download Q20220425.mw

@Carl Love Thank you for the further explanation. Sorry, I should have noticed that the 'unprotect/protect' commands should precede the 'with(DEtools)', Now it works.

restart;

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

with(DEtools):
_Envdiffopdomain:=[Dt,t]:

 

xxx := psi__d0 + psi__q0*Dt/omega__0 = 1/omega__0 - 1;

psi__d0+psi__q0*Dt/omega__0 = 1/omega__0-1

(1)

xxx_1 := lhs(xxx) - rhs(xxx);

psi__d0+psi__q0*Dt/omega__0-1/omega__0+1

(2)

 

xxx_a := diffop2de(xxx, f(t));

psi__d0*f(t)+psi__q0*(diff(f(t), t))/omega__0 = (1/omega__0-1)*f(t)

(3)

xxx_1_a := diffop2de(xxx_1, f(t));

(psi__d0-1/omega__0+1)*f(t)+psi__q0*(diff(f(t), t))/omega__0

(4)

 

Download LDOs_m3.mw

@Carl Love Thank you for the informative answer. However, I'm afraid the error still persists. The attached worksheet is my attempt with the suggested routine. 

restart;

with(DEtools):
_Envdiffopdomain:=[Dt,t]:

 

xxx := psi__d0 + psi__q0*Dt/omega__0 = 1/omega__0 - 1;

psi__d0+psi__q0*Dt/omega__0 = 1/omega__0-1

(1)

xxx_1 := lhs(xxx) - rhs(xxx);

psi__d0+psi__q0*Dt/omega__0-1/omega__0+1

(2)

unprotect(DEtools):
DEtools[diffop2de]:= L->
    `if`(L::algebraic, `DEtools/diffop2de`, curry(map, procname))(args):
protect(DEtools):

xxx_a := diffop2de(xxx, f(t));

Error, (in DEtools/diffop/to_eqn) unable to compute coeff

 

 

xxx_1_a := diffop2de(xxx_1, f(t));

(psi__d0-1/omega__0+1)*f(t)+psi__q0*(diff(f(t), t))/omega__0

(3)

 

Download LDOs_m2.mw

@tomleslie if you don't mind, is there any chance to ask this one following up question?

What would the reason for the expression 'xxx_a' turning out as an error, while the next expression 'xxx_1_a' is completed successfully, in the attached worksheet?

restart;

with(DEtools):
_Envdiffopdomain:=[Dt,t]:

xxx := psi__d0 + psi__q0*Dt/omega__0 = 1/omega__0 - 1;

psi__d0+psi__q0*Dt/omega__0 = 1/omega__0-1

(1)

xxx_1 := lhs(xxx) - rhs(xxx);

psi__d0+psi__q0*Dt/omega__0-1/omega__0+1

(2)

xxx_a := diffop2de(xxx, f(t));

Error, (in DEtools/diffop/to_eqn) unable to compute coeff

 

xxx_1_a := diffop2de(xxx_1, f(t));

(psi__d0-1/omega__0+1)*f(t)+psi__q0*(diff(f(t), t))/omega__0

(3)

 

Download LDOs_m1.mw

@acer Thank you for your answer, using 'eval' command!

I found a command 'assign' working for the purpose.

Q20220416_m1.mw 

 

1 2 3 4 5 6 7 Page 1 of 8