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)

Our second model – the Alfa Romeo 147 GTA

With what we've learned so far, we're ready to develop a simple mathematical model of a real car in order to test and fine-tune the controller in a closed-loop simulation.

Luckily enough, a lot of technical detail is available nowadays on almost every car. The author likes the Alfa Romeo 147 GTA a lot, so the choice is made.

Open a new Simulink model and save it as alfa147gta.slx. The model will have one input (the throttle, coming from the cruise controller) and one output (the car's speed, going to the cruise controller).

We're interested only in the longitudinal speed (a car going straight on a flat ground), and we assume the gearbox to be ideal (shifting gears in no time).

How do we compute the speed?

Getting the speed – Newton's laws

We know that the car's speed is the integral of the acceleration in time:

Newton's second law reminds us that the acceleration is proportional to the total force applied on the car, with the mass m being the factor: