您好,欢迎访问三七文档
1AdvancedModel-Based-SystemDesignLecture3:DriveCyclesandLecture3:DriveCyclesandAdvancedModelsFollowingaDriveCycle•Next,wewillhavethevehiclefollowasimpledrivecycle.WilltlldF2•WewilluseapartcalledFromWorkspace(Simulink/Sources)toreadina2-Dvariable.•Usingtheinitfile,defineavariablecalledSchCycle.Thisistwodimensionalmatrix._y•Thefirstcolumncontainsthetimevaluesandthesecondcolumncontainsthespeedvalues:Copyright2009Rose-HulmanInstituteofTechnology.2FollowingaDriveCycle•Sch_Cycle=•00•1003100•1530•2030•3040•4040•5570•7070•80309030•9030•1000•1200•Yourinitfileshouldlooklikethefollowing:FollowingaDriveCycle4Copyright2009Rose-HulmanInstituteofTechnology.3FollowingaDriveCycle•Runtheinitfiletoloadthevariablesintomemory.•IntheDriverblockaddtheFrom5•IntheDriverblock,addtheFromWorkspacepartwhichislocatedintheSimulink/Sourceslibrary.6ConstantblockreplacedpwithFromWorkspaceblock.Double-clickontheFromWorkspaceblockandmodifyasshown:ChangedtoSch_Cycle.Copyright2009Rose-HulmanInstituteofTechnology.4FollowingaDriveCycle•ClicktheOKbuttontosavethechanges.•Setthesimulationtimetorunfor120seconds7seconds.•Runthesimulationandviewtheplot:8Copyright2009Rose-HulmanInstituteofTechnology.5FollowingaDriveCycle•Weseethatthevehicledoesfollowthespecifiedprofile.•Sincetherearenomechanicalbrakes,the9Sceeeaeoecacabaes,emotorisresponsibleforslowingthevehicle.ÎRegenbrakingisworking.•Weseethebatterydischargeasthevehicleaccelerates.•Weseethebatterychargeasthevehicle•Weseethebatterychargeasthevehicledecelerates.FollowingaDriveCycle•Onequestionwehaveishowclosedoesthevehiclefollowthedrivecycle.•Weneedtoaddadiagnosticoutputtothe10eeedoaddadagoscoupuoedriverblocktodisplaytheSch_Cyclesignal.•WeneedtoaddthissignaltotheVehicleSystemDiagnosticbus.•Weneedtodisplaythissignalonthe•Weneedtodisplaythissignalonthesameplotasthevehiclespeed.Copyright2009Rose-HulmanInstituteofTechnology.6ModifiedDriverBlock11TopLevelBlockDiagram12Thispartadded.Copyright2009Rose-HulmanInstituteofTechnology.7TopLevel–VehicleSystemDiagnosticBus13Thispartadded.DisplayModifications14Whenwerunthesimulation,weseethatthevehiclehasalittletroublefollowingthedrivecycle.Copyright2009Rose-HulmanInstituteofTechnology.815AdvancedModel-Based-SystemDesignReadingDriveCyclesinExcelReadingDriveCyclesinExcelCopyright2009Rose-HulmanInstituteofTechnology.9DriveCycles•DriveCyclesareavailablefromseveralsourcesandinseveraldifferentformats.•WewilluseExceltostoreourdrivecycles17•WewilluseExceltostoreourdrivecyclessinceExcelcanbeusedtoeasilymodifythecycles.DriveCycles•CreateadirectorycalledDrive_Cyclesinyourcurrentworkingdirectory.f18•Wewillkeepallofourdrivecyclesinthisdirectory.•CopythedrivecyclesthatwereprovidedforthisclasstothisdirectoryCopyright2009Rose-HulmanInstituteofTechnology.10AVLDriveCycle19TheSch_Cycletabcontainsthetimeandspeedcoordinatesforthecycle.SchCycleTab.TimeTime(seconds)Speed(mph)DriveCycles•ThespeedintheSch_Cycleworksheetisinmph.•Forthemomentallwewilluseisthe20•Forthemoment,allwewilluseistheSch_Cycleinformationforvehiclespeed.•TheExcelfilecontainsinformationforthebrakepedal,gearselection,grade,andkeyon.Copyright2009Rose-HulmanInstituteofTechnology.11DriveCycles•Asyourmodelprogresses,youmayusesomeoftheothersignals.•Fornowwewillreadinallofthe21•Fornow,wewillreadinalloftheinformation,butwewillonlyusethevehiclespeedinformation.•WewillplacethefollowingcodeinourinitfiletoreadintheexceldrivecyclefileandstoreitinMATLABvariables.22%Readadrivecyclecontainedinanexcelspreadsheet.if(exist('fn')==0)|(fn==0)fn='Drive_Cycles\sch_fu505.xls';elsefn=['Drive_Cycles\',fn];end[fn,pn]=uigetfile('Drive_Cycles\sch*.xls','SpecifyanExcelScheduleFileName',fn);name=[pn,fn];Sch_Cycle=xlsread(name,'SchCycle');Sch_Brake_on=xlsread(name,'SchBrakeOn');SchGearon=xlsread(name'SchGearOn');Sch_Gear_on=xlsread(name,SchGearOn);Sch_Grade=xlsread(name,'SchGrade');Sch_Key_on=xlsread(name,'SchKeyOn');%Convertthegradefrompercenttoradians.Sch_Grade(:,2)=atan(Sch_Grade(:,2)/100);Copyright2009Rose-HulmanInstituteofTechnology.1223if(exist('fn')==0)|(fn==0)fn='Drive_Cycles\sch_fu505.xls';elsefn=['Drive_Cycles\',fn];endendIfvariablefnexists(thefilenamewaspreviousselected),usetheoldnameasthedefaultfilename.Ifvariablefnhasnotyetbeendefined,usefilenamesch_fu505.xlsasthedefaultfilename.24[fn,pn]=uigetfile('Drive_Cycles\sch*.xls','SpecifyanExcelScheduleFileName',fn);name=[pn,fn];OpenaWindowsstylefilenameselectionbox.Thisfunctionreturnsthefilenameandthepath.Concatenatethepathandfilenameintoonestring.Copyright2009Rose-HulmanInstituteofTechnology.1325Sch_Cycle=xlsread(name,'SchCycle');Sch_Brake_on=xlsread(name,'SchBrakeOn');Sch_Gear_on=xlsread(name,'SchGearOn');Sch_Grade=xlsread(name,'SchGrade');Sch_Key_on=xlsread(name,'SchKeyOn');Readindividualworksheetsintoseparatevariables.DriveCycles•Runthissectionofcode.•SelecttheAVLdrivecycle.DilttfiblShCl26•DisplaycontentsofvariableSch_Cycle.Copyright2009Rose-HulmanInstituteofTechnology.1427ContentsofVariableSch_Cycle28Sch_CycleSch_Cycle=005015253525371857187246924610756127561483216701800Copyright2009Rose-
本文标题:MBSD2 Lecture 3 Drive Cycles and Advanced Models
链接地址:https://www.777doc.com/doc-3327090 .html