Question about entry-wise product of general plant and weighting function matrix using Hinfstruct for multi-objective design
7 次查看(过去 30 天)
显示 更早的评论
When I obtained the transfer matrix T from exogenous input w to real (unweighted) output z, entrywise product of matrix T and weighted transfer function matrix W is expected to be calculated and optimized. I use connect command to obtain T, which is a 4*2 transfer function matrix with adjustable parameters, reflecting the tranfer relation from input w=[Pref, wg]' to output z=[Pref-p, p, wu, q+V/Dq]'. W is a constant transfer function matrix. Direct entrywise product of T and W cannot be implemented with MATLAB. As mentioned in P. Apkarian's paper "Structured Hinfinity Synthesis in MATLAB", it should be formulated as Standard Form like H=blkdiag(Tij*Wij), then "Hinfstruct" can be used on H to find the tuned controllers. So I use the command like this:
H=blkdiag(T(1,1)*W11, T(1,2)*W12, T(2,1)*W21, T(2,2)*W22, T(3,1)*W31, T(3,2)*W32, T(4,1)*W41, T(4,2)*W42);
T = hinfstruct(H,opt);
However, above code cannot get the correct results. The reason I think should be the increased system order. For example, original system T has only 12 states. But system H has 103 states, where 7 states are from weighting fucntions, and the remaining 96 states are the 8 repeated states of system T, that is, 12*8=96.
Take a more realistic case with official Matlab's "hinfstruct" example as follows. The goal is to minimize the H-infinity norm from [r, nw]' to [y, ew]'. An important difference is that there is no entrywise product of Tij and Wij. It means the goal is to minimize 4 transfer functions: T(y,r), T(y,nw), T(ew,r), T(ew,nw).

