您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > MBSD2 Lecture 8 Post Processing
1AdvancedModel-Based-SystemDesignLecture8:PostProcessingLecture8:PostProcessingPostProcessing•Nowthatwehaveamodelfortheentirecar,andasimplecontroller,wewouldliketomakesomeefficiencycalculationsfor2tomakesomeefficiencycalculationsforthevehicle.•Thesecalculationswillbedoneafterthemodelruns.•Wewillneedtocollectdatafromthesimulation,andthenuseMATLABtoperformcalculationsonthedata.Copyright2009Rose-HulmanInstituteofTechnology.2PostProcessing•Wewouldliketocalculatethefuelefficiencyofourvehicle.•Ifourengineusedgas,thiswouldbeeasy:3gg,yefficiency(milepergallon)isthedistancetravelleddividedbytheamountoffuelusedingallons.•Youmightthenask,whatabouttheelectricalenergyusedtomovethecar?Ifweranoffthebatteryonly,doesthecargetaninfinitevalueofefficiency(mpg)sincenogasisused?PostProcessing•Furthermore,wewillbeusingafuelotherthangasoline.•Inthefuture,vehicleswillrunoffofavarietyofdifftfldldliktbblt4differentfuels,andwewouldliketobeabletocomparetheefficiencyofallofthesevehicleinanapples-to-applescomparison.•Wewilluseamethodcalledmilespergallon,gasequivalent(mpgge)wherethemileageofourvehicleisconvertedtotheequivalentmilespergallonhadisconvertedtotheequivalentmilespergallonhadreformulatedgasoline(RFG)beenthefuelstock.•Wewillalsousestateofchargecorrectiontoincludetheenergyusedfromthebattery.Copyright2009Rose-HulmanInstituteofTechnology.3PostProcessing•Forourvehicle,wewillassumethatweareusing20%biodieselfuel(B-20).•Thisis20percentbiodiesel,80percentpetroleum5p,ppdiesel.•WewillfirstcalculateconventionalmpgforB-20.•Thisiseasy:mpg=distancetravelleddividedbytheamountofB-20fuelconsumed(ingallons)–Wealreadyknowtheamountoffuelconsumedingrams.Wealreadyknowtheamountoffuelconsumedingrams.–Wedonotknowhowfarthevehiclehastravelledinmiles.PostProcessing•Wecanhavethemodelcalculatethedistancetravelledbyintegratingthevehiclespeed6vehiclespeed.•Wewillconvertthefuelconsumedingramstofuelconsumedingallonsinthepostprocessingfile.•AddanintegratorandgainblocktotheRearDiffandBodysubsystemasshown.•Addthedistancesignaltothediagnosticsbusasshown.Copyright2009Rose-HulmanInstituteofTechnology.4PostProcessing•Toconvertfrommeterstomilesperhour,dividemetersby1609.34.7PostProcessing•Wearealreadycalculatingfuelconsumedinthemodel,sowedonotneedtoaddasignalforthat8forthat.•InordertousethedatacalculatedduringthesimulationinaMATLABfile,weneedtosavethecalculateddataintheMATLABworkspace.•ThisisdonewiththeMATLABToWorkspacepart(Simulink/Sinkslibrary).•WewillplacetheToWorkspacepartsintheDisplay_and_Loggingsubsystem:Copyright2009Rose-HulmanInstituteofTechnology.5Display_and_LoggingSubsystem•Forthemoment,wewillonlyplacetwoToWorkspaceparts.–Onewillbeusedtologthevehiclespeed,andsimulation9time.–Thesecondwillonlybeusedtologvehicledistance.–Thesecondonewillbecopiedforalloftheothersignalswewanttolog.SpeedandTime•Double-ClickontheToWorkspaceblockfortheVehicle_Speed_mphsignal.Fillintheparametersasshown:10ThedatawillbesavedintheMATLABworkspacewiththevariablenameVehicle_Speed_mph_str.Datefortheentiresimulationwillbesavedsimulationwillbesavedinthestructure.Nodecimation.Everydatapointwillbesaved.Copyright2009Rose-HulmanInstituteofTechnology.6SpeedandTime11Toreducetheamountofdatawesaveintheworkspace,wewillusethesampletimetospecifythatweonlysaveadataatafixedandspecifiedsamplerate.VariableSample_Timewasspecifiedpreviouslyintheinitfileas01secondsSincealloftheinitfileas0.1seconds.SinceallofourscopesandToWorkspaceblockswillusetheSample_Timevariable,wecanchangethedatacollectionsamplerateforallofourblocksatthesametime.Wewillsavethisvariableasastructurewithtime.Thiswillsaveboththedataforthesignalandthetimevectoratwhichthedatapointswerecollected.Althoughwewillnotbeusingthetimevectorinthempggecalculation,wewilluseitlaterformoreinvolvedpostprocessing.PostProcessingFile•Wecanextractthetimeandthevehiclespeeddatafromthestructurebyusingthelinesbelowinthepostprocessingfile:12•Notethatthepostprocessingfileisjustanppgjm-filethatwerunafterthesimulationhasbeencompleted.•SavethefileasVehicle_Post_File.mCopyright2009Rose-HulmanInstituteofTechnology.7Distance_Miles•TheDistance_Milessignalwillbesavedasanarray:13•NoticethatweareusingNoticethatweareusingtheSample_Timevariabletoreducethesizeofthearray.•Theformatisspecifiedasanarray.A1-dimensionalyarraywillbecreatedthatcontainsonlythedataforthespecifiedsignal.ToWorkspace•Whenyouclosethedialogboxes,youwillnoticethattheToWorkspaceblocksnodisplaythevariablenameunderwhichthedatawillbesavedin14theMATLABworkspace.Copyright2009Rose-HulmanInstituteofTechnology.8PostProcessing•EventuallywewilladdToWorkspaceblocksforallsigalsinourmodel.•FortheMPGGEcalculation,weneedthe15,followingsignals:–Battery_SOC–Battery_Voltage_V–Battery_Current_A–Engine_Fuel_Consumed_g•CopytheDistance_MilesToWorkspaceblockforalloftheothersignals(theyallwillbesavedasanarrayandusetheSample_Time).DisplayandLoggingSubsystem16Copyright2009Rose-HulmanInstituteofTechnology.9PostProcessingFile•Wewillnowcreatethepostprocessingfileforourmodel.•Thefirstthingwewilldoisdefineafew17•Thefirstthingwewilldoisdefineafewco
本文标题:MBSD2 Lecture 8 Post Processing
链接地址:https://www.777doc.com/doc-3327091 .html