c_n_h

25 Reputation

3 Badges

0 years, 4 days

MaplePrimes Activity


These are replies submitted by c_n_h

@dharr 

Yes, I also thought this should be the default or at least easy to specify. But I haven't found anything.

Your solution works for overwriting names, thank you! That already helps a lot.

So far, my conclusion is as follows:

* There is so far no possibiliy to make the FeedbackConnect command use the correct names automatically.

* We can overwrite the names that the FeedbackConnect command chose.

* However, when overwriting the names, we must ensure that we use the correct names in the proper order manually.

Feel free to add information or correct mine.

@dharr thank you for your response.

I uploaded the script. Your solution for 1) is already integrated (it worked, thanks!) and I removed the q_d since it doesn't matter anyways.

# clean up

restart;

 

# add packages

with(DynamicSystems):

 

with(LinearAlgebra):

 

# set package options

SystemOptions('discretetimevar' = n)

q

(3)

 

# get systems

 

A_ss := <<a|b|c|d>,<e|f|g|h>,<i|j|k|l>,<m|n|o|p>>;

Matrix(4, 4, {(1, 1) = a, (1, 2) = b, (1, 3) = c, (1, 4) = d, (2, 1) = e, (2, 2) = f, (2, 3) = g, (2, 4) = h, (3, 1) = i, (3, 2) = j, (3, 3) = k, (3, 4) = l, (4, 1) = m, (4, 2) = n, (4, 3) = o, (4, 4) = p})

(4)

B_ss := <<q|r>,<s|t>,<u|v>,<w|x>>;

Matrix(4, 2, {(1, 1) = q, (1, 2) = r, (2, 1) = s, (2, 2) = t, (3, 1) = u, (3, 2) = v, (4, 1) = w, (4, 2) = x})

(5)

C_ss := <<1|0|0|0>,<0|1|0|0>,<0|0|1|0>,<0|0|0|1>>;

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1})

(6)

D_ss := <<0|0>,<0|0>,<0|0>,<0|0>>;

Matrix(4, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 0, (4, 1) = 0, (4, 2) = 0})

(7)

 

sys1 := StateSpace(A_ss,B_ss,C_ss,D_ss,inputvariable=[Q_u(t),u(t)],statevariable=[q_u(t),q_a(t),dq_u(t),dq_a(t)],
outputvariable=[q_u(t),q_a(t),dq_u(t),dq_a(t)],discrete=true,sampletime=T);

"module() ... end module"

(8)

sys2 := StateSpace([u(n)=K_virt*q_a(n)+D_virt*(q_a(n)-q_a(n-1))/T,q_a_delayed(n)=q_a(n-1)],
inputvariable=[q_a(n)],outputvariable=[u(n)],statevariable =[q_a_delayed(n)],discrete=true,sampletime=T);

"module() ... end module"

(9)

 

 

feedback12 := FeedbackConnect([sys1, sys2],[[2, 2, 1, -1]])

"module() ... end module"

(10)

 

# overview

PrintSystem(sys1)

"[[[`State Space`],[`discrete; sampletime = T`],[`4 output(s); 2 input(s); 4 state(s)`],[inputvariable=[Q_u(n),u(n)]],[outputvariable=[q_u(n),q_a(n),dq_u(n),dq_a(n)]],[statevariable=[q_u(n),q_a(n),dq_u(n),dq_a(n)]],[a=[[[a,b,c,d],[e,f,g,h],[i,j,k,l],[m,n,o,p]]]],[b=[[[q,r],[s,t],[u,v],[w,x]]]],[c=[[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]]],[d=[[[0,0],[0,0],[0,0],[0,0]]]]]"

(11)

PrintSystem(sys2)

"[[[`State Space`],[`discrete; sampletime = T`],[`1 output(s); 1 input(s); 1 state(s)`],[inputvariable=[q_a(n)]],[outputvariable=[u(n)]],[statevariable=[q_a_delayed(n)]],[a=[[[0]]]],[b=[[[1]]]],[c=[[[-D_virt/T]]]],[d=[[[(K_virt T+D_virt)/T]]]]]"

(12)

PrintSystem(feedback12)

"[[[`State Space`],[`discrete; sampletime = T`],[`4 output(s); 2 input(s); 5 state(s)`],[inputvariable=[u1(n),u2(n)]],[outputvariable=[y1(n),y2(n),y3(n),y4(n)]],[statevariable=[x1(n),x2(n),x3(n),x4(n),x5(n)]],[a=[[[a,b-(r (K_virt T+D_virt))/T,c,d,(r D_virt)/T],[e,f-(t (K_virt T+D_virt))/T,g,h,(t D_virt)/T],[i,j-(v (K_virt T+D_virt))/T,k,l,(v D_virt)/T],[m,n-(x (K_virt T+D_virt))/T,o,p,(x D_virt)/T],[0,1,0,0,0]]]],[b=[[[q,r],[s,t],[u,v],[w,x],[0,0]]]],[c=[[[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0]]]],[d=[[[0,0],[0,0],[0,0],[0,0]]]]]"

(13)
 

 

Download feedbackconnections.mw

Page 1 of 1