AnalysisPoint fails when using multiple connect commands

1 view (last 30 days)
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'});

Accepted Answer

Abhi Sundararaman
Abhi Sundararaman on 31 Jul 2017
This is actually a limitation of the "connect" function. I have notified the developers of this.
For now, the error points to the "AnalysisPoints_" block in P1 and P2. A workaround could be to rename this internally-created block within P1 and P2, like so:
P1 = connect(G1,SumOuter,{'OuterCmd','Outer'},'InnerCmd','OuterError');
P1.Blocks.AnalysisPoints_.Name = 'OuterError';
P2 = connect(G2,SumInner,{'InnerCmd','Inner'},'ActuatorCmd','InnerError');
P2.Blocks.AnalysisPoints_.Name = 'InnerError';
Sys2 = connect(P1,P2,{'OuterCmd','Outer','Inner'},'ActuatorCmd')
Renaming the analysispoints of each genss object will prevent the error, and should give the desired result.
  1 Comment
jdg
jdg on 31 Jul 2017
Thank you. That works perfectly. Didn't realize I could overwrite the assigned name.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!