My Mental Model of a Model

When you are new to something, it always helps to get a mental picture of how that something works.  Since I learned Simulink over 10 years ago, I have developed my own mental model of Simulink models.  Today I want to present a mental model for the three basic components in Simulink block diagrams, ports, blocks and signals.

Something Familiar

A good mental model is something to which you are already familiar.  I like to compare Simulink diagrams to programs written in a procedural language like MATLAB or C.  My favorite is MATLAB, so that is usually how I think.

Ports

Ports are the input and output arguments for the function.

Blocks

When I think about blocks, I think of them as algorithmic components of the programs.  A block like the Gain or Product is a function that operates on inputs and produces an output.

Signals

Signal lines pass the value output from one block to the next block.  I think of signal lines as the variables in a program.

Generating Code

With my intuition in hand, I read the generated code so I can compare and refine my mental model.  The result is here:

In this case, I made a couple tweaks to the code generation settings for readability and interface.

What do you think?

2 Responses to “My Mental Model of a Model”

1. M.tamilselvan replied on :
this piece of snippet is short and crisp,need to post more mental model strutures in depth possible with optimization issuses.

2. Jarrod Rivituso replied on :

“I think of signal lines as the variables in a program.”

I say the exact same thing every time I teach our Simulink courses :)

 Name (required) E-mail (required, will not be published) Website (optional) Spam protection (required): What is 3 + 10 ?

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>


If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).

Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.

These postings are the author's and don't necessarily represent the opinions of MathWorks.