Upload
nemanjaglisic
View
29
Download
0
Embed Size (px)
DESCRIPTION
Design and Analysis of a FSAE Racecar.pdf
Citation preview
ProjectNumber:ECCA101
DesignandAnalysisofaFSAERacecar
AMajorQualifyingProjectReportSubmittedtotheFaculty
oftheWorcesterPolytechnicInstitute
inPartialFulfillmentoftheRequirementsfortheDegreeofBachelorofScience
SubmittedBy
________________________JamesT.Loiselle
________________________JohnPaulMcCann
________________________AlexanderF.Scott
Date:Approvedby:
________________________________
ProfessorEbenC.Cobb
ii
AbstractEachyeartheSocietyofAutomotiveEngineershoststheFormulaSAEColligate
DesignCompetitionforengineeringstudentsfromaroundtheworld.Thecompetitionisjudgedbasedontheengineering,performance,andcostofaFormulastylecardesignedtobeproducedinasmall3000unitproductionrun.ThisprojectusedanuncompletedFSAEracecarthatwasanalyzedbythegroup.Oncethecarwasanalyzed,thegroupdesignedandredesignedthedifferentsystemsofthecar,includingtheintake,exhaust,andpedalbox.Anotheraspectofthisprojectwasstudyingthedifferentsystemsofthecaranddetermininghowtheycanbestbeoptimizedtoproduceanincreaseinperformancebyeitherincreasingthepowerofthecarorreducingtheweight,bothofwhichwouldleadtolowerlaptimesandafastercar.Adataacquisitionsystemwasdesignedtorecorddatafromdifferentsystemstobeusedtohelpoptimizethecar.ThedatasystemwasdesignedtobeeasilytransferredbetweencarsforusebyfutureFSAEteamsatWPI.
iii
AcknowledgmentsThegroupwouldliketothankthefollowingpeople:BarbaraFurhman,forallherhelpwithorderingpartsandguidanceAdamSears,forallhisguidancewithmachiningNeilWhitehouse,foralltherandomquestionsheanswered2012FSAEMQP,fortheirhelpthroughouttheprojectSabertoothRobotics,forkeepingussanethroughoutthisprojectCampusPolice,forhelpingsetuptestingThisprojectcouldnthavebeencompletedwithoutallthehelpandsupportfromthosepeople.
iv
TableofContentsAbstract..........................................................................................................................................................iiAcknowledgments...................................................................................................................................iiiListofFigures.............................................................................................................................................viListofTables.............................................................................................................................................viiListofEquations.....................................................................................................................................viiiIntroduction.................................................................................................................................................1Analysisofthe2009car..........................................................................................................................1PartsNeverDesigned..........................................................................................................................2PartsNeverManufactured................................................................................................................2PartsRedesigned...................................................................................................................................2DataAcquisitionSystem.....................................................................................................................3
PartsManufactured...................................................................................................................................4SwingArmCamAdjuster...................................................................................................................4
PartsDesigned.............................................................................................................................................6ThrottleBody..........................................................................................................................................6Exhaust......................................................................................................................................................9
PartsNeedingRedesign........................................................................................................................10Intake.......................................................................................................................................................10InjectorLocation............................................................................................................................11Runners..............................................................................................................................................13Plenum...............................................................................................................................................15Restrictor..........................................................................................................................................16
PedalBox...............................................................................................................................................17Hub...........................................................................................................................................................19
DataAcquisitionSystemHardwareDesign:................................................................................21FileConsiderations............................................................................................................................21MicrocontrollerSelection...............................................................................................................22PhysicalParameterSensors..........................................................................................................24SuspensionParameterSensors....................................................................................................27EngineParameterSensors.............................................................................................................35
DataAcquisitionSystemSoftwareDesign...................................................................................36
v
InterfaceClassDesign......................................................................................................................36ExternalAnalogtoDigitalConverter.........................................................................................38MLX90614InfraredTemperatureSensor...............................................................................41CANBUSEngineParameters..........................................................................................................42GlobalPositioningSystem(GPS).................................................................................................43Timing.....................................................................................................................................................44MainExecutionProgram.................................................................................................................45
ConclusionsandRecommendations...............................................................................................47Intake.......................................................................................................................................................47ThrottleBody.......................................................................................................................................48DataAcquisitionSystem..................................................................................................................49RecommendationsforFutureTeams........................................................................................50
vi
ListofFiguresFigure1:SwingArmCamAdjusters..................................................................................................6Figure2:CADModelofThrottleBody..............................................................................................9Figure3:UnfinishedInjectorManifold..........................................................................................12Figure4:IntakeRunners.....................................................................................................................15Figure5:InsideLowerPlenum.........................................................................................................16Figure6:2009and2011HubDesigns...........................................................................................20Figure7:HubStockAfterTurningOperation.............................................................................20Figure8:MillingOperationToolPathforHubs.........................................................................21Figure9:CompletedHub.....................................................................................................................21Figure10:FEZRhinomicrocontroller...........................................................................................23Figure11:GHIElectronicsGPSExtension...................................................................................24Figure12:SparkfunMMA7361breakoutboard.......................................................................25Figure13:SparkFunIXZ500breakoutboard...........................................................................26Figure14:PTS60andPTS100slidingpotentiometers...........................................................29Figure15:SpringbasedmountforPTSslidePotentiometer..............................................30Figure16:MLX90614InfraredTemperatureSensor.............................................................33Figure17:TireTemperatureSensormountingbracket........................................................34Figure18:ClassDiagramofSensorInterface..............................................................................38Figure19:ProgramFlowchart..........................................................................................................46
vii
ListofTablesTable1:IntakeRunnerLengthCalculations...............................................................................14
viii
ListofEquationsEquation1:IntakeRunnerLength..................................................................................................14Equation2:10bitADCprecisioncalculationfor60mmpotentiometer........................30Equation3:12bitADCprecisioncalculationfor60mmpotentiometer........................31Equation4:12bitADCprecisioncalculationfor100mmpotentiometer......................31Equation5:AnalogtoDigitalConversionScalarcalculation...............................................39Equation6:AnalogtoDigitalConversionPrecisionlossexample....................................39Equation7:TemperatureSensorScalingcalculation.............................................................41
1
Introduction In2009,theWPIFSAEteamdesignedandbeganmanufacturingaracecarforthe2009FormulaSAEcompetition.Attheendoftheyeartheteamwasunabletocompletethefabricationofthe2009FSAEracecar.Usingthedesignandcompletedpartsfromthe2009FSAEracecar,theMQPgroupfromthisyearcompletedtheFSAEracecar.Inordertocompletethecarthegroupstartedbystudyingthecaranddeterminingwhatpartswerenevermanufactured,whatpartswereneverdesigned,andwhatpartsneededtoberedesigned.Oncethecarwasevaluated,theMQPgroupbegantomanufacture,design,andredesigntheappropriateparts.
Analysisofthe2009car The2009carwasfirstanalyzedbythegrouptodeterminewhichcomponentsneededtobedesignedorredesignedandwhichcomponentsneededtobemanufactured.Avisualinspectionofeachsystemofthecarwascarriedouttodeterminewhatcomponentsweremissing.Alistofmissingcomponentswascompiledfromthisvisualinspection.The2009MQPreportandCADfileswerereviewedbythegrouptodeterminewhatpartsweredesignedduringthe2009MQP,butnevermanufactured..Anotherimportantpartofanalyzingthecarwasdeterminingwhichofthepartsthathadbeendesignedandmanufacturedneededtoberedesignorremanufactured.
2
PartsNeverDesigned ThecomponentsthatwereneverdesignedwasoneofthefirstthingstheMQPgroupworkedon,sincesomeofthemwereneededtogetthecarrunningwiththeenginethatwasonhandusingthestockunrestrictedtune.Thefirstsystemtheteamfoundwasmissingwastheexhaustsystem.Anotherpartthatwasmissingfromthecarwasathrottlebodytousewiththenewintake.In2009anintakewithanintegratedrestrictorwaspurchasedfortheMQPsoonewasneverdesigned.Overthepastyearthethrottlebodythatwasorderedhadbeenmisplacedsotheteamdecidedtofabricateathrottlebodyinsteadoforderinganewone.
PartsNeverManufactured TherewereseveralpartsfromthepreviousMQPthatweredesignedbutnevermanufactured.Asthegroupwasgoingoverthecaronedesignofthecarkeptpuzzlingthegroup;whywasthechainadjusterdesignedtoalsoadjusttheCVTbeltintheoppositedirection.Thepartwasdesignedsuchthattighteningthechainwouldloosenthebelt.ItwasntuntillookingattheCADmodelofthecarandreadingthedesignreportsubmittedtoSAEforcompetitionthatthegroupdiscoveredtheswingarmcamadjuster.
PartsRedesigned Threemajorpartsneededtoberedesignedonthe2009FSAEracecar.ThemostpressingsystemthatneededtoberedesignedwastheintakefromthepreviousMQP.Thetwobiggestproblemswiththeinitialintakedesignwasthefuelinjectorlocationandthethreeweldedbendsintheintakerunnersrightbeforethe
3
intakeportofthecylinderhead.Anotherpartofthecarthatwasinneedofaredesignwasthepedallocation.Theoriginalpedallocationhadtheacceleratorandbrakepedaloverhunginthefootwell,positioningthemastercylinderreservoirsoutsideoftherollenvelopeofthecar,inviolationoftheFSAErules.Thefinalpartthatwasredesignedwasthefronthubsforthecar.The2009hubdesignwasmodifiedtopromoteeaseofmanufacture.
DataAcquisitionSystemDataAcquisitionistheprocessofsamplingdatafromrealworldsystemsso
thatitcanbenumericallyanalyzed.Thisisnecessaryinracingapplicationsasthereisalargedegreeofadjustabilityinracecarsinordertoadaptthemtotrackconditionsaswellasthedriver.Byquantifyingtheparametersofthecar,doubtisremoved;nolongermustoneadjustthesuspensionbasedondriverfeedbackalone.CommercialDataAcquisitionSystem(DAQ)areavailablefromavarietyofmanufacturers,howevertheydonotoffertheflexibilitythatisneededtointegrateasmanyinputsasdesiredontheFormulaSAEracecarswhileremainingsmallandlightenoughtobepackagedinthecarwithoutbeingoverlyobtrusive.Whendiscussingwhatvehicleparameterstocollect,theteamdecidedonthefollowinglist: PhysicalParameters
o Positiono Accelerationo RateofRotation
SuspensionParameters
4
o SuspensionPositiono SteeringPositiono TiresurfacetemperatureGradient
EngineParameterso EngineSpeed(RPM)o ManifoldPressure(MAP)o ThrottlePositiono Air/FuelRatio
Theseparameterswouldallowtheteamtofullyanalyzethedynamicsofthecar,aswellastheperformanceofthedriver.
PartsManufactured
SwingArmCamAdjuster Theswingarmcamadjusterswereoneofthefewpartsthatweredesigned,butnevermanufactured.Toadjusttheswingaxlethemountingboltsthatholdtheswingaxletothechassismounttoaslotallowingthepositionoftheswingaxletobeadjusted.ThispartwasalsodesignedtoadjustthechaintensionindependentoftheCVTbelt.Thediscoveryofthispartansweredoneofthebiggestmysteriesofthe2009car,howthechaintensionisadjustedwithoutadjustingtheCVTBelttension.
5
Figure1:InitialDesignorSwingArmCamAdjuster
Theswingarmcamadjusterisaverysimplewayofadjustingthechaintension.Oneofthemajoradvantagesofthisistheeaseofmanufacturing.Tomanufacturethecamadjustertwoholesweredrilledintothestockmaterial.Oncethetwoholesweredrilledthestockwasmountedtoafixtureplate.Aminordesignchangemadetotheswingarmcamadjusterwashowtheswingarmadjusterisused.Initiallytheadjusterwasmountedpermanentlyusingthesameboltthattheswingarmmountswithandisadjustedusingaspannerwrench,whichcanbeseeninFigure1.Aftermakingaprototypefromacrylictheteamnoticedthatspannerwrenchusedtoadjusttheswingarmcamadjusterdidnotfitintheallottedspaceandcouldnotbeadjusted.Toremedythisproblemtheteamredesignedtheswingarmcamadjustertobeusedasanalignmenttoolusedwhentighteningtheswingarmandnolongerapermanentpartoftheassembly.Oncetheswingarmisboltedinplacetheadjusterisremovedfromthecar.Todothisthemountingholewasmachinedthesamesizeasthespaceralreadyusedintheswingarmmountingbolts.
6
Figure2:FinalSwingArmAdjustInstalled
Figure3:FinalDesignofSwingArmCamAdjusters
PartsDesigned
ThrottleBodyTocompletetheintakesystemitwasnecessarythatathrottlebodybedesigned.Beforedecidingonwhichstyleofthrottlebodytodesign,differentstylesofthrottle
7
bodieswereresearched.Thegroupfocusedtheirresearchonthreedifferenttypesofthrottlebodydesigns;barrel(Figure7),butterfly(Error!Referencesourcenotfound.),andspike(Figure6).Afourthtypeofthrottlebodythatwasconsidered,butnotresearched,theiris(Figure5).TheiristhrottlebodywasusedinapreviousyearatWPI,butthegroupdecidednottopursuetheideabasedonthecomplexityofthemotionneededtoopenthethrottlebody,andthecomplexgeometryofthethrottleplates.
Figure4:ButterflyThrottleBodyFigure5:IrisThrottleBody
Figure6:SimpleCADModelofaSpikeThrottleBody
Oneofthemajordesignadvantagesofthespikeandbarrelisthatatwide
openthrottlethereisnorestrictionintheflowpathofthethrottlebody,unlikethe
8
butterflythrottlebody.Anadvantageofthebarrelandthebutterflythrottlebodyisthesimplicityofthethrottleplatemotion.Boththebutterflyandthebarrelthrottlebodiesusesimplerotationalmotiontoopenthethrottle,wherethespikerequirestheuseofaleverarmtoopenthethrottle.Thebarrelthrottlebodyalsohadaneaseofmanufacturabilityandassembly.Thebarrelthrottlebodyusesasimplehousingandrotatingbarreltoopenandclosethethrottleandcanbeassembledeasily.Thebutterflythrottlebodyisalsosimpletomanufacture,butismorecomplextoassemblesincethethrottleplatesneedtobeattachedtotheshaftonetheshaftisinstalledintothethrottlebody.Thespikethrottlebodyiseasytoassemble,butusesmuchmorecomplexshapesforthethrottlebodywhichdecreasemanufacturability.
Afterresearchingallthreeoptionsforthrottlebodiesthegroupdecidedthatthebarrelwasthebestoption.Thebarrelthrottlebodyhadmanyadvantagesandfewdisadvantages.Thebarrelwasagoodcompromisebetweeneaseofmanufactureandthereducedrestrictionseeninotherthrottlebodyassemblies.The2009MQPhadplannedtouseabutterflythrottlebodyonthiscarandhadpurchasedone.Whendrivingthiscarthethrottlewillbewideopen,givingtheadvantagetothelackofrestrictionwhenatwideopenthrottle.
9
Figure7:CADModelofBarrelThrottleBody
Figure8:SectionViewofThrottleBody
ExhaustThenextmajorsystemthatwasneverdesignedwastheexhaustsystemfor
theengine.TheengineusedfortheFormulacarthisyearhasonlytwocylindersmakingthefabricationoftheexhaustmuchsimpler.Withonlytwocylinderstheexhaustsystemneededonlytwoprimarytubesontheexhaust,whichsavedbothfabricationtimeandmoneyspentontherawmaterials.Anotheradvantageofhavingatwocylinderengineisthereductionofspaceneededtoruntheexhaust.
10
Fewercylindersandexhaustprimariesreducedtheamountofspaceneededtoruntheexhaust.Sincetherewerefewerprimariestherewasalsoareductioninweightoftheexhaustsystem,whichincreasesthepowertoweightratio,whichisamajoradvantageintheFSAEprogram.
Figure9:ExhaustPrimaries
PartsNeedingRedesign
IntakeTheintakewasoneofthepartsoftheintakethatwasinneedofamajor
redesign.Theintakedesignedforthecarin2009hadmanydesignfeaturesthatwereinneedofaredesign.Theoriginalintakedesignusedsectionsofaluminumtubingweldedtogethertocreatetheneededbends.Anotherdesignflawoftheintakewasthelocationofthefuelinjectors.
11
Figure10:2009(left)and2011(right)IntakeDesigns
InjectorLocationThelocationofthefuelinjectorswasthefirstitemthatneededtobe
redesignedontheintake.Whentheenginecomesfromthefactorytheinjectorsarelocatedapproximately12inchesfromtheintakevalves.Thisallowstheinjectorstosprayfuelrightattheintakevalves,allowingthefueltoatomizewhileenteringtheenginecylinder.Inthestockintakedesignthefuelinjectorsaremountedinthesameassemblyasthethrottlebody.Theintakedesignfrom2009alsomakesuseofthethrottlebodyassemblytopositionthefuelinjectors.Whilethe2009intakedesignusesthesamethrottlebodyassemblytoholdtheinjectors,thelocationoftheassemblywasverydifferentthanthestocklocation.The2009designtookthe
12
originalthrottlebodyassembly,removedthethrottleplates,andmountedthemapproximately10inchesawayfromtheintakevalves.Withthefuelinjectorsbeinglocatedsofarfromtheintakevalvesthefuelwouldnotatomizeaswellwhenenteringthecylinder,causingadecreaseinperformance.SincetheFSAErulesrequirethata20mmrestrictorbeusedfornaturallyaspiratedengines,theintakeitselfneedstobeoptimizedtoreduceanydecreaseinperformance.Tokeeptheinjectorsinthestocklocationthegroupdecidedtodesignandmanufactureanaluminumblocksimilartotheoriginalthrottlebodyassembly.Sincethethrottlebodylocationwasnolongergoingtobeasclosetothecylinder,thenewpartwasdesignedtoonlyholdtheinjectorsinplace,makingiteasiertodesignandmanufacture.
Figure11:UnfinishedNewInjectorManifold
13
RunnersThenextpartoftheintakethatwasredesignedwastheintakerunner
plumbing.Inthedesignfrom2009theintakerunnershadtwoweldedbendsrightbeforetheairwouldentertheengine.Withthisdesigntheairflowwouldbeturbulentwhenenteringthecylinder,anddecreasethepowercreatedbytheengine.Sincetheentireintakewasnotfabricated,theteamdidnotknowiftheintakehadbeentunedforanyspecificRPMrange,oriftheintakerunnerlengthswerejustanarbitrarylength.Whenredesigningtheintakerunners,thelengthwasdesignedforaspecificRPMrange.Sincethe2011carusesaCVTinsteadofatraditional5or6speedtransmission,theintakerunnersweredesignedfortheCVTlockupspeed.SinceCVTsusetwopulleystocreateaninfinitenumberofgearstheenginespeedremainsconstantoncetheCVTlocks.SincetheenginewillstayataconstantRPMtheintakerunnersweredesignedaroundtheCVTlockupspeedof7500RPM.Usingtheequationforintakerunnerlengththelengthoftherunnerswascalculatedtobeapproximately29incheslongwhenusingthefirstreflectivevalue.Sincetheintakeislocatedonthebacksideoftheenginetherunnerswereabletousethefirstreflectivevaluefortherunnerlength.Inpastyears,duetospacerestraints,theintakerunnerlengthneedstobedesignedusingthesecondorthirdreflectivevalue.ByusingthefirstreflectivevaluetheintakelengthcanbeoptimizedfortheCVTlockupenginespeedtogetthemostusefulpowerfromtheengine.
Totunetheintakerunnerswavetheoryequationswereusedtodeterminetheidealrunnerlengthforourengine.Theequationusedtocalculatetherunnerlengthwas:
14
Equation1:IntakeRunnerLength
RunnerLength=((EffectiveCamDuration*.25*2550)/(RPM*ReflectiveValue))(.5*Diameter)
Whenusingtheequationforcalculatedrunnerlengththevariablesaredefinedas:EffectiveCamDuration(ECD)equals720CamDuration30indegrees2550isthecalculatedwavevelocityusefrompastMQPresearchininchesper
secondRPMisthetargetedspeedoftheengineinrevolutionsperminuteReflectiveValueisthereflectedwave(1,2,3,n)Diameteristhediameteroftherunnerininches
UsingthatequationtherunnerlengthcouldbecalculatedwiththeidealRPM
thatwewantedtotunetheintakerunnersto.Sincetheenginespeedwillbe7500RPMmostofthetimethegroupdecidedtotunetheintakerunnersforidealpowerat7500RPM.Wealsocalculatedtheintakerunnerlengthformultiplereflectivevaluesandthendeterminedwhatlengthrunnercouldbefitintothecar.Forourapplicationthefirstreflectivevaluewasusedtowraptheintakerunnersaroundtheengineduetothespaceconstraintsoftheseatandchassis.Forthediameteroftheintakerunnersthestockintakediameterwasused.TheintakerunnerlengthcalculationscanbeseeninTable1.
EffectiveCamDuration(Degrees) RPM
Diameter(Inches)
RV1Length(Inches)
RV2Length(Inches)
RV3length(Inches)
402 8500 1.62 29.34 14.265 9.24Table1:IntakeRunnerLengthCalculations
15
Figure12:IntakeRunners
PlenumAnotherpartoftheintakesystemthatwasdesignedwastheintakeplenum.
Intheresearchthattheteamhaddoneaboutintakeplenumsdidnotreallyspecifyaspecificvolumefortheplenum.Sincethereisnoperfectplenumvolumetheteamdecidedtodesignaplenumwithanadjustablevolume.Alloftheresearchtheteamhaddonerecommendedaplenumvolumeintherangeofonetofourtimesthedisplacementoftheengine.Inordertocreateanadjustablevolumeplenumtheintakeplenumwasdesignedtobetwopieces.Theplenumwasseparatedintotheupperandlowerplenum.Theminimumsizeoftheintakeplenumisapproximatelytwotimesthedisplacementoftheengine.Inordertoadjusttheplenumvolumecentersectionscanbeaddedtotheplenum.
16
Figure13:InsideLowerPlenum
RestrictorForeaseofmanufacturingtheintakerestrictorwasdesignedinSolidWorks
andthenprintedusingtherapidprototypingmachine.Therestrictorisaconvergingdivergingnozzle.Ifthiswastobemachinedoutapieceofaluminumitwouldbeamultifixturingoperation,whichwouldaddcomplexitytothepartandpossiblyleadtoamachiningerrorduringtherefixturingofthepart.Byrapidprototypingtherestrictoritcouldbemanufacturedinoneoperationandeliminatethechanceofhavingthetwosidesnotbeingconcentric.Whenmanufacturingpartsontherapidprototypingmachinethereislittletonosetupandtherapidprototypedoesntneedsomeonetowatchovertheoperationtopreventacrashofthemachinetool.Anotheradvantageofusingtherapidprototypingmachineistheweightofthematerial.TherapidprototypingmachineprintstherestrictorinABSplasticwhichislighterthanaluminum.Whendesigningaracecaranyreductioninweightwillbe
17
advantageous.SincethepowerontheFSAEcarsarerestrictedoneofthebestwaystogainanadvantageisbyreducingtheweightofthecartoincreasethepowertoweightratio.
Figure14:RestrictorandUpperPlenum
PedalBox ThepedalboxwasalsoredesignedaspartofthisyearsMQP.Theinitialdesignforpedalsusedoverhungacceleratorandbrakepedal.Thereasonbehindtheoriginaldesignwastoreducethespaceneededforthepedalandbrakeassembly,whichwouldallowatallerdrivetositmorecomfortablyinthecar.Whiletheoverhungpedalsdidallowformoredriverroom,thetopofthebrakepedalandmastercylinderswerebothlocatedoutsideoftherollenvelopeofthecar.Withthetopofthepedalandthemastercylinderslocatedoutsideoftherollenvelopeit
18
wouldallowboththemastercylindersandthepedaltobedamagedintheeventofarolloveroranimpactonthetopofthechassis.Sincetheteamsawthisasasafetyissuethepedalboxwasredesignedtokeepallofthebrakingsystemenclosedwithintherollenvelopeofthecar. Thenewpedalboxdesignusedfloormountedpurchasedpedalsforeasyofassemblyandtoeliminatethecomplexityofmachiningthepedalsorthemastercylindermounts.Byusingfloormountedpedalsallofthepedalcouldbemountedwithintherollenvelopeofthecarandbefullyprotectedintheeventofacrashorrollover.Anotheradvantageofmovingthepedalstothefloorwastheeasyofrunningthebrakeline,whilealsokeepingthemcontainedwithinthechassisofthecar.Runningthebrakelinesinsideoftheframeofthecareliminatesanypotentialchanceofabrakelinegettingdamagedintheeventofacollisionorimpact.
Figure15:RedesignedPedalPlate
Whileredesigningthepedalboxthebrakesystemwasalsostudiedandimproved.Whenthecarwasinitiallytestedinearlybtermthemastercylinderssizedforthecarin2009couldnotlockthereartireswhentestingthebrakes.Afterrecheckingthebrakecalculationsfrom2009thegrouphaddeterminedthatthe
19
brakesweresizedcorrectlyusingtheassumptionthatthewheelsarejustafreelyrotatingmass.Aftermoretestingtheteamdeterminedthattheassumptionoftherearwheelsfreelyrotatingwasincorrect.SincethecarusesaCVTandhasnoclutchthereisnowaytodisengagetheenginefromtheaxle.Sincetheengineandaxleremainconnected,theenginewillcontinuetryingtodrivethewheelswhilethebrakesaretryingtoslowthewheelsdown.Theenginedrivingthewheelsappliesamomentontheaxleintheoppositedirectionofthebrakecaliper,whichreducestheeffectivebraketorqueappliedtotheaxle.Inordertoincreasetheeffectivebraketorquethemastercylinderintherearwasincreasedtoprovideenougheffectivebraketorquetolocktherearwheelsofthecar.Inordertokeepthecorrectfronttorearbrakebiasthemastercylindersusedforthefrontbrakeswasrecalculatedanddeterminedthatasmallmastercylindershouldbeused.
HubThefronthubsoriginallymachinedbackin2009weremachined0.060
inchesoutofround.Thiswasduetomovementinthefixturewhenthehubwasflippedforthefinaloperationinthemill.Toavoidthiserroragainandtoincreaseinthemanufacturability,theinnercollaronwhichthebearingracesitswasreplacedwithtwogroovesforsnaprings.Byusingsnapringsandremovingtheinnercollarweareabletomachinetheinnersectioninoneoperationonthelatheensuringthetruenessofthehub.ThetwohubdesignscanbeseenbelowinFigure16.Thenewhubsweremachinedoutof7075aluminum.
20
Figure16:2009(Left)and2011(Right)HubDesigns
Evenwiththechangestothedesignofthehub,threesetups,onelathe,two
mill,arestillrequiredtomachinethehubs,oneintheHaasSL20andtwointheHaasMinimill.TheCAMsoftwareEspritwasusedtogeneratethetoolpathsandNCcodeforboththeturningoperationsandthemillingoperations.Thefirstsetupinthelathecontourstheoutershapeandinnerportionofthehub.Figure17showsthehubinthelatheafterithasbeenthroughthefirstsetup.
Figure17:HubStockAfterTurningOperation
21
Thefinaltwosetupscontourthetabsforthestudstobepressedintoandthebrakerotortobeboltedto.ThetoolpathscanbeseeninFigure18.Figure19showsthecompletedhub.
Figure18:MillingOperationToolPathforHubs
Figure19:CompletedHub
DataAcquisitionSystemHardwareDesign:
FileConsiderationsWhendecidingwhatformattouse,thesoftwarepackagesusedtointerpretandanalyzethedatawasanimportantfactoronthedatastoragemethod.Mostcommonlyusedsoftware,suchasMATLABandMicrosoftExcel,iscapableofreadingacommaseparatedvalue(.csv)file.Thiscommonfiletypeisalsoeasily
22
generatedinlowpoweredhardwaresuchasamicrocontroller.Also,thesimplenatureofthesefileskeepsfilesizeandwritetimetoaminimum.AnotherusabilityconcernwastheretrievalofthecollecteddatafromtheDAQforanalysis.Inmanysolutionswhichutilizeinternalstorage,atetherisrequiredinordertotransferdatafromtheDAQtothecomputerforanalysis.ThiscancausecomplicationssincetheDAQwhichisfixedtothecariscdirectlyconnectedtothecomputer,andrequirestheDAQtobepoweredinordertotransferdata,whichcouldcauseissuesshouldtheracecarlosepowermidtransfer.Thispromptedtheuseofremovablemedia,intheformofeitheraUSBmassstoragedevice,suchasathumbdrive,orotherremovablemediasuchasacompactflashorSDcard.
MicrocontrollerSelectionWiththesebasichardwareconstraintsinmind,thesearchforasuitablemicrocontrollerwassignificantlynarrowed.AmongthecontenderswereembeddedARMbasedsystems,suchasKITARMbyTechnologicSystems,aswellasanrelativelyobscurechipcalledtheUSBizibyGHIElectronics.Bothoftheseoptionsofferedplentyofprocessorspeedwhilefittinginthetightspacesoftheracecar.GHIElectronics,however,alsoofferstheirUSBizisystemsinvaryingpackagesofdifferentfeaturesandsized,aswellasofferingsoftwarelibrariesforavarietyofexpansions.Inparticular,theFEZRhinoofferedasmallpackage,makinguseofthe72MHzUSBizi,alongwithonboardperipheralssuchasDualCANcontrollers,twoSPIChannels,I2C,fourUARTs,aMicroSDslotandUSBHostandClientControllers.AllofthesefeaturescamesupportedbyaStandardDevelopmentKitdistributedand
23
oftenupdatedbythemanufacturer.Additionally,GHIofferedaGPSextensionfortheFEZRhino.
Figure20:FEZRhinomicrocontroller
TheFEZRhinoalsowastheonlymicrocontrollerinconsiderationthatwasabletobeprogrammedinCSharp(C#),particularlyintheMicrosoft.NetMicroframework.C#allowsquickerapplicationdevelopmentandamoreuserfriendlyprogramingexperiencethroughacombinationofC++performancewithJavaesquesyntax.C#,likeJavaandC++isanobjectorientedlanguagewhichallowsfortheabstractionofdatabeyondthatofpurelyprocedurallanguageslikeCorassembly.Thisallowedformucheasierintegrationofsensorswhichoperateondifferentinterfaces.ThisalsoallowedtheuseofMicrosoftVisualStudio,amuchmorepowerfuldevelopmentenvironmentwhencomparedwithotheroptions,suchasEclipse.
24
PhysicalParameterSensors
Position
GHIElectronics,themanufactureroftheFEZRhinomicrocontroller,offeredaGPSextensionwhichwouldintegrateeasilyintothemicrocontroller.Thiswasanobviouschoiceasitwasdesignedtointegrateeasilyintothemicrocontrollerandwasofferedwithapremadesoftwarelibrary.
Figure21:GHIElectronicsGPSExtension
Acceleration
Inordertomeasuretheaccelerationofthevehicle,anAccelerometerwasrequired.Inparticular,bothlateralandlinearaccelerationmeasurementsweredesired.Thisledtothesearchforadualaxisaccelerometer;however,notmanydualaxisaccelerometersexist.Mostapplicationsuseathreeaxisunitsincethecostdifferenceisnegligibleandallowsforadditionalmountingoptions.Additionally,mostallaccelerometerchipsaresomevarietyofsurfacemountpackages.Thisisa
25
minorannoyancesincesolderingsurfacemountcomponentsismuchmoredifficultthantraditionalthroughholecomponents.
Figure22:SparkfunMMA7361breakoutboard
Thankfully,manycompanies,suchasSparkFunElectronics,Parallax,andPololuRobotics&Electronics,offerpremadebreakoutboardsthatallowuseofsurfacemountcomponentsintraditional0.1inchpitchthroughholeapplications.Inparticular,SparkFunElectronicsofferstheFreescaleSemiconductorMMA7361L3axisaccelerometerinabreakoutboardwithanoverallsizeoflessthanonesquareinchandprovidingeasyaccesstoallofthenecessarypinsontheaccelerometer.TheMMA7361offersauniquefeatureofselectablesensitivities.Bydrivingapinhighorlow,onecanchoosebetweeneither1.5gor6granges.Intheory,theracecarshouldnotbeabletoreachfarbeyond1.0glateralacceleration,howevertherehavebeenFSAEcarsinthepastthatreachwellover2.0gwithadvancedaerodynamicpackagesthathavesincebeenbannedfromcompetition.Thus,fortheneedsoftheFormulateam,thelowersettingshouldbesufficient,however,ifitis
26
necessarytomovetothehighersetting,simplychangingajumper,orswitchingawirewillallow4timesgreaterrange.
RateofRotation
Inordertomeasuretherateofrotationofthechassis,aGyroscopewasnecessary.Therateofrotationaroundtheverticalaxiswasthemaintopictowatch,aswellasbodyroll,therotationaroundtheaxispassingthroughthecaralongitslengthtohelpanalyzetransitionsfromturningleftandright,suchaswhendrivingaslalom.2axisMEMS(MicroElectroMechanicalSystem)Gyrosarecommonlyavailablefromavarietyofmanufacturers,suchasAnalogDevices,InvenSense,andSTMicroelectronics.AswiththeAcclerometers,themajorityofMEMSbasedGyrosaremadeinsurfacemountpackages.Thisagainpromptedtheuseofabreakoutboard,againfromSparkFunElectronics.Inthiscase,thebreakoutboardusestheIXZ500dualaxisgyrofromInvenSense.Thiscomponenthasahighandlowprecisionoutputforbothaxes.Thisallowsthemonitoringofsmallvariationsinrotation,suchasduringdriving,andthenmeasurerapidrotationsuchasduringaspin.
Figure23:SparkFunIXZ500breakoutboard
27
Velocity
TheVelocityofthevehicleisnotnecessarilyaneasyvaluetomeasure.Thespeedometeronaroadvehicleisbasedoffofthecalibratedinputfromavehiclespeedsensorontheoutputshaftofthetransmission.Consequently,changingthesizeofthetires,orthegearingafterthetransmissioncandramaticallythrowoffthereading.Additionally,ifthedrivenwheelsarenotinaconstantstateoftraction,thesereadingscannotnecessarilybetrusted.Giventhatvelocityistherateofchangeofthepositionofanobject,andtheintegralofacceleration,calculatingthevelocitybasedoffofthedatacollectedfromtheGPSandaccelerometerisamuchsaferwaytocalculatevelocitywithoutbeingaffectedbychangesinthedrivetrain.
SuspensionParameterSensors
SuspensionPosition
Physicalsensor
Inordertofindasolutiontomeasurethepositionofthesuspension,commonracingdataacquisitionsystemswerelookedatforinspiration.Thestandardwaytomeasurethesuspensionisalinearmotionpotentiometer,connectedinparallelwiththespring/damperassembly.However,theuniquedesignofthefrontsuspensiononthecurrentracecarpresentedachallengesincethelowerpushrodconnection,therocker,andthedamper/springassemblyarenonplanarwithoneanother.Atthispoint,afewideaswerediscussed,suchasarotationalpotentiometerplacedononeofthesuspensionmountingpoints,ortherocker.However,thiswouldprovide
28
verylimitedsensingabilitysincethesuspensionarmsdonotrotatethroughaverylargerangeofmotion.Atthispoint,itwasdeterminedthatmeasuringthesuspensionpositionbasedoffofthecompressionofthespringwouldbethebestwaytoapproachtheproblem.Byusingashorterlinearmotionpotentiometer(nottobeconfusedwithalinearrotationalpotentiometer,wherelinearreferstotherelationshiptoresistanceandpotentiometerposition,asopposedtoalogarithmicpotentiometerusedinaudioapplications),andmeasuringdirectlyatthespring,complianceinthecontrolarms,pushrod,androckerisignoredbythesystemandthedamperandspringaremeasureddirectly,astheyarewhatisadjustableonthecar.Thespringsonthecarare150mminlength,whichissignificantlylessthanmostapplications.Thus,asmallerlinearmotionpotentiometerthanthosecommonlyusedinracingwasnecessary.Acommonapplicationofsmallslidingpotentiometersisaudiomixingboards.Conveniently,audiocomponentsareusuallyhighqualitywhichleadstoarobustandprecisepotentiometer.
29
Figure24:PTS60andPTS100slidingpotentiometers
Bourns,amanufacturerofmanydifferentshapesandsizesofpotentiometers,hasmanyselections,includingthePTSseriesofslidepotentiometers.Availableinmanydifferentconfigurations,including3differentlengths,andvaryingdegreesoflinearity,thePTSserieswouldserveourpurposequitewell.Particularly,thePTS6002L103B2offered60mmoftravel,alinearresistancetaperbetween0and10,000Ohms,andsolderlugconnections.
30
Figure25:SpringbasedmountforPTSslidePotentiometer.
SensorInterface
InordertoconvertthephysicaldatafromthePositionofthepotentiometerintoasignalunderstoodbythemicrocontroller,anAnalogtoDigitalConverter(ADC)isneeded.TheFezRhinohasanonboard10bitADC.Thus,thereare1024possiblevaluesthattheonboardADCcanread.GiventhetravelofthePTS60(60mm)andtheprecisionoftheADC,theaccuracyofthesensorcanbecalculated:Equation2:10bitADCprecisioncalculationfor60mmpotentiometer
= 2
60210 =
601024 = 0.05859375
Whilethisiscertainlypreciseenoughtolocatethepositionofthesuspension,thewiringmustalsobeconsidered.Runningawirefromthefrontorrearsuspensionallthewaytowhereverthemicrocontrollerendedupgettingmountedwouldnotbethesafestideaintermsofsignalpurity;racecarsareverynoisyelectrically,especiallyaroundtheignitionsystem.Inordertopreservetheintegrityand
31
accuracyofthedata,aserialsignalispreferredoverananalogonforlongcableruns.Withthisinmind,aseriallyconnectedADCwassoughtsuchthatitcouldbeplacedclosetothesensorstominimizedelectricalnoiseinfluencingthesensorreading.TheMicrochipMCP3204andMCP3208offered12bitprecision,alongwithaSerialPeripheralInterface(SPI),whichtheFEZRhinoalreadyhadonboardhardwaretocommunicatethrough.The12bitvalueallowsforanextrabitofprecisionaswell:Equation3:12bitADCprecisioncalculationfor60mmpotentiometer
60212 =
604096 = 0.0146484375
15mismorethanadequateforthepositionofthesuspensionasthisnumberissmallerthanathousandthofaninch.Thissensorsetupisalsoapplicabletolongerspring/dampersetupsasBournsalsomakesthePTS100series,a100mmequivalenttothePTS60usedcurrently.Forexample,ifafutureWPIFSAEcarrequiredtheextra40mmoftravel,thesystemwouldstillremainextremelyprecise:Equation4:12bitADCprecisioncalculationfor100mmpotentiometer
1004096 = 0.0244140625
SteeringPosition
Typically,steeringpositionwouldbemeasuredusingarotationalpotentiometer,oranencoderontheshaftthatthesteeringwheelisconnectedto.However,whenthecarwasoriginallycreated,noprovisionsformountingsuchsolutionswereprovided.Additionally,theareaaroundthesteeringwheelandsteeringshaftisalso
32
thesameareaoccupiedbythedriverslegs.Thisrequiredthatthemountingofthesensordictatethesensorselection,similarlytothesuspensionposition.Sincetherewasnoopenareatomountarotationalsensorthatwouldnotinterferewiththedriversentranceorexitofthevehicle(animportantsafetyaspectandmeasuredperformanceatcompetitionasdriversmustbeabletoexitthevehicleinasetamountoftimeincaseofafire),alinearsolutionwasconsidered.Itturnsoutthatthesteeringrackhaslessthan60mmoftravelfromlocktolock,whichisconvenientsincethePTS60slidingpotentiometerhadalreadybeenresearchedforuseinthesuspensionposition.Byusingthesamesensorsforbothsuspensionandsteeringposition,lessdevelopmentisnecessarysincetheprecisionofthepositionisthesameasthesuspension,atjustunder15micrometers.
TireTemperatureGradient
Whensuspensionparameterswereinitiallydiscussed,instantaneousmeasurementsofcamberwasdiscussed.Therewasnowaytopackageasystemofsensorstomeasurecamberinrelationtothetrackwithouthavingamajorimpactonthedynamicsofthesuspensionduetoincreasedunsprungweightorhangingoffthesidesofthecarwhichcouldpotentiallyclipconesatanautocrosscourse.Instead,amethodtovalidateifacurrentcambersettingwasdesired.Asacarturns,theoutsidewheelisloaded,andthetiresidewallsflex,effectivelypullingthecontactpatchofthetireunderthecar,causingmoreworktobedoneontheoutsideedgeofthetireifthecarwasnotsetupwithenoughnegativecamber.Withtheincreaseinfriction,thesurfacetemperatureofthatareaofthetireincreasesproportionally.Ideally,thecontactpatchofthetirewouldbeflatatthemostextremelateral
33
accelerationtogetthemostgrippossibleoutofthetire.Thiswouldcauseaneventemperatureacrosstheentirewidthofthetire.
Figure26:MLX90614InfraredTemperatureSensor
Inordertomeasurethetemperatureofthesurfaceofthetire,withoutaffectingthetire,anoncontacttemperaturesensorwasneeded.Manytiretemperaturesensorarraysareavailablecommercially,whicharedesignedforusewithcommercialDataAcquisitionsystems,costingover200dollarspersensor.AmorecosteffectivesolutionwasfoundfromMelexis.TheMLX90614infraredtemperaturesensorhasabuiltin16bitADC,inapackagethatislessthan10mmindiameter.Thestandardmodelmeasuressurfacetemperaturesina90degreeconeemanatingfromitscenter.Byplacingthesensorsapproximately1.5to2inchesawayfromthesurfaceofthetire,threeMLX90614sensorscanbeaimedatthesurfaceofthetirewithnooverlapinordertomeasurethetemperatureinthreeradialbandsaroundtheinside,middle,andoutsideofthetiresurface.Considerationmustalsobemadeinthecaseofanimpactfromdebrisorotherobjectssuchasaconeonanautocrosscoursetoprotectthesensorsfromcollidingwiththetire.InFigure27,thecircular
34
guardspreventthesensorsfromcontactingthetiresurface,aswellasprovidingawiremanagementsolutiontoreducethechanceofdamagetothecircuitry.Thismountingbracketwasdesignedtobemanufacturedusingalasercutter,makingpartseasytoproduceandmodifytosuitthespecificneedsofcurrentandfutureFSAEracecars.
Figure27:TireTemperatureSensormountingbracket
TheMLX90614usesanI2Cinterfacetocommunicatewiththemicrocontroller.Thismethodofinterfacerequiresonlytwowiresinadditiontothepowerandgroundwiresforthesensor.Additionally,thetwocommunicationwiresarecommontoallsensorsontheI2Cbus,whichallowsthesensorstobedaisychainedinline,whereastheSPIinterfaceontheMCP320XADCchipsrequiresachipselectsignaluniquetoeachchipinadditiontoits3commoncommunicationlines.TheMLX90614ispreciseto0.02Celsius,whichismorethannecessaryfornotingthedifferenceintemperatureonthetire.OtherpossibleusesfortheMLX90614couldbeformonitoringbraketemperatures,oranyothersurfacetemperaturedesired.
35
EngineParameterSensorsTheparametersthatweredesiredtobesampledfromtheengine,suchasenginespeedandthrottleposition,arealreadysampledbytheengineitselfinordertodeterminethefuelignitionevents.Itwouldbequiteinconvenienttoaddredundantsensorsinordertosampletheseparameters;thus,amoreelegantsolutionwasdesired.TheHaltechSport2000ECUhasaCANBUSoutputdesignedtoworkwiththeirproprietarydashboard.Thisstreamsalloftheengineparameterstothedashboard,includingtheparametersthatweredesiredtoforlogging.However,duetothenatureofCANBUS,thereisnowaytodeterminewhichvaluesbelongtowhichsensors.UponcontactingHaltech,theygraciouslyprovidedapageofreferencesforwhichvaluescorrespondtowhichsensors.
Figure28:HaltechSport2000ECU
CANBUSsystemscommunicateonabusthatusesapairofdatalines,oneoperatingat+12voltsandtheothermirroringitat12Volts.Thisposesaproblemtointegratewithamicrocontrollerthatrunson+3.3V.ThisisremediedbytheuseofaCANTransceiver,suchastheMicrochipMCP2551,whichisameetsallstandardsforthe8pinCANTransceiverfootprints.
36
DataAcquisitionSystemSoftwareDesignTheFocusofthesoftwaredesignwastointegrateallofthedifferentsensorsinaneasytouseformatwhilemaintainingaslittlecomputationaloverheadaspossibleinordertokeepthetimerequiredtosampleeachvalueaslowaspossible.BecausetheFEZRhinousestheMicrosoft.NetMicroFramework(NetMF),whichisprogrammedinC#,theadvantagesofthehighlevelobjectorientedlanguagecouldberealized.Onemajoradvantageofanobjectorientedlanguage,suchasC#orJava,isthelevelofabstractionwhichcanbeappliedtotheinteractionbetweenthemainexecutionandhardwareinteraction.Thisabstractionisaccomplishedthroughtheuseofaninterfaceclasswhichsetsalistofrequiredmethodsthatallobjectsusingthatinterfacemustcontain.
InterfaceClassDesignInordertorepresentdataina.csvfile,eachpointofdatathatisbeingrecordedneedstwothings:atitletoberecordedinthefirstlineofthe.csvfile,andreadingthatgetsprintedineachsubsequentlineofthe.csvfile.Inordertodothisefficiently,aprogramwouldusealoopinordertoiteratethroughalistofsensorobjects,alloperatinginthesamemanner.Thiscaneasilybedoneifallofthesensorsarereadfromthesamesource,suchastheonboard10bitADC.However,thingsbecomemorecomplexwhenavarietyofsensorcommunicationmethodsareused.Knowingthis,aninterfaceclasswasdevelopedtogovernwhatallthe
37
differentsensorsmustbeabletoreportwhenrequiredbythemainloopoftheprogram.Inthisapplication,theSensorinterfacewasdevelopedwithtwomethods.TheName()methodwasdesignedtoreturntheuniquenameoftheinputrepresentedbythisiterationoftheobject,andtheRead()methodwasdevelopedtoreturnthemostrecentreadingoftheinput.BothofthesemethodswouldreturntheirvaluesintheformofaStringobject,whichconsistsofthevaluealreadyinASCIIcharacterformforimmediateprintingtothe.csvfile.ByrequiringaASCIIoutput,itispossibletorepresentcomplexdatainonefieldonthe.csvfile,suchastheGPSdatawhichisgiveninLatitudeandLongitudecomponents,insteadofrequiringfourfieldsfortheminutesandsecondsofeachcomponentoftheposition.Sinceallthattheinterfacedescribesisabasicblueprint,theobjectsrepresentingeachdifferenttypeofinputarefreetoaddotheradditionalmethods,aslongastheyalsoincludethemethodsrequiredbytheinterface.
38
Figure29:ClassDiagramofSensorInterface
ExternalAnalogtoDigitalConverterManyofthesensorsusedrequireanADCtointerprettheiroutputsinordertobeusefultothemicrocontroller.ForthistasktheMicrochipMCP3204andMCP320812bitADCswerechosen.Offeringeither4or8channelsofconversioncontrolledthroughanSPIconnection,theMCP320Xisabletointerfacewithalloftheanalogoutputsensors,includingtheaccelerometer,gyro,suspensionposition,andthesteeringpositionsensors.Duetothevarietyoftheoutputsofthesesensors,awaytoadjustthevaluesaccordinglywasnecessary.
39
DataScalingandOffset
WhentheADCreturnsavalue,itisscalingavoltagebetweenitsgroundavoltagereferencevaluesfrom0toitsmaximumvalue,whichinthecaseofthe12bitMCP320Xis4095.Thisnumberhasnomeaninguntilitisconditionedtogivemeaningtothevalue.Forexample,iftheinputwasasimplemeasureofanalogDCvoltage,between0and12Volts,ascalecouldbeapplied,relatingamaximumvoltageof12tothemaximumvalueof4095:Equation5:AnalogtoDigitalConversionScalarcalculation
409512 = 341.25
Thus,iftheinputisdividedbytheresultingvalueof341.25,theanalogvoltagecanbefound,suchasareadingof2047,halfthevalueofthemaximumreading:Equation6:AnalogtoDigitalConversionPrecisionlossexample
2047341.25/ = 5.9985348
Thisalsoillustratesthelossofprecisionbyconvertingtoadigitalvalue.Inthiscase,6voltsisreadas5.998volts.Thesevaluesarequiteclosehoweverandtheminisculedifferencewouldlikelynotbemissed.Inadditiontomerelyscalingthesensoroutputs,sometimestheymustbeoffsetinordertoreadvalueslessthan0.Forexample,ifthevoltagemetermentionedinthepreviousexamplewasrequiredtoreadasystemthatvariedfrom6voltsto+6volts,thescalewouldbethesamesincethepotentialdifferencebetweenthegroundandvoltagereferenceisstill12volts,howevera0voltreadingwouldreportas2047fromtheADC.Forthisreason,inadditiontothescalar,anoffsetparameter
40
wasaddedtoeachobjectrepresentingtheexternalADCconnections.ThisallowstheprogrammertousetheMCP320Xchiptointerfacewithavarietyofsensorswithouthavingtowritespecificdriversforeachsensor.Forexample,theaccelerometeroutputvariesbetween0and3.3voltswhichrepresents1.5gto+1.5gaccelerations,whilethesuspensionpositionsensorshavearangeof0to60mm,buthaveastaticpositionthatcouldpotentiallyvaryeachtimeadifferentalignmentordriverisrecorded.
SPICommunication
Inadditiontothedataconditioningrequirements,afewotherparametersmustbeaddedforcommunicationwiththeMCP320Xchips.SincethechipusesaSerialPeripheralInterface(SPI)connection,itmusthaveapinonthemicrocontrollerassignedasthechipselectforeachindividualchip.SPIhas3commonpinsthatconnecttoalldevicesonthebus,theMasterOutSlaveIn(MOSI)communicationline,theMasterInSlaveOut(MISO)line,andtheasynchronizingclockpulse,aswellasalineuniquetoeachchip,theChipSelect,whichcontrolswhichchipsisactivelycommunicatingwiththemicrocontrolleratagiventime.Sincethechipselectvariesfromchiptochip,itisasettablevalueintheconstructoroftheMCPSensorobject.Also,theclockfrequencyisanadditionaladjustmentthatcanbemade,althoughthereislittlereasontonotrunatmaximumspeed,unlessthereisacommunicationissuethatmustbedebuggedandtheavailableinstruments(suchasanOscilloscope)areunabletooperateasfastasthechipsmaximumspeed.TheonlyadditionalinputneedediswhichchanneloftheADCisdesiredforreading.TheMCP3204offers4channels,whiletheMCP3208offers8channels.These
41
channelsareaddressedstartingwith0uptoonelessthanthenumberofchannels.Thisisrepresentedbya3bitspaceinthecommunications,whichistheperfectsizetosendanumberbetween0and7(000and111inbinary).IfanMCP3204receivesanumberabove3(011inbinary)itignorestheleading1,effectivelysubtracting4fromthenumber,assuchitisonlynecessarytowriteonesetofmethodsthatwillworkforboththeMCP3204andMCP3208.
MLX90614InfraredTemperatureSensorTheMLX90614infraredtemperaturesensorsreporttheirvaluesina16bitunsignedvalue.Eachtickhereistheequivalentof0.02Kelvin.InordertoscalethevaluefromtherawdataformintoCelsiusdegreesthefollowingoperationisperformed:Equation7:TemperatureSensorScalingcalculation
[() 0.02] 272.0 = Thisallowsthetemperaturegradientacrossthetiretobeeasilyseenasdifferencesasslightat0.02degreesCelsiusarerecorded.ThemajortroublewithworkingwithmultiplesoftheMLX90614isthecommunication.ThisunitusesanI2Ccommunicationprotocol.I2Cisaverycommonandveryusefulprotocolasitusesonly2wiresinadditiontothepowerandgroundforthechipitisconnectingto,asopposedto4wiresforSPI.However,sinceI2Cdoesnothaveachipselectfunction,everyI2CdevicehasaSlaveAddresssetinitsEEPROM(ElectronicallyErasableProgrammableReadOnlyMemory),andinthecaseoftheMLX90614andmostI2Cdevices,itissettoadefaultvaluefrom
42
thefactory.Inordertochangetheslaveaddressofthesensor,itmustbefirstresetto0x000(0inhexadecimal,representing12zerosinbinary)andthensettothedesirednewaddress.TheMLX90614mustthenbepowercycledforthenewaddresstotakeeffect.Thisprocessmayseemsimple,however,inordertowritetotheEEPROMintheMLX90614,aCyclicRedundancyCheck(CRC)isrequired.TheCRCisanadditionalbyteofdatathatiscalculatedbasedonthebytesprecedingitinthepacket.Thisisusedtocheckforanysortoftransmissionerror.Themainissuehowever,isthattheFEZRhinohassoftwarelibrariestocalculate16and32bitCRCvalues,andtheMLX90614usesan8bitCRC.Sinceonly6sensorsneededtohavetheiraddresseschanged,handcalculationsusinganonlineguidewereperformedinordertospendlesstimewritingamethodtocalculatethe8bitCRCvalues.Aftertheprocessofchangingeachaddress,itwaswritteninmarkeronthesideoftheMLX90614sbody.Thiswouldmakeitmucheasiertomountthesensors,knowingtheaddressofeachsensormountedineachlocation,insteadofhavingtogoaroundandtrytoguesswhichsensorshadaddress0x010versus0x015.
CANBUSEngineParametersTheengineparametersthatweredesiredforloggingwereenginespeed(RPM),ThrottlePosition(TPS),Air/FuelRatio(LambdaorAFR),andManifoldAbsolutePressure(MAP).SincetheseareallavailableovertheCANBUSinterfacefromtheHaltechSport2000ECU,thatwasthebestwaytocapturethisdataasitwouldrequiretheleastamountofadditionalhardware.TheCANBUSsystemworkssimilartoI2Cwhereeverythinghasanaddress,howeverthepacketsarelimitedto8bytesofdatainordertokeepasingledevice
43
fromoverwhelmingothers.Thus,thislimitstheamountofdatathatcancomefromasingleaddress.SincetheHaltechhasmorethan8bytesofdatathatitiscapableofsending,itsendspacketsfrommultipleaddresses.TheHaltechwasdesignedtoworkwithanaftermarketdashboardovertheCANBUSconnection,suchaslongasthefeatureisenabledintheHaltechsoftware,itshouldsenddatacontinuouslyovertheCANBUSconnection.WhenaCANBUSmessageisreceivedbytheFEZRhino,itcreatesaCANMessageReceivedEventwhichishandledbyastaticmethodinthemainexecutionprogram.Inordertostorethedatafromtheseeventhandlers,asortofplaceholderobjectwasneeded.ThisledtothecreationoftheDummySensorobject.TheDummySensorisbasicallystoragelocationencapsulatedwithinanobjectthatcomplieswiththeSensorinterface.WhentheevenhandlerparsesthedatafromtheCANMessageobject,itstorestheappropriatedataintheDummySensorobjectssothattheycanbereadbythenextiterationofthemaindatarecordingloop.
GlobalPositioningSystem(GPS)TheGPSExtensionavailablefromGHIElectronicsforusewiththeFEZmicrocontrollerscomeswithdrivertoactasalayerofcommunicationbetweenthemainprogramandtheGPShardware.Whenthiswastested,itfunctionedasdesigned,howeveritleftsomethingtobedesiredduetoasimplemistake.WhoeverGHIElectronicshadwritetheirdriverusedintegernumbersforboththeHourandMinutecomponentsoftheGPScoordinates.Thislimitedtheprecisionofthedeviceseverely,asoneminuteoflatitudeinWorcester(thelengthofeachdegreevariesdependingonlatitude)isoveronemile,andaminuteoflongitudeis.85miles.This
44
wasnotnearlydetailedenoughtoprovidethenecessarydatatotracethemotionofthecaroverthecourseofasmallautocrosscourse.ThispromptedfurtherresearchintotheoriginandoperationoftheGHIElectronicsGPSextension.TheGPSmodule,manufacturedbySirfTechnology,usesastandardUARTinterfaceandtransmitstheDegreesinintegerform,andtheminutesofLatitudeandLongitudetofourdecimalplaces.ThereisnologicalreasonwhytheGHIprovideddriverdidnotincludetheextraprecision.Thankfullythesourcecodeforthedriverwasprovided,soitwasthenmodifiedtoincludetheaddedprecisionwhichgreatlyimprovedtheaccuracyoftheunit.ThisbetterversionofthedriverwasthenabstractedwithinanobjectthatmeetstherequirementssetbytheSensorinterface.TheoutputformatisasimpleLatitudeandLongitude:Degrees&MinutesLatitudeDegrees&MinutesLongitude.Thistakesonlyoneslotinthe.csvfile,andisverycompact,andeasytoread.
TimingTheFezRhinoincludesaRealTimeClock(RTC)whichcanbesetmanually,orbyrequestingthecurrentdateandtimefromtheGPSsystem.TheRTCkeepstimedowntothemillisecond,whichisadequatefortheneedsoftheDAQas1000ormoresamplespersecondarehighlyunlikely.TheRTCisabstractedinaclass,aptlynamedclockwhichreturnsthetimeinastandardclockform:
Hours:Minutes:Seconds.MillisecondsThismakestheoutputeasytoread,aswellasbeingeasytoparsewhenloadedintoanalysissoftware.
45
MainExecutionProgramThemainexecutionprogramstartsbyloadingallofthenecessaryobjectsintomemory.Thisincludesconstantthingslikethefilenameandwhichpinscontrollightsorareconnectedtoswitches,aswellastheobjectspertainingtothevarioussensorsconnectedtothesystem.AlloftheSensorobjectsareaddedtoanArrayListobject,whichisdynamicallysizedarray.AnySensorobjectswhichrequirezeroingbeforethestartofloggingarezeroedbeforebeingaddedtotheArrayList.Next,theUSBstoragedeviceisdetected,andthefilesystemisloaded.Afterloadingthefilesystem,theDAQscansthefileslistedintherootdirectorytomakesurenottooverwriteanypreviouslogs,incrementingthenumberontheendofthefileuntilitdeterminesthatthefileisnotpresentonthemedia.Next,thefileiscreatedandthefirstlineiswrittenbasedoffoftheSensorobjectsintheArrayList.Next,thesystemgoesintoasemiinfiniteloop.Theloopwillonlyexitwhenthedashboardswitchismovedtotheoffposition.Duringtheloop,theDAQwillcontinuouslyreadfromitssensorssequentially,andwritethereadingstothe.csvfile.Whentheloopisexited,thefileissavedandclosed.Atthispointthesystemgoesintoanotherloopwaitingfortheswitchtobeflippedbackintotheonpositionorforthesystemtoturnoff.Iftheswitchisreactivated,theprogramjumpsbacktothefilecreationprocessandbeginscollectingdataonceagain.
46
Figure30:ProgramFlowchart
47
ConclusionsandRecommendations UsingtheengineeringknowledgegainedfromthepastfouryearsspentatWorcesterPolytechnicInstitutethegroupwasabletoredesigntheintake,pedalplate,andhubsforthe2009FSAEracecar,whilealsodesigningathrottlebodyandexhaust.Muchlikeyearspast,testingtimewaslimitedanddidnotallowtheteamtimetotestthecaranddetermineifanyothersystemswouldfailandneedtoberemanufacturedorredesignedtopreventfuturefailures.
Intake Theintakewasredesignedtoeliminatethepotentialofpoorfuelatomizationandturbulentflowoftheairbeforeenteringtheengine.Thenewlocationofthefuelinjectorswillnowspraythefuelrightattheintakevalves,whichisidealforafuelinjectedengine.Removingtheweldedbendsfromtheintakerunnersandreplacingthemwithsmoothroundbendspromoteslaminarflowofairintotheengine,whichwillhelpmoreeffectivelyfillthecylinder.Allofthesedesignchangeswillgreatlyimprovetheperformanceoftheracecar.
Inordertooptimizetheintakerunnersandplenumsthenextstepwouldbetodynothecartomeasurethepower,andthenadjusttherunnerlengthandplenumvolumeandseehowthechangesaffectthepowerandtorqueoftheengine.Testingthecaronadynometerwouldgivetheteamdataregardingtheoptimumrunnerlengthandplenumvolume.Whiledoingthecalculationtodeterminetheintakerunnerlengthandplenumvolumegiveabaselinetostartthedesignattestingdifferentrunnerlengthsandplenumvolumesandmonitoringthechangein
48
horsepowerandtorqueistheonlywaytovalidatethecalculations.Testingdifferentsizedrunnersandplenumsalsoallowstheteamtoreduceanyerrorsderivedfromestimationsinthelengthofintakeportintheheadandanyportionoftheplenumnotaccountedforintheinitialvolumecalculations.Dynotestingwouldhavealsoprovedbeneficialifthecarhadbeendynoedwiththeoriginalintakesetuptodeterminethegainsfromtheredesignedintakerunnersandplenum.Ifthegroupwasabletomeasureimprovementsfromtestingthedifferentchangesmadetotheintake,itcouldbeveryusefultofutureWPIFSAEteamswhentheyneedtodesignanintakesystem.Wheneverdataisavailableitcanhelpateamdeterminehowtoapproachthedifferentsystemsofthecar.Iftherewereonlysmallgainshadfromdifferentrunnerlengthsandplenumvolumesthenfutureteamscouldspendlesstimeonanintakedesignandputmoreeffortintoanothersystemofthecar.
ThrottleBody Thethrottlebodyisanotherareaofthecarthatcouldbenefitgreatlyfromdynotestingwhilechangingthetypeofthrottlebodybeingused.IftheteamhadtimetomachineabutterflythrottlebodyandspikethrottlebodyandthendynotesteachsetupthatdatacouldprovidevaluableinsightintotheoptimalthrottlebodydesignforaFormulaSAEracecar.Sincethepoweronthecarissolimitedanytestingdonetodeterminewheremorepowercanbemadewillmakealargedifferencewhenacaristakentocompetition.Alsowithmoretestingdatadesignchangescouldbemadetothethrottlebodytotryandgetalittlemorepowerfromathrottlebodydesign,bymakingminorchangestoit.
49
DataAcquisitionSystemTheDataAcquisitionsystemwastestedinalaboratoryenvironment,
howeverduetotheinabilitytotestthecarindynamicevents,therewasneverachancetotesttheDAQonthecarinraceconditions.TheBournsPTSpotentiometersworkwellwhencombinedwiththeMicrochipMCP320Xanalogtodigitalconvertersunderindoortesting,howevertheyhavenotbeenabletobesubjectedtotheconditionsthatwillbemetduringthecourseofadynamicevent.Allthecomputersimulationintheworldcannotfullyreplacerealworldtesting.TestingisthemainrecommendationfortheDAQ,asitwillexposeanyissuesthatmayarise.
Goingforward,TheDAQcouldeasilyevolveintoalargersystemwithmorethanjustdatacollectionfunctions.AnyfunctionsonthecarthatcannotbedirectlycontrolledbytheECU,butrequiremorethansimpleon/offcontrolfromthedrivercouldbeautomatedthroughthemicrocontrollerintheDAQ.Additionally,moresensorscouldbeaddedasthereisplentyofroomontheFEZRhinoforexpansion.Also,thetopicofaddingtelemetrytothecarwasdiscussed,andthenputonthebackburnerasitwasnotnecessaryforthecollectionofviabledata.Telemetrywouldbeausefultoolinthe,aswouldsomesortofwirelesslinktotheECUtoallowenginetuningwithouthavingtostopthecarinordertoreducedowntimewhilemakingmodificationstotheenginecalibration.Asmorefunctionalityisadded,thetasksmayoutgrowthecomputinghardwareastheFEZRhinoisonlya72MHzprocessor.UpgradingtosomethingalongthelinesofaPowerPCchipmaybe
50
necessaryinordertomaintainthefrequencyofdatacollectionaswellacontrollingotherfunctions.
RecommendationsforFutureTeams Overtheyearthegrouplearnedmanythingsthatwerenotdirectlyrelatedtothesectionsofthecarthatweremanufacturedorredesigned.Whilethesewerenotmajorbreakthroughs,theywerealotoflittlethingshereandtherethatshouldnotbeoverlookedbyfutureteams.Oneofthebiggestissuesthegrouprepeatedlyranintowastryingtomountlittlethingshereandthere,whichprovedtobedifficult.Infutureyearstheteamshoulddesignmountsandlocationsforcommonlyoverlookedpartsandcomponentssuchascatchcans,engineelectronics,safetyguardsandthebattery.Testingprovedthattheinitialbatterylocationwasclosetoexhaust,whichcausedthebatterycasingtomelt,resultinginbatterychargingissues.Theengineorientationwasanotherminordetailthatcanbeeasilyoverlooked,butcanmakeabigdifferencewhenthecarisgettingassembledattheendoftheyear.Althoughtheengineorientationonthecurrentcarisinconvenient,therearedesignconstraintswhichrequireittobeinthisorientation.However,othertheorientationofothercomponentsandsystemscouldhavebeenalteredtoalleviatespaceconstraints.Thecockpitofthecarisanothersectionthatcanbeeasilyoverlookedwhendesigningthecar.Tofacilitatetheremovalofseatinserts,theharnessshouldbeabletobeeasilypassedthroughtheinsert. Onefinalrecommendationforfutureteamswouldbetoconsiderallaspectsofthecarwheninthedesignphaseoftheproject.Ifallthesystemsaredesignedwithconsiderationofoneanotheritcanhelptomakeabetteroverallcar.Designing
51
systemsandcomponentsindependentlyofeachothermayresultinpartsinterferingwitheachother,causinglastminutedesignchanges,whichcanleadtobadengineeringpractices.Thiswasacommonoccurrenceinthecompletionoftheracecar.
52
AppendixA:DataAcquisitionSystemCodeMainExecutionProgramusingSystem;usingSystem.Threading;usingSystem.IO;usingSystem.Text;usingMicrosoft.SPOT;usingMicrosoft.SPOT.IO;usingMicrosoft.SPOT.Hardware;usingGHIElectronics.NETMF.Hardware;usingGHIElectronics.NETMF.Hardware.LowLevel;usingGHIElectronics.NETMF.FEZ;usingGHIElectronics.NETMF.USBHost;usingGHIElectronics.NETMF.IO;usingGHIElectronics.NETMF.System;namespaceFSAE_DAQ_2{publicclassProgram{staticCAN.Message[]msgList;staticDummySensorrpm;staticDummySensortps;staticDummySensormap;staticDummySensorAFR;staticDummySensorign;publicstaticvoidMain(){stringfileName="FSAEDaq_log";intfileNumber=001;//DAQonoffswitch,connectedtoboardpin#1,switchingwithground.InputPortDAQ_ON=newInputPort(((Cpu.Pin)FEZ_Pin.Digital.IO62),false,Port.ResistorMode.PullUp);OutputPortusbLight=newOutputPort((Cpu.Pin)FEZ_Pin.Digital.IO60,false);OutputPortDAQGood=newOutputPort((Cpu.Pin)FEZ_Pin.Digital.IO64,false);OutputPortDAQBAD=newOutputPort((Cpu.Pin)FEZ_Pin.Digital.IO66,false);//seterrorlight&USBlightduringsetupDAQBAD.Write(true);usbLight.Write(true);StreamWriterlog;PersistentStorageusb;
53
System.Collections.ArrayListsensors=newSystem.Collections.ArrayList();//CANBUSsentuponCANchannel1for1Mbit/sintT1=15;intT2=8;intBRP=3;//changethisnumbertochangeclockrate3=1Mbit/s;6=500Kbit/sCANcan=newCAN(CAN.Channel.Channel_1,(uint)(((T21)
54
MCPSensorLF=newMCPSensor("LeftFrontSuspensionPosition",(Cpu.Pin)FEZ_Pin.Digital.IO53,0x00,1,0);MCPSensorRF=newMCPSensor("RightFrontSuspensionPosition",(Cpu.Pin)FEZ_Pin.Digital.IO53,0x01,1,0);MCPSensorLR=newMCPSensor("LeftRearSuspensionPosition",(Cpu.Pin)FEZ_Pin.Digital.IO53,0x02,1,0);MCPSensorRR=newMCPSensor("RightRearSuspensionPosition",(Cpu.Pin)FEZ_Pin.Digital.IO53,0x03,1,0);MCPSensorsteering=newMCPSensor("SteeringPosition",(Cpu.Pin)FEZ_Pin.Digital.IO53,0x04,1,(float)2047.0);//setpositionoffsetstocurrentvalues,accountingfordifferentstaticpositionsduetoalignment&driver/carweightLF.offset=LF.rawRead();LR.offset=LR.rawRead();RF.offset=RF.rawRead();RR.offset=RR.rawRead();//AddsuspensionsensorstosensorsArrayListsensors.Add(LF);sensors.Add(LR);sensors.Add(RF);sensors.Add(RR);sensors.Add(steering);//tiretemperaturesensors.sensors.Add(newMLX_Temp("LFoutertemp",0x010,100,1,0));sensors.Add(newMLX_Temp("LFmiddletemp",0x011,100,1,0));sensors.Add(newMLX_Temp("LFinnertemp",0x012,100,1,0));sensors.Add(newMLX_Temp("RFinnertemp",0x013,100,1,0));sensors.Add(newMLX_Temp("RFmiddletemp",0x014,100,1,0));sensors.Add(newMLX_Temp("RFoutertemp",0x015,100,1,0));//CANDatasensors,updatedautomaticallybyCANreceivedevent.rpm=newDummySensor("RPM",1,0);tps=newDummySensor("TPS%",(float)0.1,0);map=newDummySensor("MAPmBar",1,0);AFR=newDummySensor("AFR,Lambda",(float)0.001,0);ign=newDummySensor("ignitionadvance",(float)0.1,0);//detectstoragedevicesDebug.Print("poweron\ndetectingUSBstoragedevices");Thread.Sleep(10);intc=0;while(USBHostController.GetDevices().Length==0){//**seterrorlight,waitforUSBinsertion.Debug.Print("Working..."+c);c++;Thread.Sleep(100);}//**turnofferrorlightifsetusbLight.Write(false);
55
//mountUSBfilesystemDebug.Print("USBStorageDevicefound");usb=newPersistentStorage(USBHostController.GetDevices()[0]);Thread.Sleep(25);usb.MountFileSystem();Debug.Print("FileSystemmounted");Thread.Sleep(10);//setupfile(s)stringroot=VolumeInfo.GetVolumes()[0].RootDirectory;Thread.Sleep(10);Debug.Print("ScanningFiles");StringnextLine="";fileStart:nextLine="";for(inti=0;i
56
while(DAQ_ON.Read()){DAQGood.Write(true);nextLine="";for(intj=0;j
57
}elseif(msgList[i].ArbID==0x0011){tps.setValue((float)((msgList[i].Data[6]
58
}
SensorInterfaceandClasses:usingSystem;usingSystem.Threading;usingMicrosoft.SPOT;usingMicrosoft.SPOT.IO;usingMicrosoft.SPOT.Hardware;usingGHIElectronics.NETMF.FEZ;usingGHIElectronics.NETMF.USBHost;usingGHIElectronics.NETMF.IO;usingGHIElectronics.NETMF.Hardware;usingSystem.IO;namespaceFSAE_DAQ_2{interfaceSensor{stringName();stringRead();}classMCPSensor:Sensor{stringname;publicfloatscalar=1;publicfloatoffset=0;publicbytechannel=0;publicCpu.PinchipSelect=(Cpu.Pin)FEZ_Pin.Digital.IO10;constboolcsActive=false;constboolclockEdge=true;constboolclockIdle=false;constUInt16clockRate=2000;constUInt16csSetup=0;constUInt16csHold=0;publicMCPSensor(Cpu.Pincs){name="";chipSelect=cs;}publicMCPSensor(stringn,Cpu.Pincs){name=n;chipSelect=cs;}publicMCPSensor(stringn,Cpu.Pincs,floats,floato)
59
{name=n;scalar=s;offset=o;chipSelect=cs;}publicMCPSensor(stringn,Cpu.Pincs,bytechan,floats,floato){name=n;scalar=s;offset=o;channel=chan;chipSelect=cs;}publicstringName(){returnname;}publicstringRead(){return(((float)rawRead())*scalar+offset).ToString();}publicintrawRead(){byteone=(byte)((channel>>2)|0x06);bytetwo=(byte)((channel
60
}classMLX_Temp:Sensor{stringname;publicfloatscalar=1;publicfloatoffset=0;byteslaveAddress=0x5A;//slaveadress,defaultforMLXIRtempsensoris0x5Aintclock=50;//clockrateinKHzI2CDevice.Configurationconfig;publicMLX_Temp(){name="MLX_IRTemp";config=newI2CDevice.Configuration(slaveAddress,clock);}publicMLX_Temp(bytesa,intclk){slaveAddress=sa;clock=clk;config=newI2CDevice.Configuration(slaveAddress,clock);}publicMLX_Temp(Stringn,bytesa,intclk,floatscale,floato){name=n;slaveAddress=sa;clock=clk;scalar=scale;offset=0;config=newI2CDevice.Configuration(slaveAddress,clock);}publicStringName(){returnname;}/***readsthetemperatureinCelsius.*/publicStringRead(){I2CDevicebus=newI2CDevice(config);byte[]wr=newbyte[1];byte[]rd=newbyte[3];wr[0]=0x07;//RAMaddress0x07.I2CDevice.I2CTransaction[]send=newI2CDevice.I2CTransaction[2];send[0]=I2CDevice.CreateWriteTransaction(wr);send[1]=I2CDevice.CreateReadTransaction(rd);
61
bus.Execute(send,10);//turndownthenumerifthisworks,turnitupifitdoesn'twork...uintreading=(uint)((((byte)rd[1])
62
Thread.Sleep(50);bus.Dispose();}/***Thismethodwon'tbreakanything,butitwillreturngarbageifmorethanoneMLX90614isconnected.*/publicvoidgetSlaveAddress(){I2CDevice.Configurationtest=newI2CDevice.Configuration(0x0000,50);//ALLMLXtempsensorsshouldanswerto0x00accordingtodatasheet.I2CDevicebus=newI2CDevice(test);byte[]wr=newbyte[3];byte[]rd=newbyte[3];I2CDevice.I2CTransaction[]send;wr=newbyte[1];wr[0]=(byte)0x2e;send=newI2CDevice.I2CTransaction[2];send[0]=I2CDevice.CreateWriteTransaction(wr);send[1]=I2CDevice.CreateReadTransaction(rd);bus.Execute(send,10);Debug.Print("newSlaveAdressis:"+rd[0]);bus.Dispose();}}classDummySensor:Sensor{Stringname="dummysensor";floatvalue=0;floatscalar=1;floatoffset=0;publicDummySensor(){}publicDummySensor(Stringn,floats,floato){name=n;scalar=s;offset=o;}publicStringName(){returnname;}
63
publicStringRead(){return((float)value*scalar+offset).ToString();}publicvoidsetValue(floatv){value=v;}publicvoidsetValue(UInt16v){value=(float)v;}}classclock:Sensor{publicStringname="Time";DateTimet;publicclock(){}publicStringRead(){t=RealTimeClock.GetTime();return(t.Hour+":"+t.Minute+":"+t.Second+"."+t.Millisecond);}publicStringName(){returnname;}}classGePeS:Sensor{intLatH,LonH;doubleLatM,LonM;boolNorth,East;Stringpos;publicGePeS(){FEZ_Extensions.GPS.Initialize();}publicStringName(){return"GPSLocation";
64
}publicStringRead(){FEZ_Extensions.GPS.GetPositionF(outLatH,outLatM,outNorth,outLonH,outLonM,outEast);pos=LatH+""+LatM+"N"+LonH+""+LonM+"W";returnpos;}}}
ModifiedMethodsforGPSDriverClass:publicstaticboolGetPositionF(outintLatHour,outdoubleLatMinute,outboolNorth,outintLongHour,outdoubleLongMinute,outboolEast){lock(GPRMC_sentence_array){if(_data_is_valid==false){//nothigntoreturnLatHour=LongHour=0;LatMinute=LongMinute=0;North=East=false;returnfalse;}stringsentence_string=newstring(GPRMC_sentence_array,0,GPRMC_sentence_array_length);sentence_fields=sentence_string.Split(split_char);if(sentence_fields.Length
65
elseEast=true;_data_is_valid=false;returntrue;}}privatestaticdoubleGetValue2F(stringstr,intindex){doubleret;ret=str[index]'0';ret*=10;ret+=str[index+1]'0';ret+=((str[index+3]'0')*0.1);ret+=((str[index+4]'0')*0.01);ret+=((str[index+5]'0')*0.001);ret+=((str[index+6]'0')*0.0001);returnret;}
66
AppendixB:Drawings
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
AppendixC:BrakeCalculationInitialBrakeCalculation
84
FinalBrakeCalculations