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

1 / 23
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功