Comments on: My First Debugging Steps https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/?s_tid=feedtopost Guy Rouleau is an Application Engineer for MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design. Fri, 28 Mar 2014 07:17:32 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Gayathri https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-60677 Fri, 28 Mar 2014 07:17:32 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-60677 I got this error while solving my simulink model “First offending Goto ‘mine41/powergui/EquivalentModel1/Yout/Goto14’.”

where mine41 is my simulink file name.I have been trying it for three days.So please help me in this regard

]]>
By: Guy Rouleau https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-46194 Wed, 13 Nov 2013 21:58:37 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-46194 Thanks KE, I receive models created from others every day, so I have good experience with that. I will try come up with a post on this topic soon.

For a starting tip… I usually open the Model Browser and quickly browse through all the subsystems, level by level, looking for subsystems names, annotations or any kind of pattern. This helps me making a big picture in my head. Then I try identifying critical or important signals that I log and observe using a Scope or the Simulation Data Inspector.

]]>
By: KE https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-46193 Wed, 13 Nov 2013 21:48:08 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-46193 Very useful. Would also like to see a blog entry on “First steps in debugging code written by someone else”. If you’re given a model that someone else wrote, it can be hard to figure out what the model is doing. What are some first approaches to getting oriented?

]]>
By: Guy Rouleau https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-1928 Tue, 11 Sep 2012 17:40:01 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-1928 @KMR: Thank you for the comment. I apologize for the long delay before replying.

I never used SystemBuild, but what you describe seems close to the behavior of Atomic Subsystems in Simulink.

Atomic Subsystems have a “Sample Time” property, which is by default set to -1. The value of -1 does not impose any constraints on the sample time of the blocks inside the Atomic Subsystem. As you describe, this gives you the possibility to shoot yourself in the foot.

If your application requires strict usage of sample times, you can specify a positive value for the sample time of the Atomic Subsystem. When a positive value is specified, all the blocks inside the Atomic Subsystem will run at this rate. You will receive an error if blocks inside the Atomic Subsystem are configured to run at a different rate.

There are also ways to enforce models to be single-rate.

In the solver section of the model configuration, by default the “Periodic sample time constraint” is set to ‘Unconstrained’ to allow more flexibility. If your model needs to contain only specific rates, you can change it to “specified” and specify the allowed rates. You can find information on this topic here:

https://www.mathworks.com/help/toolbox/simulink/gui/bq7cmsp-1.html#bq99059-1

https://www.mathworks.com/help/toolbox/simulink/gui/bq7cmsp-1.html#bq99059-1

]]>
By: KMR https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-1885 Wed, 25 Jul 2012 19:40:57 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-1885 (I don’t check this very often, so apologies to the long time between question and response.)

In Simulink, you typically handle sample times by specifying the sample time of an individual block (say, an integrator) and then having the sample time propagate to individual blocks. The problem is that if you mess up the sample time on one block, it can affect lots of blocks, which is what Guy is showing. Simulink’s design makes it relatively easy to shoot yourself in the foot, sample-time-wise.

In the almost-extinct SystemBuild (part of MATRIXx, which was actually the leader in graphical modeling and code generation until about 2001 or so; that’s a whole ‘nother story), timing attributes were specified at the SuperBlock level (a SuperBlock is similar to Simulink’s Subsystem block, except somewhat less virtual). So every non-SuperBlock inside a given SuperBlock would share the same timing attributes. This greater level of structure to timing attributes makes it substantially more difficult to mess up timing in a SystemBuild model.

I don’t know if this architecture was covered by patent or not, but since AFAIK the Mathworks kept the rights to all patents covering MATRIXx/SystemBuild when they were forced to divest themselves of their purchase of that tool (that’s part of the story alluded to above), there should be no legal problem with allowing the SystemBuild-style timing attributes in Simulink. I am assuming that the Mathworks prefers their design; I do not in this case. My preference would be to allow (not enforce) a Model block to act like a SystemBuild-style SuperBlock and specify timing attributes for the entire contents of the Model block (including inheriting them from a higher-level Model block, for the case of nested Model blocks). Maybe I’m unusual, but for all of my use cases, I always design my Model blocks to be single-rate; that’s what is required to integrate my generated code into an existing real-time framework.

]]>
By: Paul J. https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-1878 Thu, 12 Jul 2012 23:00:59 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-1878 KMR,

Can you expand on your concerns with how Simulink handles sample times?

]]>
By: KMR https://blogs.mathworks.com/simulink/2012/07/11/my-first-debugging-steps/#comment-1876 Wed, 11 Jul 2012 22:20:29 +0000 https://blogs.mathworks.com/seth/?p=1099#comment-1876 Related to sample time: I continue to contend that Simulink’s model for sample time is inferior to the SystemBuild model for sample time; it is much easier to make these kind of sample time errors with Simulink. This remains one of the three or four areas where the Mathworks stubbornly refuses to learn from what SystemBuild did 15 years ago.

Not saying that I want to go back to SystemBuild, but it is frustrating that there are still these places where Simulink makes it easy to shoot yourself in the foot.

]]>