Real-Time Simulation of Simscape Models

Similar documents
Real Time Testing of PMSM Controller using xpc Target Turnkey solution

Master Class: Diseño de Sistemas Mecatrónicos

Entwicklung mechatronischer Systeme in der Luft- und Raumfahrt

Introduction to Physical Modelling Rory Adams Senior Application Engineer

Physical Modelling with Simscape

How Simscape Supports Innovation for Cyber-Physical Systems

Advanced AC Motor Control S/W Development Sang-Ho Yoon Senior Application Engineer The MathWorks

Vom Konzept zum Modell physikalischer Systeme Smarter Modellieren mit Simscape

Matlab Simulink Simscape

Modeling Power Electronics Components Using SimElectronics and SimPowerSystems Vivek Raju Application Engineer

Real Time Simulation of Complex Automatic Transmission Models. Marius Băţăuş, Andrei Maciac, Mircea Oprean, Nicolae Vasiliu

System modeling using Simulink and Simscape

2015 The MathWorks, Inc. 1

Introduction to Control Systems Design

MathWorks Technology Session at GE Physical System Modeling with Simulink / Simscape

Introduction to Simulink. Todd Atkins

Integrating Mechanical Design and Multidomain Simulation with Simscape

Mathieu Dutré - Application Specialist MBSE. Analysis and optimization of physical models for HIL simulation

Targeting Multi-core Systems from Multi-rate Simulink Models for Hardware-in-the-loop Simulations

Modeling and Simulation of Electromechanical Systems

Physical Modeling of Multi-Domain System

Virtuelle Inbetriebnahme und Optimierung von Robotersystemen mit Simscape The MathWorks, Inc. 1

Model-based Design/Simulation

Integrating Mechanical Design and Multidomain Simulation with Simscape

Modelling, Simulation, and Real-Time Testing for Model-Based Design GianCarlo Pacitti Application Engineer MathWorks

Experiment 8 SIMULINK

Applications of Program analysis in Model-Based Design

Leveraging Integrated Concurrent Engineering for vehicle dynamics simulation. Manuel CHENE MSC.Software France

Model-based Design/Simulation

VT System Smart HIL Testing

SIMPACK - A Tool for Off-Line and Real- Time Simulation

Introduction to Multi-body Dynamics

Mathematical Modelling Using SimScape (Mechanical Systems)

Real-Time Simulation of Modelica-based Models

MATLAB Based Optimization Techniques and Parallel Computing

Plant modeling: A First Step to Early Verification of Control Systems

Mass-Spring Systems. Last Time?

Mit MATLAB auf der Überholspur Methoden zur Beschleunigung von MATLAB Anwendungen

USING THE MATLAB TOOLSET TO IMPROVE EFFICIENCY IN THE EOBD CALIBRATION PROCESS

Paul Goossens Product Director

Real-Time Testing in a Modern, Agile Development Workflow

Rapid Control Prototyping with MATLAB/Simulink Case Study: Ball-on-Wheel

efpgasim Features & Applications

Simulation in Computer Graphics. Particles. Matthias Teschner. Computer Science Department University of Freiburg

Parallel implicit ordinary differential equation solver for cuda. Tomasz M. Kardaś

Lab 2 Modeling from an observed response

IMPLEMENTATION OF BALL-AND-BEAM CONTROL SYSTEM AS AN INSTANCE OF SIMULINK TO 32-BIT MICROCONTROLLER INTERFACE

Modeling HDL components for FPGAs in control applications

Experiment 6 SIMULINK

Multicore Computer, GPU 및 Cluster 환경에서의 MATLAB Parallel Computing 기능

Verification, Validation, and Test with Model-Based Design

Simscape User s Guide. R2014a

How Real-Time Testing Improves the Design of a PMSM Controller

Designing and Analysing Power Electronics Systems Using Simscape and SimPowerSystems

Accelerating Simulink Optimization, Code Generation & Test Automation Through Parallelization

Control System Design and Rapid Prototyping Using Simulink Chirag Patel Sr. Application Engineer Modeling and Simulink MathWorks India

Motor Control: Model-Based Design from Concept to Implementation on heterogeneous SoC FPGAs Alexander Schreiber, MathWorks

Υπολογιστικά πειράματα με το MATLAB Σύνδεση με Arduino & Raspberry Pi Ζαχαρίας Γκέτσης Μηχανικός Εφαρμογών

Design and Verification of Motion Control Algorithms Using Simulation

Simulation of metal forming processes :

Verification, Validation and Test in Model Based Design Manohar Reddy

Ordinary Differential Equations

Modeling Structural - Dynamics Systems in MODELICA/Dymola, MODELICA/Mosilab and AnyLogic

