I have developed a Simulink model that is used to simulate a very long physical process. I am noticing that the final result of the simulation is slightly different depending on how many blocks there are in the model. The blocks that are added should not affect the value of concern because they are added to a different branch of the model not upstream of this calculation.
The differences in results are indeed negligible, but the final result computed is the output of an integrator block. And since the model simulates a physical process over hundreds of days, the minute numerical errors accumulate over time. The simulation is run in normal mode, and uses a variable step solver which is automatically chosen to be "ode45" by the solver's heuristics.
A simplified model demonstrating this effect is attached. In this model, the absolute value of an input signal is computed in a branch parallel to the main computation. If this "abs" block is commented-out, the final result of the main branch is noticeably different. Adding more blocks to alternate branches of the simulation also causes the value to change.
What is happening in the simulation to cause such different results?
Best Answer