What is Simulink?
Simulink is best described as a graphical programming tool. Let's elaborate a little on these two words.
Programming
Since the start of the digital era, telling a computer what to do has been a huge problem. Humans communicate through a set of conventions—languages—with very elaborate rules, definitions, and exceptions. New languages aren't easily born in the human world. But what about computers? They operate by means of a stream of zeros and ones, using Boolean logic; that's the binary system. The computer language is nowhere as complex as the human language, but how fast are computers at solving logical problems! The difficulty is in telling the computer how to solve a given problem, and this is the art of programming.
Nowadays there are so many programming languages that knowing at least one is as common as knowing more than one human language. Those lucky ones who do are called programmers. They're able to write the instructions that a computer has to execute (and the computer understands them—well, most of the time).
Writing and debugging a complex, real-time, safety-critical application is not a trivial task, and in big automotive/aerospace industries, a misbehaving software is definitely not an option. As an example, the 327.6 million dollars NASA Mars Climate Orbiter space probe disintegrated before landing because the ground control software used the imperial metric system instead of the international one. It sounds funny, but imagine what would happen if your car maker made such a mistake in the brake control software?
The problem with using the venerable, almighty C—still the language of choice for embedded systems—is that it isn't easy to scale up the system complexity. It's interesting to note that while the system gets bigger, the deadlines get narrower. The good old tools (code editors, compilers, and debuggers) aren't effective anymore to keep the whole development time constant while raising the software requirements.
Graphical
This is the next step.
Imagine an Italian guy in Moscow willing to buy a bottle of water. Chances are that he doesn't know one word of Russian, nor the Russian shop owner knows more than two words of Italian (bella and ciao).
Our Italian guy would likely point at a bottle of water with his finger and mimic the act of drinking. The Russian shop owner would smile to acknowledge the request, and then use his fingers (or pencil and paper) to communicate the price to pay.
So what? We had visual communication. The simplest of all languages are the visual ones.
When a programmer tries to explain to his manager how a code works, he usually starts drawing blocks on a piece of paper—something like the following oversimplified example:
It isn't hard to understand that the logic flows from left to right (because of the arrows), and that two inputs will be multiplied together to obtain the output. With nothing more than a simple glance, you've understood what the computer has been programmed to do.
Let's compare it with a warning-free, standards-compliant C code:
#include <stdio.h> #include <stdlib.h> int mul(int, int); int main() { int u1, u2, y1; printf("Enter two numbers\n"); scanf("%d%d", &u1, &u2); y1 = mul(u1, u2); printf("Here's your result,the operation done is a shining 'x'!\n%d\n", y1); return EXIT_SUCCESS; } int mul(int input1, int input2) { return input1*input2; }
Now chances are one of the following:
- You know C, and you understood what the code does after reading through it
- You don't know C, but you know other programming languages; maybe you haven't understood every line, but you are still able to figure out what the program does
- You don't know any programming language; you're almost clueless and you understand what's going on only because you've seen the figure first
Either way, a visual representation of the code is much easier to understand and maintain.
Now imagine a long (several hundred lines), complex (tens of source files) code, poorly commented, highly optimized for a certain processor architecture, edited by several people without a strict style policy—the classic spaghetti code that many programmers are faced with in their job. They'll spend a huge amount of time understanding what the code does, no matter how skilled they are. Explaining that code to a colleague who doesn't know programming is out of the question.
That's where visual programming comes the rescue. A graphical programming tool can save countless hours of work in a job where explaining the code is as important as a code without bugs, or where a bug can have disastrous (safety-critical) effects.
Simulink is such a tool.