ExternalUseTMHands-OnWorkshop:MotorControlToolboxforMagniV-MATLAB/SimulinkModelingandCodeGenerationAMF-ACC-T1114SEPT.2015MikeDoidge|MCDToolboxManagerJohnH.Floros|FieldApplicationEngineerTMExternalUse1Agenda•Overview:20minutes−IntroductionandObjectives−MotorControlDevelopmentToolbox:Libraryblocks,FreeMASTER,andBootloader•Hands-OnDemo:50minutes−MotorKit(DescribeFreescale3-PhaseMotorKit)−ConvertsimplemodeltorunonMotorKitwithMCDToolboxanduseFreeMASTER•ModelBasedDesign:10minutes−ModelBasedDesignSteps:Simulation,SIL,PILandISO26262−SIL/PILHands-OnDemoStep2&3ofMBD•MotorControl:20minutes−FOCSensor-lesscontrolandhowtouseittoturnamotor•MotorControlHands-OnDemo:80minutes−ImplementFOCSensor-lessMotorControlonMotorKit−RunsoftwarefromthemodelanduseFreeMASTERtomonitor•SummaryandQ&A:10minutesTMExternalUse2Introduction:WhatDoWeDo?•OneoftheAutomotiveToolsEnablement&Engineeringgroup’sobjectivesistodevelopsoftwareenablementtoolstoassistourcustomerswithrapidprototypingandacceleratealgorithmdevelopmentontheirtargetFreescaleMCU•ThisincludessoftwaretoolsthatautomaticallygenerateperipheralinitializationcodethroughGUIconfiguration,togeneratingperipheraldrivercodefromaModelBasedDesignenvironmentlikeSimulink™TMExternalUse3Introduction:ModelBasedDesign(MBD)•ModelBasedDesignisbecomingmorecommonduringthenormalcourseofsoftwaredevelopmenttoexplainandimplementthedesiredbehaviorofasystem.Thechallengeistotakeadvantageofthisapproachandgetanexecutablethatcanbesimulatedandimplementeddirectlyfromthemodeltohelpyougettheproducttomarketinlesstimeandwithhigherquality.Thisisespeciallytrueforelectricmotorcontrolsdevelopmentinthisageofhybrid/electricvehiclesandtheindustrialmotorcontrolapplicationspace.•Manycompaniesmodeltheircontrolleralgorithmandthetargetmotororplantsotheycanuseasimulationenvironmenttoacceleratetheiralgorithmdevelopment.•ThefinalstageofthistypeofdevelopmentistheintegrationofthecontrolalgorithmsoftwarewithtargetMCUhardware.Thisisoftendoneusinghandcodeoramixofhandcodeandmodel-generatedcode.MotorControlDevelopmentToolboxallowsthisstageofthedevelopmenttogenerate100%ofthecodefromthemodel.TMExternalUse4Introduction:MotorControlDevelopmentToolbox•TheMotorControlDevelopmentToolboxincludesanembeddedtargetsupportingFreescaleMCUsandSimulink™plug-inlibrarieswhichprovideengineerswithanintegratedenvironmentandtoolchainforconfiguringandgeneratingthenecessarysoftware,includinginitializationroutines,devicedrivers,andareal-timeschedulertoexecutealgorithmsspecificallyforcontrollingmotors.•ThetoolboxalsoincludesanextensiveAutomotiveMathandMotorControlFunctionLibrarydevelopedbyFreescale’srenownedMotorControlCenterofExcellence.ThelibraryprovidesdozensofblocksoptimizedforfastexecutiononFreescaleMCUswithbit-accurateresultscomparedtoSimulink™simulationusingsingle-precisionmath.•Thetoolboxprovidesbuilt-insupportforSoftwareandProcessor-in-the-Loop(SILandPIL),whichenablesdirectcomparisonandplottingofnumericalresults.MathWorksproductsrequiredforMCToolbox:−MATLAB(32-Bitor64-Bit)*−Simulink−MATLABCoder−SimulinkCoder−EmbeddedCoder*Earlierreleasedproductsonlysupport32-bitTMExternalUse5Introduction:ReduceDevelopmentTimeWithMBDandMCToolboxSystemRequirementsModeling/SimulationRapidPrototypeTargetMCUImplementationHILTestingFunctionalTestingTimeUsesoftware-basedmodelvs.paper-basedmethod,andstarttestingatveryearlieststage.ConvertmodeltoSILandnowcantestANSI-generatedsoftware.CanalsouseMClibrarywithSILtesting.WithMClibraryandMCToolbox,testModelusingtargetMCUandcompilerthroughPILtesting.WithMCToolbox,auto-generatecodefordirectinterfaceofperipheralsfortargethardwarewithoutanymanualhandcode.Nowthatmoretestingontargethasoccurredearlierintheprocess,HILtestingtimeisreduced.Fewerdefectsfoundinthisphaseoftesting,wherefindingdefectsisexpensive.UsingFreescale’sMotorControlDevelopmentToolboxwithModelBasedDesignandyoucanreducedevelopmenttimefromthis.ReduceTimefromThis...TMExternalUse6Introduction:ReduceDevelopmentTimeWithMBDandMCToolboxSystemRequirementsModeling/SimulationRapidPrototypeTargetMCUImplementationHILTestingFunctionalTestingTimeToThis!TMExternalUse7Objectives•AfterthisHands-OnWorkshop,youwillbeableto:−UsetheMotorControlDevelopmentToolboxtoauto-generateandbuildsoftwarefortheMCUdirectlyfromtheMATLAB™/Simulink™environment.−ConfiguretheMCUperipheralsrequiredtoimplementthreephasemotorcontrolusingtheMCUandthelow-voltageThreePhaseMotorControlKit.−ImplementFOCMotorControlfromamodelbaseddesignenvironmentandautogeneratethecodetorunthebrushlessDCMotorprovidedwiththeMotorKit.−KnowhowMotorControlToolboxcanhelpwithyourmotorcontroldevelopmentprojectsandFreescaleMCUs.TMExternalUse8Objectives•ExposuretoFreescale’shardware/softwareenablementSignalVisualizationandDataAcquisitionToolModel-baseddesignDriverconfigurationAssignmenttopinsInitializationsetupMotorControlDevelopmentToolboxwithSimulink™MTRCKTSBNZVM128BLDCMotorControlDevKitTMExternalUse9Agenda•Overview:20minutes−IntroductionandObjectives−MotorControlDevelopmentToolbox:Libraryblocks,FreeMASTER,andBootloader•Hands-OnDemo:50minutes−MotorKit(De