model-based design for controls - mathworks · 6 deeply rooted in education benefits for industry:...
TRANSCRIPT
1 © 2011 The MathWorks, Inc.
Model-Based Design for
Controls
2
MathWorks at a Glance
Headquarters:
Natick, Massachusetts US
Other U.S. Locations:
California; Michigan;
Texas; Washington, DC
Europe:
France, Germany, Italy,
Spain, the Netherlands,
Sweden, Switzerland, U.K.
Asia-Pacific:
Australia, China, India,
Japan, Korea
Worldwide training
and consulting
Distributors in 25 countries
Earth’s topography on an equidistant cylindrical
projection, created with MATLAB and Mapping Toolbox.
3
Key Capabilities Drive MathWorks Business
Founded in 1984
1985 1990 1995 2000 2005
• Rapid prototyping and HIL
• DSP designs • State charts • Physical modeling
• Discrete-event modeling
• Model checking
• Test and measurement
• Code verification
• Embedded software
• VHDL/Verilog
MATLAB
Simulink
• Control design
• Signal processing
• Image processing
• Computational finance
• Computational biology
• Application deployment
• Distributed and parallel computing
• Student version
• Optimization
• Statistics
Technical
Computing
Data Analysis
and Algorithm
Development
System
Modeling and
Simulation
Automatic
Code
Generation
Verification,
Validation,
and Test
• Instrument and database connectivity
• DSP software
• Communication systems
• Video processing
2010
• Qualification kits
• PLC code
• MATLAB Mobile for iPhone
4
1984 1989 1994 1999 2004 2009
MathWorks Today
Revenues ~$600M in 2010
Privately held
More than 2000 employees worldwide
Worldwide revenue balance: 45% North America, 55% international
More than 1 million users in 175+ countries
5
Key Industries
Aerospace and defense
Automotive
Biotech and pharmaceutical
Communications
Education
Electronics and semiconductors
Energy production
Financial services
Industrial automation and
machinery
6
Deeply Rooted in Education
Benefits for Industry:
Every year, tens of thousands of engineers enter the workforce with
MathWorks product skills and experience.
Students learn theory and techniques while using MATLAB and Simulink.
3500+ universities around the world
1200+ MATLAB and Simulink based books
Academic support for research, fellowships, student competitions, and curriculum development
“Everyone that comes in as a new
hire already knows MATLAB,
because they all had it in
college. The learning curve is
significantly lessened as a result.”
Jeff Corn,
Chief of Engineering Projects Section,
U.S. Air Force
7
Core MathWorks Products
The leading environment for
technical computing
The industry-standard, high-level
programming language
for algorithm development
Numeric computation
Data analysis and visualization
Toolboxes for signal and image
processing, statistics, optimization,
symbolic math, and other areas
Foundation of MathWorks products
8
Core MathWorks Products
The leading environment for modeling,
simulating, and implementing dynamic
and embedded systems
Linear, nonlinear, discrete-time,
continuous-time, hybrid, and
multirate systems
Foundation for Model-Based Design,
including physical-domain modeling,
automatic code generation, and
verification and validation
Open architecture for integrating models
from other tools
Applications in controls, signal processing,
communications, and other system
engineering areas
9
Migration Planning
Component Deployment
Full Application Deployment
Co
nti
nu
ou
s Im
pro
ve
me
nt
Consulting Services Accelerating return on investment
A global team of experts supporting every stage of tool and process integration
Supplier Involvement Product Engineering Teams Advanced Engineering Research
Advisory Services
Process Assessment
Jumpstart
Process and Technology
Standardization
Process and Technology
Automation
10
Training Services Exploit the full potential of MathWorks products
Flexible delivery options:
Public training available worldwide
Onsite training with standard or
customized courses
Web-based training with live, interactive
instructor-led courses
Self-paced interactive online training
More than 30 course offerings:
Introductory and intermediate training on MATLAB, Simulink,
Stateflow, code generation, and Polyspace products
Specialized courses in control design, signal processing, parallel computing,
code generation, communications, financial analysis,
and other areas
11
MATLAB Central
Community for MATLAB and Simulink
users
Over 1 million visits per month
File Exchange – Upload/download access to free files
including MATLAB code, Simulink models,
and documents
– Ability to rate files, comment, and ask questions
– More than 12,500 contributed files, 300
submissions per month, 50,000 downloads
per month
Newsgroup – Web forum for technical discussions about
MathWorks products
– More than 300 posts per day
Blogs – Commentary from engineers who design, build,
and support MathWorks products
– Open conversation at blogs.mathworks.com
Based on February 2011 data
12
Connections Program
More than 400 add-on products and services that
complement and extend MathWorks products:
Specialized third-party toolboxes for MATLAB
Interfaces to third-party software and hardware products
Specialized training courses and consulting services
System integrators and suppliers that incorporate
MathWorks products
13
Book Program
More than 1200 books for educational and professional
use, in 26 languages
Mathematics
Aerospace engineering
Environmental sciences
Chemistry
Finance
Electronics
Controls
Signal processing
Image processing
Biosciences
Communications
Mechanical engineering
14
Technical Support
Resources
Over 100 support engineers
– All with MS degrees (EE, ME, CS)
– Local support in North America,
Europe, and Asia
Comprehensive, product-specific Web
support resources
High customer satisfaction
95% of calls answered
within three minutes
70% of issues resolved
within 24 hours
80% of customers surveyed
rate satisfaction at 80–100%
15
MathWorks Product Overview
Simulink Product Family Application-Specific Products
View full product list
MATLAB Product Family
16
What are we doing today?
17
Host computer
with MATLAB
xPC Target on
Target Computer
xPC Target runs Simulink in hard real-time
Ethernet or RS 232
1
2
3
Environment allows the real-time execution of Simulink models on a
separate PC-based target computer
18
Today’s Agenda
Introduction to Simulink
Plant Modeling
Control and Real Time Testing
Closing remarks
19
Mechanical
Components
MCAD/
MCAE
Electrical
Components
EDA
INTEGRATION AND TEST
SPECIFICATIONS
DESIGN
RESEARCH REQUIREMENTS
Embedded
Software
C/C++
IMPLEMENTATION
Requirement Documents
• Difficult to analyze
• Difficult to manage as they change
Paper Specifications
• Easy to misinterpret
• Difficult to integrate with design
Manual Coding
• Time consuming
• Introduces defects and variance
• Difficult to reuse
Traditional Testing
• Design and integration issues found late
• Difficult to feed insights back into design
process
• Traceability
Embeddable
Algorithms
Algorithm
Design Physical Prototypes
• Incomplete and expensive
• Prevents rapid iteration
• No system-level testing
Traditional Development Process
20
DESIGN
Embedded
Software
Control
Algorithms
Mechanical
Components
Electrical
Components
Model-Based Design- Describe the system dynamics
Model-Based Design uses
block diagrams to
mathematically model the
system behavior.
You design the way the system
should perform.
21
Model-Based Design- Design and test using simulation
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Requirements are linked to the
model.
Detail is added from specific
domains to refine the model.
Intellectual property and
engineering data are reused
from existing designs and CAE
tools, such as CAD, FEA, and
SPICE models.
Design and test control
algorithms using the model.
RESEARCH REQUIREMENTS
22
REAL-TIME TESTING
Model-Based Design- Test and validate in real-time
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Automatically generate code
from the simulation model for
real-time testing of the control
algorithms.
RESEARCH REQUIREMENTS
Automatically generate code
from the simulation model for
real-time system simulation of
hardware for testing the real
microcontroller, FPGA, or PLC
MCU DSP FPGA ASIC
Structured
Text
VHDL,
Verilog C, C++
PLC
23
INTEGRATION
IMPLEMENTATION
TE
ST
& V
ER
IFIC
AT
ION
Model-Based Design- Implement embedded software
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Automatically generate code
from the simulation model for
implementing directly on
production targets:
• Microcontrollers
• FPGAs
• PLC IDEs
RESEARCH REQUIREMENTS
MCU DSP FPGA ASIC
Structured
Text
VHDL,
Verilog C, C++
PLC
24
Plant Modeling Control Design Testing
SolidWorks
SimMechanics
Simscape
SimElectronics
SimPowerSystems
Simulink Design Optimization
Optimization Toolbox
Simulink Control Design
Control System Toolbox
Simulink Design Optimization
Optimization Toolbox
xPC Target
MATLAB Coder
Simulink Coder
DSP System Toolbox
Model-Based Design
25
MAN Roland Develops High-Precision
Commercial Printing Press Controller with
MathWorks™ Tools
Challenge To implement a new design process to support
development of a precision controller for a state-of-the-art
commercial printing press
Solution Use MathWorks products for Model-Based
Design to design and model the controller, run
real-time simulations, and deploy a production system
Results Development time reduced by one year
Design iterations completed in minutes,
not weeks
Error analysis streamlined for MAN Roland
customers
“MathWorks™ tools made it easy for us
to test ideas, introduce new algorithms,
and compare one controller against
another... We could quickly change the
structure of the controller and
immediately see the results. The ability
to perform rapid iterations enabled us
to optimize quality and functionality
while greatly reducing development
cycle time."
Thomas Debes
MAN Roland
MAN Roland’s state-of-the-art printing
press.
Link to user story
28
We can import the entire mechanical design
directly from a CAD tool…
The translator automatically generates the SimMechanics model using CAD information
SolidWorks Model
SimMechanics Model
29
Now, for our robot to be of any use, it has to be
able to move…
We can include the effects of actuator and sensor dynamics in the simulation model
30
And we can test and verify the overall system
performance in simulation…
Generate test vector arrays and verify the controller design against the performance specifications given for the system
reference +
-
controller
S1 S2
S3
31
Modeling Dynamic Systems: two approaches
Use system test data to derive a
mathematical representation
Data-Driven Modeling
sese
esG 1.0
78.21
94.1)(
32
Modeling Dynamic Systems: two approaches
Use an understanding of the
system’s physics to derive a
mathematical representation
First-Principles Modeling
V+
V-
33
Both have advantages & disadvantages
Data-Driven Modeling First-Principles Modeling Complete Modeling Environment
Advantages: Insight in behavior
Physical parameters
Disadvantages: Time-consuming
Requires expertise
Advantages: Fast
Accurate
Disadvantages: Requires plant
Requires data acquisition system
34
Tools that span both modeling approaches
Simulink Design
Optimization Simulink
First-Principles
System Identification
Toolbox
Data-Driven
Physical Modeling Tools
Complete Modeling Environment
Test and Measurement
Tools
35
Physical Systems in Simulink
Sim
Mech
an
ics
Mechanical dynamics (3-D)
Sim
Dri
ve
lin
e
Drivetrain systems (1-D)
Sim
Hyd
rau
lic
s
Fluid power and control
Multidomain physical systems
Electrical power systems
Sim
Po
we
rSys
tem
s MATLAB, Simulink
Sim
Po
werS
yste
ms
Simscape
Sim
Mech
an
ics
Sim
Dri
velin
e
Sim
Hyd
rau
lics
Sim
Ele
ctr
on
ics
Sim
Ele
ctr
on
ics
Electromechanical and
electronic systems
Simscape
36
Estimation of DC Motor Parameters
Untuned Parameters • Resistance
• Inductance
• Damping
• Intertia…
Tune
Parameters
with
Optimization
37 © 2011 The MathWorks, Inc.
Break
38
DC Motor Controller Design
39
Or we can fine tune our controller gains by
optimizing the system response…
Use Simulink Design Optimization to set graphical constraints on relevant signals and optimize the controller gains against the nonlinear system response
reference +
-
controller
S1 S2
S3
40
Models designed in Simulink and Stateflow
You want to run, test, and prove your Simulink design with your hardware under test at its normal operating frequency, speed, or timing.
But how can you do this testing in real-time?
?
From Simulation to Real-Time Testing
41
… How can you do this testing in real-time?
Use xPC Target!
xPC Target and xPC Target Turnkey systems create a hard
real time environment for testing your Simulink models.
42
Real-Time Testing Scenarios:
Functional Rapid Prototyping
Wiring and
Signal Conditioning
Real-Time Target Computer Production Plant Hardware
Code
Generation Execution
Host/Target
Real-time
43
Real-Time Testing Scenarios:
Hardware-in-the-Loop (HIL) Simulation
Wiring and
Signal Conditioning
ECU or MicroController
Code
Generation
Code
Generation Execution
Host/Target/Target
Real-time
Real-Time Target Computer
44
Host computer
with MATLAB
xPC Target on
Target Computer
xPC Target runs Simulink in hard real-time
Ethernet or RS 232
1
2
3
Environment allows the real-time execution of Simulink models on a
separate PC-based target computer
45
Ethernet or RS 232 Host
computerwith
MATLAB
xPC Target on
Target Computer
xPC Target enables tuning parameters in real-time
Ethernet or RS 232
Environment provides interactive access between the real-time
application and the host computer
Allows live parameter tuning, control from the original Simulink
model and offline analysis support in MATLAB.
Host computer
with MATLAB
xPC Target on
Target Computer
46
Ethernet or RS 232
3
1
2
4
2
Environment provides interactive access between the real-time
application and the host computer
Allows live parameter tuning, control from the original Simulink
model and offline analysis support in MATLAB.
Host computer
with MATLAB
xPC Target on
Target Computer
xPC Target enables quick data analysis with MATLAB
47
xPC Target on
Target Computer
Ethernet or RS 232
xPC Target on
Target Computer
Environment provides numerous I/O device driver blocks
Blocks are easily configurable within the Simulink model and
communicate with actual hardware in real-time.
Host computer
with MATLAB
xPC Target enables quick data analysis with MATLAB
48
Environment provides numerous I/O device driver blocks
Blocks are easily configurable within the Simulink model and
communicate with actual hardware in real-time.
xPC Target on
Target Computer
xPC Target provides I/O driver blocks in Simulink
49
Complete, fully assembled, real-time testing solution
Combines xPC Target (software) with a real-time target
machine and IO modules (hardware)
Optimized for Simulink and xPC Target
xPC Target Turnkey
Why xPC Target Turnkey?
50
Portfolio of real-time target machines
Assembled to meet your performance and I/O requirements
Various form factors for office, lab, and field use
Made and optimized for the use with Simulink and xPC Target
What is xPC Target Turnkey?
51
Wide range of I/O modules installed
in your target machine and fully tested
What is xPC Target Turnkey
IO Type Functionality
Analog High-resolution, high-speed, simultaneous sampling
Digital TTL, 12V, 24V, high-drive, opto-coupled
Serial RS232, RS422, RS485, SDLC, HDLC
Protocols SPI, I2C, SSI, CAN, Ethernet, UDP, J1939, ARINC 429, MIL-STD-1553
Audio/Speech Audio/Speech optimized analog IO modules, XLR panels
Shared Memory Reflective Memory for high speed data transfer in multi-processor systems
Various LVDT/RVDT, Synchro/Resolver,
Configurable FPGA • 3 phase motor control
• Pulse train (PWM, capture, quadrature decoding, hall effect)
• Event based interrupts
• Analog I/O with lowest latency and/or special synchronization schemes
• Algorithmic implementations for very fast inner control loops
52
FPGA Programming for xPC Target
Execute high-speed algorithms on an FPGA connected to a model
running in real time with xPC Target.
Automatically program the FPGA without needing to know HDL code
- ideal for functional testing and verification.
Quick reconfiguration of FPGA IO promotes a flexible real-time
testing environment.
Compatible with both new and existing xPC Target Turnkey systems.
Programming FPGA boards for xPC Target Turnkey real-time target machines using Simulink HDL
Coder Workflow Advisor.
53
Next Steps…
Visit www.mathworks.com – Product literature
– MATLAB Central
– Live and recorded webinars
Use the eval form to request more information – Passcodes to for evaluation of products
– Follow-up meeting or phone call
– Pricing and licensing
– Training; public and on-site classes
Feel free to ask questions afterwards