Info

This question is closed. Reopen it to edit or answer.

Simulink creates errors from nowhere!

3 views (last 30 days)
Daniel H
Daniel H on 26 Nov 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
It's really frustrating, I spent hours on this but I just don't see anything meaningful.
I use a fixed step solver (step size 1e-12) and export two signals from to different sources, both sampled at "0" (i.e., each time step). This is the model:
Both signals are numerically IDENTICAL!!! After the simulation, I execute
plot(simout_sim - simout_cad)
and get this figure. There is really NO DIFFERENCE between these signals!!
Now I send both signals through identical systems (in this case Butterworth) and suddenly Simulink creates a huge error! I execute:
plot(simout_sim_bb-simout_cad_bb)
and get this (zoomed to the beginning):
Clearly the problem is the "cadence" block (which does not perform any actions). If I just remove it, it works, if I just export simout_sim and simout_cad and read it in via "From Workspace" block it also works. However, I still make sure that both signals are identical!
This must never result in an overall error of 1e-3 ... from out of nothing!!
Any ideas?
  2 Comments
Meghana Dinesh
Meghana Dinesh on 26 Nov 2014
Have you checked the timing/clock values and made sure it's correct?
Daniel H
Daniel H on 26 Nov 2014
Hi Sanya, what specifically do you mean by "checl timing/clock"? To the best of my knowledge, it must be correct. I tried all kinds of different solvers, no changes. All I can say for sure (and proof using the plots above) is that the input signals to the Butterworth filters are identical. Is there ANY case where Simulink would store a different signal in the "simout_sim"/"simout_cad" blocks that it uses to process? To simplify it, the solver is fixed step, the "To Workspace" blocks are configured as Decimation=1, SampleTime=0. To my understanding this should output the sample at each simulation step, i.e., exactly the signal that is being processed.

Answers (1)

Andreas Goser
Andreas Goser on 26 Nov 2014
I like to share two experiences.
#1 is related the the statistical expereince that around 50% of all issues with 3rd part products are related to release compatibility. Make sure the Cadence block is really matching with the release requirements.
#2 as of a similar issue worked on a couple of weeks ago. Here the 3rd party vendor mentioned on one page of a 100 page document this only would work with a certain solver and a couple of specific settings. I may or may not be ths is also what happens for you.
  1 Comment
Daniel H
Daniel H on 26 Nov 2014
Andreas. Thanks. #1: I tried it with R2008b/Win/32bit and R2012b/Linux/64bit; same result. The requirements are "MATLAB704R14, R2007b, R2008a or later".
#2: Although no information regarding solver is stated in the manuals, I tried many possibly options (fixed, variable, stiff, non-stiff, different settings) and all give the same result. There must be a fundamental problem.
Form my point of view it boils down to the question if a signal which I measure and turns out to be identical can still be differently processed. If this is the case, the question is how to debug this further. Clearly, the 3rd party block is related to the issue. However, in the end, it outputs one number per simulation step. And I record this number with the "To Workspace" block (simout_cad) and make sure that I create an identical signal (simout_sim). Since these are equal, the job of the third party block is done and it's Simulink's duty to process the actual data and not some other random stuff.
Is there any case you could think of where this could happen?

Tags

Community Treasure Hunt

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

Start Hunting!