DSP designs ⢠State charts ⢠Physical modeling ... Convert plant models to C code for hardware-in-the-loop tests ... Model-Based-Design Adoption Scenarios.
MATLAB, Simulink, Simscape, SimPowerSystems, xPC Target: Modelización y prototipado de sistemas eléctricos y electrónicos de potencia
Hotel ME, Madrid 2 octubre 2012
© 2012 The MathWorks, Inc.1
MathWorks Vital Statistics Developers of MATLAB & Simulink 2,400 staff worldwide
Support staff worldwide Development staff in Natick, MA 30% of revenue invested in R&D $700M annual revenue 2012 - orders from 23,000 companies in 128 countries
22
Key Capabilities Drive MathWorks Business
Verification, Validation, and Test
•
Automatic Code Generation
Test and measurement
•
Embedded software
•
•
• •
Model checking
•
DSP software
Code verification Qualification kits
VHDL/Verilog
•
PLC code
• Discrete-event modeling Simulink • DSP designs • State charts • Physical modeling
System Modeling and Simulation
• •
Data Analysis and Algorithm Development
Technical Computing
Rapid prototyping and HIL
•
Control design Signal processing
• •
Optimization Statistics
•
Communication systems
•
Image processing
• Application
MATLAB
deployment
•
Computational finance
• Student version • Instrument and database
•
Video processing
•
Computational biology
• Distributed and
parallel computing
connectivity
1985
1990
1995
2000
2005
• MATLAB
Mobile for iPhone 2010
Founded in 1984
3
MathWorks Investment in Physical Modeling
Magnetics Added To Simscape Pneumatics Added To Simscape Simscape Language Introduced SimElectronics Introduced
Thermal effects optional ports
Code Generation Advances Simscape Diagnostics Improvements
Simscape Introduced SimHydraulics Introduced SimDriveline Introduced SimMechanics Introduced SimPowerSystems Introduced
1998
2000
Simscape-Based Library Introduced
SolidWorks Translator
ProEngineer Translator
Electric Drives Library Introduced
2002
2004
2006
3-D Visualization Improvements AutodeskTranslator Ideal Switching Algorithm Introduced
2008
2010
Second Generation Technology Intf. Elements Editing Modes
2012
2014 4
Optimize System-Level Performance
s3
Controller
System
Sensors
s2
Actuators
+ u
s1
y
Plant
Simulating plant and controller in one environment allows you to optimize system-level performance. – Automate tuning process using optimization algorithms – Accelerate process using parallel computing
5
Detect Integration Issues Earlier
s2 s3
Controller
Plant Model System
Sensors
+ u
s1
Actuators
Plant Specification
y
Plant
Controls engineers and domain specialists can work together to detect integration issues in simulation –
– –
Convert plant models to C code for hardware-in-the-loop tests Distribute models to other internal users without extra licenses Distribute models to external users while protecting IP 6
Modeling & Simulation Adoption
Model-Based-Design Adoption Scenarios
Requirementsbased V&V (“connecting” models to requirements, testing reqs in sim, and modeling the requirements)
System Simulation
Virtual Verification & Validation (using Simulation or Analysis with system models & requirements)
Closed-loop Simulation
(either simple plant models or full system models)
Graphical Specs
System Validation (re-application of tests or test plan from simulationbased testing to hardware-based testing, easy comparison of results from Early Testing to Hardware Testing)
Hardware-in-theLoop
Simulation-based Development
(plant-model code gen, maybe prototype codegen too)
(representing and analyzing the system behavior, then generating code for the portion of interest)
Design Prototyping
Graphical Programming
(algorithm code-gen for HW-based prototyping)
Algorithm Modeling (no plant models)
Simulation
Fully-leveraged Model-Based Design
Real-Time Testing
(graphically representing the algorithm and generating code)
Production
Code Generation Adoption 7
Relative cost to fix an error
What is the Most Expensive Project Stage to Find Errors In? Errors introduced early but found late in the process are expensive to fix!
Errors introduced in: coding phase design phase requirements phase
Requirements phase
Design phase
Coding phase
Testing phase
Project phase where error is fixed Source: Return on Investment for Independent Verification & Validation, NASA, 2004. 8
Start Testing on Day One RESEARCH
REQUIREMENTS
DESIGN Environment Models Thermal
Electrical
Supervisory Logic Control Algorithms
IMPLEMENTATION C, C++ MCU
DSP
VHDL, Verilog FPGA
ASIC
TEST & VERIFICATION
Mechanical
Structured Text PLC
TEST SYSTEM
INTEGRATION 9
Early Verification of Concept • Predict dynamic system behavior by simulating - Less physical prototypes DESIGN Environmental Models Mechanical
Thermal
Control Algorithms
• Use of simulation results for system design - What / if studies - Short iteration cycles
Electrical
Idea
Supervisory Logic
Simple model
Detailed model
10
Appropriate Methods of Modeling
DESIGN Environmental Models Mechanical
Thermal
Control Algorithms
Electrical
Algorit hm Devel opme Control & filter nt (Simulink) Data Modeli ng
algorithms
Control & Supervisory Logics (Stateflow)
Supervisory Logic
Embedded Digital Software Electronics VHDL, C, C++ Verilog
Electronical, thermal, mechanical systems (Physical Modeling)
MCUDSP FPGA ASIC Integr Reuse ation
of legacy code & engineering data from - Cosimulation Implement V&V - Exiting algorithms in C, MATLAB 11
Integrated Control Design • DESIGN Environmental Models Mechanical
Thermal
Control Algorithms
Electrical
Reuse of the model for extracting plant description directly from model Algorit • Automated creation of a linearized small signal hm Devel equivalent model at selected operating points opme • Interactive and automatic control design nt Data according Linear Control Theory Modeli ng
Supervisory Logic
Embedded Digital Software Electronics VHDL, C, C++ Verilog MCUDSP FPGA ASIC
•
Integr Robust control design by considering converter ation behavior at several operating points in parallel Implement V&V
12
Test and validate in real-time RESEARCH
REQUIREMENTS
DESIGN Environmental Models Mechanical
Electrical
Control Algorithms
Rapid Prototyping of Control Algorithms
•
Fast implementation of algorithms in C & HDL for functional testing in RT
Supervisory Logic
IMPLEMENTATION C, C++
MCU
DSP
VHDL, Verilog FPGA
ASIC
Structured Text PLC
Hardware-In-The-Loop Testing of Plant •
Capability of testing critical scenarios without risk of damaging HW
13
Automatic Production Code Generation RESEARCH
REQUIREMENTS
DESIGN
General • Code generation in C/C++, HDL, IEC61131- Structured Text • •
Control Algorithms
•
Supervisory Logic
• IMPLEMENTATION C, C++
MCU
DSP
VHDL, Verilog FPGA
ASIC
Structured Text PLC
Fast implementation by automatic code generation from models Support of fixed point data format in simulation and code generation Prevention of implementation errors Algorithm development independent of implementation HW
C-Code • Integration of Legacy C/C++-Code • Automated integration with variety of Embedded IDEs and µP/DSP
14
Traceability from Requirements to Code RESEARCH
REQUIREMENTS
DESIGN
•
Environmental Models Mechanical
Linking Requirements with Model Blocks and generated Code Find corresponding locations easily in model and code
Electrical
Control Algorithms Supervisory Logic
IMPLEMENTATION
15
Benefits of Model-Based Design RESEARCH
REQUIREMENTS
Predict system behavior in early development state
Handle system complexity
Short iteration cycles
Less physical prototypes
Fast implementation by automatic code generation
Reuse of test cases
DESIGN Environment Models Thermal
Electrical
Supervisory Logic Control Algorithms
IMPLEMENTATION C, C++ MCU
DSP
VHDL, Verilog FPGA
ASIC
INTEGRATION
Structured Text
TEST & VERIFICATION
Mechanical
PLC
16
Modeling Physical Systems With MathWorks Products Modeling Approaches First Principles Modeling
Programming
Data-Driven Modeling
Physical Networks
Statistical Methods
(Simscape and other Physical Modeling products)
(Model Based Calibration Toolbox)
(MATLAB, C)
Block Diagram (Simulink)
Modeling Language
(Symbolic Math Toolbox)
(System Identification Toolbox)
Neural Networks
(Simscape language)
Symbolic Methods
System Identification
Parameter Tuning
(Neural Network Toolbox)
(Simulink Design Optimization) 17
Thinking outside the block Physical network approach vs. Simulink block diagrams
Simulink Blocks are casual – Transfer functions – Input and output ports (signal flow) – Graphically model system equations
Physical “Blocks” are acausal – Bi-directional energy flow – Domain-specific physical ports (electrical, hydraulic…) – Graphically model system topology
18
Conservation is Physical
Simscape generalizes conservation laws across physical domains – i = 0 at every junction (where i is the through variable)
Simscape pre-defined domains: Port Type
Across Variable
Through Variable
Electrical
Voltage
Current
Hydraulic
Pressure
Flow rate
Mechanical (rotational)
Angular velocity
Torque
Mechanical (translational)
Translational velocity
Force
Pneumatic
Pressure and temperature
Mass flow rate and heat flow
Thermal
Temperature
Heat flow 19
Simscape
20
SimPowersystems
21
SimElectronics
SimDriveline
SimHydraulics
Enables physical modeling (acausal) of electrical power systems and electric drives
SimMechanics
SimPowerSystems
Introduction to SimPowerSystems
Simscape MATLAB, Simulink
25kV
Electrical system topology represented by schematic circuit Used by electrical, system and control engineers to develop plant models and test control systems
Breaker
2250 HP Load
3.125 MVA, 2.4kV
22
SimPowerSystems Key Features
Comprehensive block libraries for building power system models Detailed models of common AC and DC electric drives Different simulation modes to speed model execution Ideal switching algorithm, enabling fast simulation of power electronics PowerGUI provides convenient tools for common analysis tasks Extensive set of demonstration circuits and systems 23
Working with SimPowerSystems SimPowerSystems is a tool for modeling the generation, transmission, distribution, and consumption of electrical power
With SimPowerSystems you can: – Quickly build electrical power system models – Model synchronous and asynchronous electric drives – Perform common electrical system analysis tasks – Develop and test controls – Generate code for improved performance 24
Quickly Build Electrical Systems
Build models that look like an electrical schematic: – Three-phase components – Detailed electric drive models – Flexible AC Transmission Systems (FACTS)
Parameterize model using MATLAB® variables Connect to Simulink with sources and sensors Save subsystems for reuse in other models or libraries 25
Model Electric Drives
Combine power electronics, machine, and control algorithm – GUI to assign key parameters – Common strategies for speed and torque control – Adjustable level of fidelity (detailed, averaged)
Common machine types can be used as motors or generators: – – – –
Permanent magnet Synchronous, asynchronous Induction Single phase or 3-phase 26
Calculate Model Parameter Values Asynchronous or PMSM Models
Calculates parameters for equivalent circuit directly from data sheet values
Data Line to Line RMS Voltage Nominal Frequency Full Load Current Full Load Torque Synchronous Speed
Values 400 V 50 Hz 194 A 352 N.m 2982 rpm
– Plot torque speed relationship – Automatically update machine model Compute Block Parameters
Apply to Selected Block
27
Electrical System Analysis
Quick access to tools for common analysis tasks: – – – – – –
Display steady-state V and I Display and modify initial states Perform load flows Display impedance measurements FFT analysis Report generation
Multiple simulation modes – Discrete and phasor modes enable you to speed up simulations
28
Improve Simulation Performance
Ideal switching algorithm – Efficiently recalculate state-space matrix based on states of switches – Displays equations to command window
Enables simulation of ideal switches – Faster simulations (explicit solver, larger time steps) – Does not require difficult parameter values (snubber, etc.) – Remove non-ideal effects, making simulation results easier to interpret
A1x + B1u
A2x + B2u
29
Connecting to Simscape
Electrical connection via interface blocks – Add custom components using Simscape language – Include other domains
Mechanical ports – Synchronous, asynchronous, DC, and PMS machines
30
SimPowerSystems Supports Simscape Editing Mode
Share SimPowerSystems models with other Simscape users
Model Developer Purchases Simscape and add-on products
– Simulate, analyze, generate code without purchasing extra licenses
Function
Full Mode
Restricted Mode
Add or delete regular Simulink blocks
Yes
Yes
Change Simulink solver, simulate
Yes
Yes
Change numerical parameters
Yes
Yes
Access PowerGUI functions, settings
Yes
Yes
Generate code
Yes
Yes
Add/delete blocks from add-on products
Yes
No
Make or break physical connections
Yes
No
Change block parameterization options
Yes
No
Change Simscape Local Solver
Yes
No
Model using Simscape and add-on products
Model Users Purchases Simscape Add-on product installed, No add-on purchases required
31
Developing Control Systems
Implement high-fidelity, nonlinear plant models
u
Extract linear model for use with linear control theory
+
s1
s2 s3
Controller
Ax+Bu=0 Root Locus
Explore interaction between control system and plant
Plant
Real Axis
Bode Plot
Frequency
Optimize system performance
32
SimPowerSystems Demonstration PM Synchronous Motor Drive (ac6_example.mdl)
Discrete solver provides fast, accurate results. 33
– Models look like power network schematic – Three-phase, electric drives, FACTS, etc.
SimElectronics
SimDriveline
SimHydraulics
Enables physical modeling of electrical power systems
SimMechanics
SimPowerSystems
SimPowerSystems Summary
Simscape MATLAB, Simulink
Solvers optimized for fast simulation of high-speed switching electronics – Continuous, discrete, and phasor methods – Ideal switching algorithm
Many analyses are automated – Load flows, FFT analysis, and more
Combining with other physical modeling tools to model multidomain systems 34
ABB Accelerates Application Control Software Development for Power Electronic Controller Challenge Adopt a more efficient development process using tools that accelerate the design of new application software for a high-powered electronic controller for power converters
AC 800PEC controller.
Solution Use MathWorks tools to design and validate their control algorithms while streamlining the application software development process for the controller
Results Development times and costs reduced Development process improved Highly accurate code generated
“Our system engineers can program, simulate, and verify the AC 800PEC controller’s regulation software very rapidly
in MATLAB and Simulink.” Fritz Wittwer ABB Link to user story
35
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 Pendolino tilting train.
Solution Use MathWorks tools for Model-Based Design to design, simulate, and automatically generate production code for safety-critical transportation systems
Results Development time cut by 50% Defect-free, safety-critical code generated and certified Common language established
“When Alstom delivered a Pendolino train to Czech Railways, the railway application was the first with automatically generated code to receive TUV certification.” Han Geerligs Alstom
Link to user story
36
Hydro-Québec Models Wind Power Plant Performance
Challenge Plan the integration of new wind farms into the power system, predict power output, and ensure safe, reliable operation
Turbines on a wind farm.
Solution
“Accurate modeling is essential not
Use MathWorks products to simulate individual wind turbines and wind farms and to generate C code for multiprocessor simulation of entire power systems
only for planning investments but
Results
tools, we can simulate power
Simulation speed increased to real time Equipment needs accurately predicted Dynamic simulations enabled
also to detect situations that can cause an outage. With MathWorks electronics, mechanics, and control systems in one environment, and
our models respond like the turbines we have in the field.” Richard Gagnon Hydro-Québec
Link to user story
37
What is xPC Target?
© 2012 The MathWorks, Inc. 38
Model-Based Design: Early V&V is the Key REQUIREMENTS
Verification & Validation Design Environment
Test
Integration Design Testing Verification
Testing (HIL)
Controller Code Verification
Implementation Embedded Software
C, C++ MCU
DSP
39
Real-Time Testing Scenarios: Functional Rapid Prototyping
Code Generation
Execution Host/Target Real-time
Wiring and Signal Conditioning
Real-Time Target Computer
Production Plant Hardware
40
Real-Time Testing Scenarios: Hardware-in-the-Loop (HIL) Simulation
Code Generation
Execution Host/Target/Target Real-time
Code Generation
Wiring and Signal Conditioning
ECU or MicroController
Real-Time Target Computer
41
What is xPC Target?
1
2
Host computer with MATLAB
xPC Target on Target Computer
3
Ethernet or RS 232
Environment allows the real-time execution of Simulink models on a separate PC-based target computer 42
What is xPC Target? xPC Target on Target Computer
Host computer with MATLAB Host computer with MATLAB
Ethernet or RS 232xPC Target
on Target Computer
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.
43
What is xPC Target?
2
Host computer with MATLAB
xPC Target on Target Computer Ethernet or RS 232
4
2 3 1
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.
44
What is xPC Target? Host computer with MATLAB
xPC Target on Target Computer Ethernet or RS 232
Environment provides numerous I/O device driver blocks Blocks are easily configurable within the Simulink model and communicate with actual hardware in real-time. 45
What is xPC Target? 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. 46