ME964 High Performance Computing for Engineering Applications

Study and implementation of computational methods for Differential Equations in heterogeneous systems. Asimina Vouronikoy - Eleni Zisiou

Automatic Code Generation Technology Adoption Lessons Learned from Commercial Vehicle Case Studies

Industrial PC for real-time rapid prototyping KEY FEATURES

Design optimisation of industrial robots using the Modelica multi-physics modeling language

HPC and IT Issues Session Agenda. Deployment of Simulation (Trends and Issues Impacting IT) Mapping HPC to Performance (Scaling, Technology Advances)

Simulink Based Robot Arm Control Workstation. Figure 1-1 High Level Block Diagram

Introduction to Simulink

High-Value PXI Embedded Controller for Windows. High-Value Embedded Controllers for PXI Express NI PXI-8101, NI PXI NI PXIe-8101, NI PXIe-8102

ANSYS HPC Technology Leadership

Mathematical Methods and Modeling Laboratory class. Numerical Integration of Ordinary Differential Equations

Matthew Morris Lalit Tanwar

Further Developments and Applications of SIMPACK Code Export

Vehicle Load Area Division Wall Integrity during Frontal Crash

ODE IVP. An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable:

Euler s Methods (a family of Runge- Ku9a methods)

Numerical Simulation of Dynamic Systems XXIV

The MathWorks Products and Prices Euro Academic March 2010

Anticipatory Shifting Optimization of a Transmission Control Unit for an Automatic Transmission through Advanced Driver Assistance Systems

Solving Optimization Problems with MATLAB Loren Shure

Hardware and Software Co-Design for Motor Control Applications

SIMPACK Code Export. Customer Application Examples. The Basis for Mechatronic Simulation

MMTO Internal Technical Memorandum #04-3

BMS Testing With CANoe

Tutorial: Getting Started with the LabVIEW Simulation Module

Designing for Reliability and Robustness

Implementation Frameworks: OpenFresco & OpenFrescoExpress

Integration of CAE Tools for Complete System Prototyping EASY5 User Conference May, 2000 Presented by: Joel Tollefson

Simulation in Computer Graphics. Deformable Objects. Matthias Teschner. Computer Science Department University of Freiburg

Capabilities and Advancements of Hybrid Simulation using LHPOST. Gilberto Mosqueda Professor UC San Diego December 11, 2017

Conference Dynamic Simulation in Vehicle Engineering Realtime Simulation of Vehicles Containing Detailed Components

Robert G. Landers. Manufacturing Automation and Control Laboratory (130 Toomey)

Parallel and Distributed Computing with MATLAB Gerardo Hernández Manager, Application Engineer

Hardware in the Loop Simulation of Production Systems Dynamics

ANSYS HPC. Technology Leadership. Barbara Hutchings ANSYS, Inc. September 20, 2011

Introduction to Simulink Design Optimization

AMSC/CMSC 460 Final Exam, Fall 2007

Transcription:

2010 The MathWorks, Inc. Real-Time Simulation of Simscape Models Vehicle Dynamics Motor Planetary Gear Electric Motor Electric Generator DC-DC Converter Battery Controller Hybrid Electric Vehicle Wit ursilo Application Engineer, Physical Modeling MathWorks

Challenge Limited power Max real-time simulation speed of the with acceptable accuracy within hardware capability calculation device Increase model fidelity Require addt l power for numerical calculation 2

Key Points explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Small Step Size Large To move from desktop to real-time simulation, there are four areas where adjustments can be made Few # of Iterations Many Low High Model Fidelity Settings must be found that permit fixed-step, fixed-cost simulation with acceptable accuracy and speed Advances in Simscape make it easier to achieve real-time execution with accurate results Fixed-step explicit solver Controller Maximum Possible Step Size Execution Time Simulation Execution Chosen Step Size Other Tasks Step Size Safety Margin Idle Local fixed-step implicit solver #1 Mechanical Electrical Local fixed-step implicit solver #2 3

Agenda Overview of Application Example (Hybrid Electric Vehicle) Uses of Real-Time Simulation Challenge of Moving from Desktop to Real-Time Configuring Models for Real-Time Simulation Selecting fixed-step solver Configuring fixed-cost simulations 4

Configuring Simscape Models For Real-Time Simulation Model: Vehicle Dynamics Motor Planetary Gear Electric Motor Electric Generator DC-DC Converter Battery Controller Hybrid Electric Vehicle Problem: Configure the model used for desktop simulation so it can be used for HIL testing explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Small Step Size Large Solution: Use Simscape local solvers and other settings to make the model real-time capable Few # of Iterations Many Low High Model Fidelity 5

