Book Image

Getting Started with Simulink

By : Luca Zamboni
Book Image

Getting Started with Simulink

By: Luca Zamboni

Overview of this book

Simulink is an engineer's Swiss army knife: instead of spending the day typing out complex formulas, Simulink enables you to both draw and execute them. Block after block, you can develop your ideas without struggling with obscure programming languages and you don't have to wait to debug your algorithm - just launch a simulation! Getting Started with Simulink will give you comprehensive knowledge of Simulink's capabilities. From the humble constant block to the S-function block, you will have a clear understanding of what modelling really means, without feeling that something has been left out. By the time you close the book, you'll be able to further extend your modelling skills without any help. We''ll start with a brief introduction, and immediately start placing the first blocks. Little by little, you'll build a car cruise controller model, followed by the mathematical model of a sports car in order to calibrate it. Then you'll learn how to interface your Simulink model with the external world. This book will give you an easy understanding of the tools Simulink offers you, guiding you through a complex exercise split into the three main phases of Simulink development: modelling, testing, and interfacing.
Table of Contents (11 chapters)

Simulink and the real world


We've got a big problem: how fast did the simulations run? Were they in sync with our real clock? The answer is no; simulation time and actual clock time are not the same. The amount of time it takes to run a simulation depends on many factors (among them are the model's complexity, the solver's step sizes, and the processor's speed). Having a very simple model (the cruise controller), powerful hardware, and a time step of 0.1 seconds, the simulation time is way ahead of the real time.

And guess what, the application we want to interface with is using the system clock.

How do we solve this problem?

Forcing Simulink to sync

We'll use the famous Simulink Real Time Execution S-function by Guy Rouleau, published in the MATLAB Central at the address http://www.mathworks.com/matlabcentral/fileexchange/21908-simulink%C2%AE-real-time-execution.

Note

The MATLAB Central (http://www.mathworks.com/matlabcentral/) is the main community of MATLAB and Simulink developers. You can...