I am attempting to connect multiple control subsystems (G1, G2) using the connect command. Each subsystem has analysis points connected to internal signals. I get an error when I connect the subsystems and attempt to keep the analysis points. The issue seems to be related to using multiple instances of the connect command. My current workaround is to use the connect command once. However, for building up large systems with multiple transfer functions this seems unwieldy.
Example code showing the problem is given below. I want to have access to analysis points "InnerError" and "OuterError" in the full model.
G1 = tf([1],[1 0]);G1.u = 'OuterError';G1.y = 'InnerCmd';G2 = tf([1], [1 1]);G2.u = 'InnerError';G2.y = 'ActuatorCmd';SumOuter = sumblk('OuterError = OuterCmd - Outer');SumInner = sumblk('InnerError = InnerCmd - Inner');disp('Connect everything at once. This works.')Sys1 = connect(G1,G2,SumOuter,SumInner,{'OuterCmd','Outer','Inner'},'ActuatorCmd', {'InnerError','OuterError'})disp('Connect things in series. This does not work with AnalysisPoints.')P1 = connect(G1,SumOuter,{'OuterCmd','Outer'},'InnerCmd','OuterError');P2 = connect(G2,SumInner,{'InnerCmd','Inner'},'ActuatorCmd','InnerError');Sys2 = connect(P1,P2,{'OuterCmd','Outer','Inner'},'ActuatorCmd', {'InnerError','OuterError'});
Best Answer