Uses and Benefits of Real-Time Simulation Uses Hardware-in-the-Loop (HIL) testing Benefits Controller Hardware Ability to test conditions that would damage equipment or personnel Ability to test systems where no prototypes exist Reduced costs in the later phases of development Ability to test 24 hours a day, 7 days a week Real-Time Computer (physical system) 6

Hardware-in-the-Loop Testing S3 S1 S2 Hardware In the Loop (HIL) 7

Challenge of Moving From Desktop to Real-Time Simulation Must find combination of model fidelity and solver settings that permits real-time execution and delivers accurate results Maximum Possible Step Size Larger step sizes result in poor accuracy and robustness Affected by solver choice, # of nonlinear iterations, and model fidelity Chosen Step Size Small explicit ode14x Step Size Backward Euler Solver Choice Large Trapezoidal Rule Minimum Possible Step Size Smaller step sizes result in overrun Execution Time Affected by solver choice, # of iterations and model fidelity Safety Margin Affected by step size Few # of Iterations Many Simulation Execution Processing I/O and Other Tasks Step Size Idle Low High Model Fidelity 8

Steps For Moving to Real-Time Simulation Flowchart describes steps engineers take 1. Obtain reference results 2. Check if real-time capable 3. Configure for fixed-step, fixed cost simulation 4. Find settings that deliver acceptable results and speed 5. Test on real time platform 6. Adjust if necessary 6 Adjust model to make it real-time capable 1 Obtain reference results and estimate step size with variable-step solver Y 2 Is the solver taking too many small steps? 3 Simulate with fixed-step, fixed-cost solver ew results match reference results? Y Acceptable simulation speed? Y 5 Simulate on real-time platform Executes in real time with accurate results? Y Increase iterations and/or decrease step size 4 Success Decrease iterations and/or increase step size 9

Obtaining Reference Results With Variable-Step Solver ecessary to determine if configuration for real-time simulation delivers acceptable results For Simscape models, ode15s or ode23t are recommended 10

Determining If Model Is Real-Time Capable >> semilogy(tout(1:end-1),diff(tout),'-x') Examine step size during simulation to determine: Rough idea of step size for accurate results umber and type of events When step size decreases, an event has occurred Slow recovery indicates dynamics that may require a smaller step size for the fixed-step solver For much of the simulation, the step size is 0.1~0.2s Events Slow Recovery Quick Recovery 11

Adjusting Model To Be Real-Time Capable Low High Model Fidelity Examine simulation results to determine when events occur Find elements model that will be difficult for fixed-step solvers Discontinuities Hard-stops, stick-slip friction Small time constants Small masses with undamped, stiff springs Hydraulic circuits with small, compressible volumes Eliminate or soften these effects Events 12

Recap 6 Adjust model to make it real-time capable 1 Obtain reference results and estimate step size with variable-step solver Y 2 Is the solver taking too many small steps? 3 Simulate with fixed-step, fixed-cost solver ew results match reference results? Y Acceptable simulation speed? Y Increase iterations and/or decrease step size 4 Decrease iterations and/or increase step size 5 Simulate on real-time platform Executes in real time with accurate results? Y Success 13

Explicit vs. Implicit Methods For Choosing a Fixed-Step Solver explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Physical System simulation typically requires a Stiff System Stiff system: A stiff differential equation causes numerical methods to be unstable unless the step size is extremely small. Stiff System is solved better with Implicit Solver. Simscape provides implicit solvers for handling numerically stiff systems Explicit: n 1 yn y hf t, n y n Implicit: y y hf n 1 n n 1, n 1 t y Explicit Implicit Explicit Implicit 14

Choosing a Fixed-Step Solver (Explicit vs. Implicit) explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Choose fixed-step solver based on umerical stiffness of system Computational cost of solver Stiff systems simulate best with an implicit solver Can take larger steps and maintain accuracy Explicit solver requires smaller time step to achieve accuracy comparable to a implicit solver Implicit solvers often require more computational effort per iteration 15

Relative Computational Cost of Solvers explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Test all fixed-step solvers on a nonlinear Simscape model Same step size Same total iterations Most explicit solvers require less cost than ode14x, but will require smaller step size for accurate results Local solvers in Simscape provide best combination of computational cost and maximum step size 16

Configuring Local Solvers In Simscape Configure per physical network Choose solver and sample time Sample rates can be different Must be integer multiple of global sample time Fixed-step explicit solver Controller Local fixed-step implicit solver #1 Simscape Physical etwork Simscape Physical etwork Local fixed-step implicit solver #2 Backward Euler Designed for robustness Tends to damp oscillations Trapezoidal Rule Designed for accuracy Tends to capture oscillations 17

