ID 023C: Model-Based Control Design Design with a Systematic Perspective SimuQuest Inc. Raymond Turin Co-Founder 12 October 2010 Version: 1.1
Dr. Raymond Turin Co-Founder, Chief Technical Officer Responsible for managing control system and plant model development Lead Developer of Enginuity, an engine modeling tool package that supports virtual control system development. PREVIOUS EXPERIENCE: Many years of industrial experience in model-based engine control design and plant modeling Staff Research Engineer, General Motors Research and Development Ph. D. in Mech. Eng. from ETH Zurich, Switzerland
Renesas Technology and Solution Portfolio Microcontrollers & Microprocessors #1 Market share worldwide * Solutions for Innovation Analog and Power Devices #1 Market share in low-voltage MOSFET** ASIC, ASSP & Memory Advanced and proven technologies In the session 110C, Renesas Next Generation Microcontroller and Microprocessor Technology Roadmap, Ritesh Tyagi introduces this high level image of where the Renesas Products fit. The big picture. * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis).
Renesas Technology and Solution Portfolio Microcontrollers & Microprocessors #1 Market share worldwide * Solutions for Innovation ASIC, ASSP & Memory Advanced and proven technologies Analog and Power Devices #1 Market share in low-voltage MOSFET** This is where our session, 023C: Auto Code Generation: The Shortest Distance From Idea to Implementation, is focused within the ‘Big picture of Renesas Products’ * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis). 4
Microcontroller and Microprocessor Line-up Up to 1200 DMIPS, 45, 65 & 90nm process Video and audio processing on Linux Server, Industrial & Automotive Superscalar, MMU, Multimedia Up to 500 DMIPS, 150 & 90nm process 600uA/MHz, 1.5 uA standby Medical, Automotive & Industrial High Performance CPU, Low Power Up to 165 DMIPS, 90nm process 500uA/MHz, 2.5 uA standby Ethernet, CAN, USB, Motor Control, TFT Display High Performance CPU, FPU, DSC Legacy Cores Next-generation migration to RX H8S H8SX M16C R32C Here are the MCU and MPU Product Lines, I am not going to cover any specific information on these families, but rather I want to show you where this session is focused. General Purpose Ultra Low Power Embedded Security Up to 10 DMIPS, 130nm process 350 uA/MHz, 1uA standby Capacitive touch Up to 25 DMIPS, 150nm process 190 uA/MHz, 0.3uA standby Application-specific integration Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 5
Microcontroller and Microprocessor Line-up Up to 1200 DMIPS, 45, 65 & 90nm process Video and audio processing on Linux Server, Industrial & Automotive Superscalar, MMU, Multimedia All Of Them! Up to 500 DMIPS, 150 & 90nm process 600uA/MHz, 1.5 uA standby Medical, Automotive & Industrial High Performance CPU, Low Power Up to 165 DMIPS, 90nm process 500uA/MHz, 2.5 uA standby Ethernet, CAN, USB, Motor Control, TFT Display High Performance CPU, FPU, DSC Legacy Cores Next-generation migration to RX H8S H8SX M16C R32C These are the products where this presentation applies General Purpose Ultra Low Power Embedded Security Up to 10 DMIPS, 130nm process 350 uA/MHz, 1uA standby Capacitive touch Up to 25 DMIPS, 150nm process 190 uA/MHz, 0.3uA standby Application-specific integration Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 6
Innovation: Innovate Fast and Focused code generation system testing driver integration system integration Use Virtual Development Practice and Focus on Feature Design and IP Development
Agenda Plant Modeling Controller Development Controller Validation HIL Testing Q&A
Key Takeaways By the end of this session you will: Understand the idea of model-based development Understand the importance of plant models for virtual design and validation Understand the power of interactive model-based design and validation Know a lot more about engines and engine control
Terminology Plant: A dynamic system including sensors and actuators that is being controlled using a microcontroller Controller: An algorithm that is implemented on a microcontroller and forces the plant to behave in a predefined way HIL: Hardware-In-the-Loop VPM: Virtual Processor Model
The Big Picture
Why Model-Based Reuse recurring and tested elementary features Summer, adder, divider, multiplier, integrator, etc. Embed features within graphical modeling environment Use feature model blocks Design and link complex features graphically Avoid fat-fingering Test feature design as you go Perform functional feature tests without writing any code Validate integrated system before HW is available Rapid deployment of fully integrated system Embed driver code in the form of model blocks Use automated code generation Use HIL and VPM for system testing
Comparison Traditional development Model-Based Development requirements system testing (HIL testing VPM testing) feature integration system integration feature design requirements feature design system testing driver integration HIL testing VPM testing system integration feature testing code generation feature integration
Key Concepts Use model as single repository for all process artifacts Separate target dependent/target independent functionality Implement centralized data management Implement “wireless” signal transfer
Plant Modeling
Idea Synthesize control feature based on plant characteristics Test and validate feature design in virtual setting Use model in lieu of target HW Plant Model Control Feature plant output feature output feature input Signal Conditioning
Plant Model Overview Control Design Model Simulation Model Support for model-based controller synthesis Simple model described by ordinary (linear) DE Appears in mathematical description of controller equation Example, internal model design, LQ design, Hinf-design, Kalman-Filter Simulation Model Model to support HW design or to validate control design Distributed parameters, partial DE support HW design (engine, machinery, etc.) Examples: computational flow dynamics models finite element models Zero-dimensional, ordinary DE Control system validation and hardware in the loop (HIL) validation physics-based, first principles, physical laws mean-Value, first principles, look-up Real-time capable
Controls Oriented Simulation Model Capture relevant effects between actuators and sensors Computational Efficiency Interactive control system design Real-time execution (HIL) actuators sensors
Plant Model Characterization Physics-based Based on first principles and physical laws (kinematic, dynamic, thermodynamic, and geometric relationships) Mass, momentum and energy storage (Newton, Lagrange, etc.) Gas laws Fick’s laws … Regression-based Based on empirical data Step-response/Frequency response Non-linear approximation Neural network Look-up (mean-value)
Modeling Example: Physics-Based Modeling Mathematical Description Flow in Flow out Mass Balance Tank level Water tank model Flow in Flow out Tank level
Modeling Example: Physics-Based Modeling Matlab Example Tank diameter: 0.5 m Orifice in diameter: 0.03 m Orifice out diameter: 0.03 m
Modeling Example: Regression Based Modeling Step-response Frequency Response Plant Model Plant Model
Plant Model Examples Engine Control Power Window Control Cylinder-by-cylinder engine model Mean-value engine model Matlab Examples Power Window Control Combined motor and window model Matlab Example
Controller Design and Implementation
Control Fundamentals Open-Loop Control Closed-Loop Control Inverse plant dynamic Look-up (inverse mapping) Example in Matlab Closed-Loop Control Signal feedback Classical control Fixed controller structure (P,PI,PID) Modern (model-based) control Intrinsic plant model Examples: Linear Quadratic/Hinf/Internal Model Control Stability and Robustness (e.g., Nyquist) Plant limitations (e.g., system delays) Un-modeled dynamics Example in Matlab: Linear Quadratic Control Plant (nominal and actual): Objective: Controller:
Case Study Development : Engine Control Basic Control Inputs Spark Open-loop: lookup tables Closed-loop: P-control Fuel Open-loop: calibration values Closed-loop: switch-type Throttle/Idle Bypass Control (Air) Open-loop: look-up (driver input) Closed-loop: PI torque control Basic Control Implementation Time-based control Event-based control (crank-angle based) spark fuel air
Engine Control: Open-Loop Control Air Control Open air valves to satisfy torque demand Fuel metering control Maintain stoichiometric A/F-ratio (emissions) Air-charge estimation Conversion into fuel pulse Correction during special operating conditions Spark control Maximize torque (Base spark at MBT) Conditional retard/advance (e.g. idle speed, knock control, etc.)
Example: Spark Control Ignition delay Relationship (Auto-Ignition): Angular delay depends on: Pressure (manifold pressure) Engine speed Maximum Brake Torque: Spark [deg after TDC] Torque [Nm] TDC MBT
Example: Spark Control Implementation Conditions: Start: Retard Calibratable offset (Constant/Lookup) Idle Speed: Retard Base Spark: Lookup Empirical data (MBT) y = f(nrpm,pm) Spark [deg after TDC] Torque [Nm] TDC Control Authority
Example: Air Charge Control Feed-forward Torque Request Driver request Throttle (no control implementation) Idle speed request Idle Bypass Valve Idle Bypass Valve Control: Static relationship between air valve and engine brake torque Conditional Adjustments Start: Calibratable offset Idle speed Calibratable base offset AC adjustment PRNDL adjustment Normal Calibratable lookup
Example: Fuel Control Base Fuel Conditional Adjustments Assess air in cylinder (air charge estimation) Meter fuel to achieve stoichiometric A/F-ratio Conditional Adjustments Start/Warm-up (enrichment) Fill all fuel puddles Account for lost fuel (fuel absorbed in oil) Normal Account for fuel delivery system and injector characteristics
Example: Fuel Control: Base Fuel Air Charge Estimation: Intake Manifold Dynamics
Example: Fuel Control: Conditional Enrichment Fuel Factor Calculation Crank Engine cranking, not firing Fill puddles Enrichment (lookup) Start Engine firing, key on maximum torque Normal Stoichiometry Lookup
Engine Control: Closed-Loop Control Idle-speed control air control (idle bypass valve) spark control Closed-loop fuel control Stoichiometric A/F-ratio control Implementation Issues Time-based all closed-loop control features Event-based open-loop fuel open-loop spark
Closed-Loop Engine Control: Idle Speed Measure engine speed Increase air/spark-advance more torque Decrease air/spark-advance less torque Air control (Idle bypass valve) Nominal valve opening calibratable open-loop control parameter integral feedback control spark control Nominal spark retarded from MBT proportional control
Closed-Loop Engine Control: Fuel (A/F-Ratio) Concept: Measure O2 content in exhaust gas Controller Injector O2-Sensor
Closed-Loop Engine Control: Fuel (A/F-Ratio) Considerations Sensor Characteristic “Binary” information Switch type control Rich (reduce fuel) Lean (increase fuel) Transition (step) 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0.0 0.1 0.2 0.3 0.4 0.5 1.0 1.4 rich lean l Us [V] Us [V] Uupper [V] Ulower [V] fl [-] 1 t [s]
Matlab Example Engine Control Development
Controller Validation
Case Study Validation: Power Window Control Overview Control power window motion Handle special cases Detect obstacles
Control Validation: Requirements-based testing Button up: window moves up Button down: window moves down Both buttons: stop moving Obstacle: Stop moving Test Design Test # Scenario Control Inputs Control Outputs Requirement 1 Button up, No obstacle DsideDrvSwUp (= 1) DsideDrvSwDn (= 0) DriverPositionVolts DrvMtrCurrentVolts DrvMoveUp DrvMoveDn Move up; Stop at limit; 2 …
Power Window Control Validation: Test Harness Design test vectors Design test vectors based on Requirements Use Simulink Signal Builder to implement and store tests Establish base line control model Create functional prototype model with no regard for data types and style guide Run tests until satisfactory functional behavior Validate control system Implement changes Use stored test results from base-line model to validate controls
Matlab Example Power Window Control Validation
Code Generation: Refer to Courses 020L,024L,024C
Questions?
Thank You!