Commenting out Simulink block changes in unrelated system

I have an issue where "Commenting Through" a Simulink block semmingly changes the response of an unrelated system.
Say I have unrelated sys A and sys B. Exactly what they are aren't as relevant for now (I think).
The top sys A is off-screen at the connection, but is independent of the bottom sys B. A's output plotted is called "y LQGI_DOB intl err".
The bottom sys B is shown in entirety, so is independent of anything else.
They both have an inline filter (5e5 / ...).
The left-most shared input is from essentially a signal generator, eg assume it's a sin-wave. It's a one-directional source that has nothing to do with any outputs in the system.
Here's the response: (note the peak of ~2e4)
Then comment through the filter of sys A like so -- nothing else changed:
And here's the response: (note the peak value for BOTH outputs is ~3e3)
Here's both responses together just for comparison: green/blue is both filters in, red/yellow is one filter commented through.
How is it possible for a self-contained sys B's output to be impacted by a change to sys A? What might be going on?

 Accepted Answer

Hi John,
Do you have reason to believe that either pair of responses is correct? Just asking because having some idea what the response should be can be helpful in figuring out problems like this in Simulink.
One way that self-contained B can be affected by A is if the model is using a variable step solver and commenting through that filter in A changes the solver step size compuations as the model simulates.

4 Comments

@Paul Thanks. Good question: I believe neither is correct. If i remove the standalone system to another .slx file, then I get a 3rd response.
"One way that self-contained B can be affected by A is if the model is using a variable step solver and commenting through that filter in A changes the solver step size compuations as the model simulates. "
Ah, interesting. And troubling -- there's no obvious way to know this is the case. In general, how would I know when to rely on the results, if the results change this substantially?
I should point out that the fixed step solvers also have an auto option, so this issue is not limited to the variable step solvers. Whether or not this issue actually affecting your model is unknown at this point.
Are you making those plots by logging the signals and plotting after the simulation? If so, what do the time steps look like in those logged signals for the two different cases?
What solver is the model using and what is the Max Step Size setting if a variable step solver or the Fixed Step Size if a fixed step solver? If set to auto, consider playing with some values going smaller until the results seem to be insenitive to furhter reduction. I would imagine the max or fixed step size has to be pretty small, if only to deal with that filter that has a time constant of 2e-6
I very rarely have ever used a fixed step solver. For the variable step solver I always set the Max Step Size to a value that I think is reasonable based on my understanding of the model dynamics, unless I know that I have blocks in the model with Sample Times that will effectively limit the step size anyway.
Simulink is a simulation tool like any other and step size selection is something to always be aware of (also true if using the Matlab ode solvers). However, we have yet to even determine if this issue is causing your results.
"I should point out that the fixed step solvers also have an auto option, so this issue is not limited to the variable step solvers."
Good to know, thanks.
"Are you making those plots by logging the signals and plotting after the simulation? If so, what do the time steps look like in those logged signals for the two different cases?"
Yes; and you're right, they're different: the time steps change by a factor 100x between the two versions...
"What solver is the model using and what is the Max Step Size setting if a variable step solver or the Fixed Step Size if a fixed step solver?"
" For the variable step solver I always set the Max Step Size to a value that I think is reasonable based on my understanding of the model dynamics,"
Makes sense. I assumed SL would know what max step size needs to be based on the dynamics of the system its running -- it has access to every components, after all...
Hi John,
Did manually setting the Max Step Size parameter in the solver pane prove fruitful?
I don't know how SL deals with Max Step Size if it's set to 'auto'. Maybe the doc page for the solver pane has more info on how that works.

Sign in to comment.

More Answers (0)

Products

Release

R2022b

Asked:

on 3 May 2023

Commented:

on 13 May 2023

Community Treasure Hunt

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

Start Hunting!