Solution Preventing Overruns by Limiting the umber of Iterations Few # of Iterations Many To prevent overruns, the amount of time spent calculating the solution during each step must be less than the time step Fixed-step solver makes computations per iteration roughly constant Fixed cost sets a maximum number of iterations per time step x x x x x x x x x x x Time required to calculate solution per iteration. Iteration 1 Iteration 2 Iteration 3 Simulation Time True Solution Simulation overrun because too many iterations are required. Real Time 18

Configuring Fixed-Cost Simulations Few Many # of Iterations For Simscape models, fixed-cost simulation requires setting onlinear Iterations in Solver Configuration block for all fixed-step solvers Start with 2 or 3 Increase as necessary For ode14x, additional setting in Solver Configuration panel, umber ewton s iterations If Simscape Local Solvers are used, ode14x is only necessary if continuous equations outside of physical network are numerically stiff 19

Solver Recommendations For Real-Time Simulation of Simscape Models 1. Always try using local solvers a. Backward Euler for robustness b. Trapezoidal Rule for accuracy 2. Always enable fixed-cost simulation a. onlinear iterations in Solver Configuration block b. Additional setting for ode14x in Solver Configuration panel 3. Start with number of nonlinear iterations at 2 or 3 20

Finding Real-Time Settings explicit ode14x Backward Euler Solver Choice Trapezoidal Rule Maximum Possible Step Size Larger step sizes result in poor accuracy and robustness Affected by solver choice and # of nonlinear iterations Chosen Step Size Minimum Possible Step Size Smaller step sizes result in overrun Execution Time Affected by solver choice and # of nonlinear iterations Safety Margin Affected by step size Few Many # of Iterations Small Large Step Size Simulation Execution Processing I/O and Other Tasks Idle Step Size 21

Recap 6 Adjust model to make it real-time capable 1 Obtain reference results and estimate step size with variable-step solver Y 2 Is the solver taking too many small steps? 3 Simulate with fixed-step, fixed-cost solver ew results match reference results? Y Acceptable simulation speed? Y Increase iterations and/or decrease step size 4 Decrease iterations and/or increase step size 5 Simulate on real-time platform Executes in real time with accurate results? Y Success 22

Applying Process To Other Models in Physical Modeling Tools Models Verify the process with 20 models Hydraulic, electrical, mechanical, pneumatic, thermal elements 18 nonlinear, up to 117 states after equation reduction Intel Core 2 Duo E6700 (2.66GHz) running xpc Target Plenty of time for I/O, other tasks, and safety margin Execution Time Simulation Execution Chosen Step Size Other Tasks Safety Margin Idle % of time step spent in simulation execution Max = 18% Average = 3.9% Min = 6e-4% Step Size 23

Key Points explicit ode14x Solver Choice Backward Euler Trapezoidal Rule Small Step Size Large To move from desktop to real-time simulation, there are four areas where adjustments can be made Few # of Iterations Many Low High Model Fidelity Settings must be found that permit fixed-step, fixed-cost simulation with acceptable accuracy and speed Advances in Simscape make it easier to achieve real-time execution with accurate results Fixed-step explicit solver Controller Maximum Possible Step Size Execution Time Simulation Execution Chosen Step Size Other Tasks Step Size Safety Margin Idle Local fixed-step implicit solver #1 Mechanical Electrical Local fixed-step implicit solver #2 24

What is xpc Target? Host PC with MATLAB & Simulink Target PC running a Real-Time kernel Ethernet or RS 232 A Host-Target environment that allows for real-time execution of Simulink models on a PC platform. 25

What is xpc Target? Desktop PC Compact PCI Rack Mounted PC Single Board Computer PC/104 and PC/104+ Open Architecture: A target PC can be almost any PC compatible system with a 32 bit Intel or AMD processor. 26

What is xpc Target? Host PC Target PC Host PC with MATLAB Ethernet or RS 232 xpc Target PC Ethernet or RS 232 An environment that provides interactive access between the real-time application and the host PC. 27

What is xpc Target? Host PC Target PC Ethernet or RS 232 An environment that provides interactive access between the real-time application and the host PC. 28

What is xpc Target? Host PC Target PC Ethernet or RS 232 An environment with numerous I/O device drivers that are easily configurable within the Simulink model to allow for communication with hardware in real-time. 29

What is xpc Target? Target PC An environment with numerous I/O device drivers that are easily configurable within the Simulink model to allow for communication with hardware in real-time. 30

Are White Paper and Model available? http://www.mathworks.com/matlabcentral/fileexchange/26351-real-time-simulation-of-a-hybrid-electric-vehicle http://www.mathworks.com/mason/tag/proxy.html?dataid=12628&fileid=61384 31