The official command is given as follows, which works well:
T0 = connect(G,Wn,We,C0,F0,Sum1,Sum2,{'r','nw'},{'y','ew'});
T = hinfstruct(T0);
If I want to formulate the above 4 optimization goals T(y,r), T(y,nw), T(ew,r), T(ew,nw) into Standard From (diagnol form), I revise the above code as follows:
T0 = connect(G,Wn,We,C0,F0,Sum1,Sum2,{'r','nw'},{'y','ew'});
T0_revised = blkdiag(T0(1,1),T0(1,2),T0(2,1),T0(2,2));
T = hinfstruct(T0_revised);
It also cannot operate correctly. Only revise it as follows can work:
T0 = connect(G,Wn,We,C0,F0,Sum1,Sum2,{'r','nw'},{'y','ew'});
T0_revised=blkdiag(1,LS)*T0*blkdiag(1,1/LS);
T = hinfstruct(T0_revised,opt);
But it is still not the entry-wise product case, just the traditonal single transfer function connection as shown in the above figure.
Therefore, could you share your idea about this solution then I can learn based on it, and further do more improvement. I am looking forward to your reply. Thanks a lot for your help!
7 个评论
Paul
2025-7-20
编辑:Paul
2025-7-23
I'm afraid I can't be of much more help until I see the complete code that you're running that illustrates the results that your getting. To do this you can
a. include the .mat file I've been using by clicking the paperclip icon on the Insert strip and then click "Link from this thread" and then click "Submit".
b. start a code block and make the first line to load that .mat file
c. copy/paste the rest of your code that illustrates all of the cases of interest
d. Click the green triangle in the Run strip to run the code
e. Add comments or text to explain what you're concerns are.
If you don't want to show the full code, then I can't be of any more help.
I can offer a few general comments.
The term "Standard Form" in the linked paper is just a way to describe and formulate any model that includes tunable parameters (actually the paper uses "Standard Form" in two different ways, but that's not relevant to this discussion). T0 and T0_revised (created with blkdiag) are both formulated and stored in Standard Form by the software.
There may also be some confusion with respect to notation. In the Matlab doc, the frequency-weighted transfer function matrix is denoted by T (or T_0), whereas in the paper T refers to the unweighted transfer function matrix and H refers the frequency-weighted matrix (e.g., eqn (18)). In what follows, I'm going to use the terminology in the paper; I hope that's not too confusing.
Let's first build T(s), the unweighted plant model
load hinfstruct_demo G
C0 = tunablePID('C','pi');
a = realp('a',1);
F0 = tf(a,[1 a]);
wc = 1000; % target crossover
s = tf('s');
LS = (1+0.001*s/wc)/(0.001+s/wc);
% Label the block I/Os
Wn = 1/LS; Wn.u = 'nw'; Wn.y = 'n';
We = LS; We.u = 'e'; We.y = 'ew';
C0.u = 'e'; C0.y = 'u';
F0.u = 'yn'; F0.y = 'yf';
% Specify summing junctions
Sum1 = sumblk('e = r - yf');
Sum2 = sumblk('yn = y + n');
% Connect the blocks together
T = connect(G,C0,F0,Sum1,Sum2,{'r','n'},{'y','e'});
The example in the documentation chooses to formulate the optimization problem by multiplying n and e by the weights, like so
H1 = connect(T,Wn,We,{'r','nw'},{'y','ew'});
H1(s) is mathematically equivalent to
H1eq = blkdiag(1,We)*T*blkdiag(1,Wn);
H1(s) is a 2x2 matrix composed of H1(y,r), H1(y,nw), H1(ew,r), H1(ew,nw). H1(s) is stored by the software in Standard Form.
hinfstruct(H1) will attempt to find the controller parameters that minimize the inf-norm of the 2x2 H1(s).
An alternative approach would be to form H2(s) as a 4x4 diagonal matrix consisting of the elements of H1(s)
H2 = blkdiag(H1(1,1),H1(1,2),H1(2,1),H1(2,2));
H2(s) is a 4x4, diagonal matrix composed of H1(y,r), H1(y,nw), H1(ew,r), H1(ew,nw). H2(s) is stored by the software in Standard Form.
In accordance with eqn(18) in the paper, a mathematically equivalent way to form H2 would be
H2eq = blkdiag(T(1,1),T(1,2)*Wn,We*T(2,1),We*T(2,2)*Wn);
hinfstruct(H2) will attempt to find the controller parameters that minimize the inf-norm of the 4x4 H2(s), and the solution will be different than for H1(s) because H1(s) ~= H2(s).
It sounds like what you want to do would be to define four freqency dependenent weights and apply them to each element of T(s). I don't know what they are, so I'll just define them arbitrarily
[W11,W12,W21,W22] = deal(tf(10,[1 10]));
Then we can define H3(s) in accordance with eqn (18)
H3 = blkdiag(W11*T(1,1),W12*T(1,2),W21*T(2,1),W22*T(2,2));
H3(s) is a 4x4 matrix stored in Standard Form.
hinfstruct(H3) will attempt to find the controller parameters that minimize the inf-norm of the 4x4 H3(s), which will be a different solution than for H2(s) and H1(s).
We've shown three different ways to formulate the optimization that should yield three different controllers. Whether you want to use any of these three formulation or any other formulation depends on how you want to specify the design goals and the cost that should be optimized.
The third formulation is the same as was stated at the outset of the original question:
H=blkdiag(T(1,1)*W11, T(1,2)*W12, T(2,1)*W21, T(2,2)*W22, T(3,1)*W31, T(3,2)*W32, T(4,1)*W41, T(4,2)*W42);
T = hinfstruct(H,opt);
"However, above code cannot get the correct results."
So I guess we've come full circle, and can't get much further without knowing more about what's not correct about the results and how T and Wij are formed. Assuming that H(s) is defined such that we'd expect that a well-performing compensator could be obtained, then all we've seen in this thread is that the ability of hinfstruct to find such a compensator may be dependent on the nominal compensator that's built into T(s).
回答(1 个)
Paul
2025-7-22
To use hinfstruct using the entrywise multiplicaiton of T(s) and W(s), it seems that H(s) would be exactly as you've shown.
load hinfstruct_demo
C0 = tunablePID('C','pi');
a = realp('a',1);
F0 = tf(a,[1 a]);
C0.u = 'e'; C0.y = 'u';
F0.u = 'yn'; F0.y = 'yf';
% Specify summing junctions
Sum1 = sumblk('e = r - yf');
Sum2 = sumblk('yn = y + n');
% Connect the blocks together
T = connect(G,C0,F0,Sum1,Sum2,{'r','n'},{'y','e'});
size(T)
Define W(s). I'll just make something up
W = [tf(1,[1 1]),tf(1,[1 2]);tf(1,[1 3]),tf(1,[1 4])];
H2 = [T(1,1)*W(1,1), T(1,2)*W(1,2);T(2,1)*W(2,1),T(2,2)*W(2,2)];
H2(s) is state-space realization with 48 states of our 2x2 transfer function matrix
size(H2)
Forming H3 in the block diagonal format
H3 = blkdiag(T(1,1)*W(1,1), T(1,2)*W(1,2), T(2,1)*W(2,1), T(2,2)*W(2,2));
H3(s) is state-space realization with 48 states of our 4x4 (diagonal) transfer function matrix
size(H3)
H2 and H3 have the same number of states, though it does appear that the frequency response of H2(s) can be computed a bit faster.
w = logspace(-2,7,5000);
timeit(@()freqresp(H2,w))
timeit(@()freqresp(H3,w))
I have no idea as to how the runtime of hinfstruct is impacted by the speed of computing H(jw).
More important is if minimizing the H-infinity norm of H2(s) or H3(s) is consistent with your engineering design goals. That decision should be the primary factor in deciding which approach to use.
Depending on the structure of T(s) and W(s), some efficiency might be gained by removing states by using minreal on T(s), or separately on Tij(s) in the construction of H(s), or on H(s) itself. However, minimal realization can be a tricky business and it's important to have good insight into the problem to know whether or not minreal is doing what it should or shouldn't. One can also compare frequency responses before and after minreal to make sure that non-minimal dynamics were not incorrectly removed.
If you're willing to give up some accuracy, then you can always look into Model Order Reduction techniques that may be applicable to T(s) and/or H(s) and then design the controller for the reduced order model. However, I don't really know if any of those techniques can be directly applied to a genss model, as is T(s) and H(s). It may be possible to break out the nominal portion of the genss model, reduce that, and then reform a lower order genss model. You'll have to check all of this yourself if you think you might want to go down that path. Having said that, one of the selling points of hinfstruct is that it removes the need to design controllers based on reduced order models, which is much more of a consideration using the classical H-infinity design approach implemented by hinfsyn. I'm only mentioning model order reduction for completeness; I'd only consider it as a last resort when using hinfstruct, if at all.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Robust Control Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!