Вы находитесь на странице: 1из 19

Rapid Control Prototyping with MATLAB/Simulink

Case Study: Ball-on-Wheel

Vasco Lenzi
Application Engineer
MathWorks

2017 The MathWorks, Inc.


1
Introduction

From Ticino, studied Mech Engineer at ETHZ

Formula Student Hybrid with IDSC 2009

Worked for IDSC as engineer/researcher 2010-2013

Worked as embedded software developer (EVTEC, Liebherr Machines


Bulle)

Application Engineer at MathWorks since summer 2016

2
Key takeaways

Rapid Control Prototyping is the process of quickly applying control system


theory and analysis to real systems

Graphical block programming and automatic code generation free up time


to focus on what matters: stability, robustness and verified algorithms

Use the right tool for the right task

3
Bosch eBike Systems Develops Electric Bike
Controller with Model-Based Design

Challenge
Develop the control system for an electric
bike within a tight schedule

Solution
Use Model-Based Design with MATLAB and Simulink The primary business benefits of
to design drive and motor control subsystems, run Model-Based Design are shorter
simulations and tests, and generate prototype and development times and lower costs.
production code For me, the biggest advantage
comes from knowing that we could
Results
use generated code, which made it
Designs updated and ready for retest in five minutes
Code generated to meet safety standards possible to debug at the model level
Crucial market deadline met in Simulink, not at the code level.
Daniel Baumgrtner
Bosch eBike Systems
Link to user story

4
Alstom Generates Production Code for Safety-Critical
Power Converter Control Systems

Challenge
Design and implement real-time power conversion and control
systems for trams, metros, and railways

Solution
Use MathWorks tools for Model-Based Design to design,
simulate, and automatically generate production code for safety-
critical transportation systems Given the resources available
to us, it would have been
Results
Development time cut by 50% impossible to deliver this on
Defect-free, safety-critical code generated and certified schedule without MathWorks
Common language established tools."
Han Geerligs
Alstom

Link to user story

5
Case study Ball-on-Wheel
Rapid Control Prototyping

6
Model-Based Design RESEARCH REQUIREMENTS

How does my controller structure DESIGN

TEST AND VERIFICATION


should look like?

How big should the motor be?


Whats the impact on the controller?

What model fidelity is good enough? Am I using


the right techniques?
IMPLEMENTATION

Requirements Verification and Validation


INTEGRATION

7
Industry Best Practices Modeling a plant
Simulink First principles Symbolic Math
Writing algorithm for embedded targets
Simscape Language
Graphical programming

State Machine, Logic


Simscape
Signal Processing

Simulink Stateflow Transfer Functions


Control

C/C++-code in Simulink Simscape Multibody (CAD models)

MATLAB Neural Network


System Identification
Coding languages Data driven

8
Model-Based Design RESEARCH REQUIREMENTS

Faster design iterations DESIGN

TEST AND VERIFICATION


Consistent high-quality code
Target-independent

Automatic Code Generation

IMPLEMENTATION

INTEGRATION

9
Hardware Support for Project-Based Learning

Supported target hardware


Arduino Uno, Mega 2560,
LEGO MINDSTORMS
Raspberry Pi Model B, B+, 2, and 3
BeagleBone Black
Samsung Galaxy Android Devices
Apple iPhone and iPad
Microsoft Kinect

Hardware for Project Based Learning
Hardware Support

10
Model-Based Design
RESEARCH REQUIREMENTS

DESIGN

TEST AND VERIFICATION


One of the key industrial
verification methodology:

in-the-loop workflows
IMPLEMENTATION

INTEGRATION
11
In-the-loop verification methodologies
Software-in-the-Loop

Is the generated
Compiled
Algorithm Plant Model code functionally
SIL equivalent to the
model ?

12
In-the-loop verification methodologies
Processor-in-the-Loop

Is the generated
Algorithm Plant Model code functionally
equivalent to the
model ?

Non-Real-Time functional
verification of the algorithm
component

Production embedded target

13
In-the-loop verification methodologies
Hardware-in-the-Loop: HIL

Does algorithm
perform well on
Algorithm Plant Model actual device
with true
latencies?
Code Code

Real-Time Machine
Production embedded target Harness eg Speedgoat

14
Key takeaways

Rapid Control Prototyping is the process of quickly applying control system


theory and analysis to real systems

Graphical block programming and automatic code generation free up time


to focus on what matters: stability, robustness and verified algorithms

Use the right tool for the right task

15
Appendix: Useful Links and Resources

MathWorks @ ETHZ

2017 The MathWorks, Inc.


16
Free MathWorks Online training @ ETH Zrich

Link
17
Shipping examples Command Window

All Simulink control design examples


Cascaded Multi-Loop Demo: openExample('control_featured/MultiLoopTuningExample')
Tune MIMO System: openExample('control_featured/ControlSystemTuner_HelicopterExample')
Inverted Pendulum Control: openExample('control_featured/InvertedPendulumExample')
MIMO Control of Diesel Engines: openExample('control_featured/DieselEngineExample')

Simscape and Multibody examples:


sm_cart_double_pendulum
sm_backhoe

18
Internet of Things / Cloud

MATLAB Online & Drive


Thingspeak

19