Schnell und effizient durch Automatische Codegenerierung Andreas Uschold MathWorks 2015 The MathWorks, Inc. 1
ITK Engineering Develops IEC 62304 Compliant Controller for Dental Drill Motor with Model-Based Design Challenge Develop and implement field-oriented controller software for sensorless brushless DC motors for use in dental drills Solution Use Model-Based Design with Simulink, Stateflow, and Embedded Coder to model the controller and plant, run closed-loop simulations, generate production code, and streamline unit testing Results Development time halved Hardware problems discovered early Contract won, client confidence established Dental drills featuring ITK Engineering s sensorless brushless motor control. Model-Based Design with Simulink enabled us to reduce costs and project risk through early verification, shorten time to market on an IEC 62304 certified system, and deliver high-quality production code that was first-time right. Michael Schwarz ITK Engineering 2
Development Process Requirements System-Level Specification System Design Environment Physical Components Algorithms Component Design Verification and Validation Code Verification and Validation testing User Acceptance Testing System-Level & Test Complete & Test Design Embedded Software Digital Electronics & Test C, C++ VHDL, Verilog MCU DSP FPGA ASIC Implementation Implementation 3
Automatic Code Generation Requirements C/C++, VHDL and PLC-Code Generation from one model C, C++ VHDL, Verilog User Acceptance Testing Structured Text System-Level Specification System Design Support for Fixed Point Data Format Environment Automatic scaling Supported in Simulation and Code-Generation Physical Components Algorithms Easy integration of legacy C/C++-Code System development Component independent Design of the target MCU Embedded Coder (C, C++) DSP FPGA Code Verification and Validation ASIC testing HDL Coder (VHDL, Verilog) PLC Coder (Structured Text) PLC PLC System-Level & Test Complete & Test Design Embedded DSP & µc Digital Software Electronics C, C++ VHDL, Verilog & Test FPGA & ASIC MCU DSP FPGA ASIC Implementation Implementation 4
Code Generation Workflow Controller 5
C/C++ - Code Generation Products and Hardware Support Packages Embedded Coder Simulink Coder http://de.mathworks.com/hardware-support/ MATLAB Coder 6
Development Process Requirements System-Level Specification System Design Environment Physical Components Algorithms Component Design Verification and Validation Code Verification and Validation testing User Acceptance Testing System-Level & Test Complete & Test Design Embedded Software Digital Electronics & Test C, C++ VHDL, Verilog MCU DSP FPGA ASIC Implementation Implementation 7
POWER BLACK BOX V RCS IN P U T BLUE GREN RED Model-Based Design Verification and Validation Controller? Communication Interfaces Sensors Comm Drivers Generated Algorithm Code *.c / *.h *.cpp / *.hpp Output Drivers M Actuators? A B C Input Drivers Included Target Optimized Code Special Device Drivers Tuning RGBSplit-4 Special Interfaces Scheduler/Operating System and Support Utilities 8
Verification and Validation Prove Equivalency and Check Efficiency with Processor-in-the-Loop (PIL) 9
Use Processor-in-the-Loop to Prove Equivalency Use Simulation Data Inspector to prove functional equivalence Visualize single runs or compare multiple runs to each other! 10
Check Efficiency using Processor-in-the-Loop Profiling Use PIL profiling to check the efficiency of generated code on the target Analyse bottlenecks 11
3 Things to Remember Model-Based Design helps to detect design bugs early Model-Based Design speeds up the development process One tool chain for Model Based Design and Code Generation 12