YZ250F Matlab Documentation
Short Description
Matlab documentation details...
Description
Matlab Code NOTE: This model treats TDC as 180[degrees] and BDC as 0[degrees]. Highlighted Highlig hted n!"ts are those that #ill need to be $hanged. 1.% %Engine Inputs RPM = 10000; %Revolutions Per Minute [1/min] L = .053; %!tro"e o# Engine [m] $ = .0; %$ore o# Engine [m] l = .0&35; %Lengt' o# Engine (onne)ting Ro* [m] +,)-l = 1; %+umer o# (-lin*ers [unitless] (,r = 1.5; %(ompression Rtio [unitless] +,r = ; %+umer o# Revolutions Per Poer !tro"e t'et, = 55; %(omustion $urn 2urtion [*egrees] t'et,0 = 150; %(rn" ngle t !trt o# (omustion [*egrees] t'et,# = t'et,04t'et,; %inl (om. ngle [*egrees] I67 = 38; %7ime [*egrees] 'en Int"e 6lve (loses E67 = 310; %7ime [*egrees] 'en E9'ust 6lve :pens
These are the known engine inputs. The bore, stroke, and connecng rod lengths are used to calculate calculate the engine displacement and other parameters. parameters. The “theta” values will be altered to determine the ideal spark advance. &.% %uel Inputs ,rtio = 18.; lm* = 1; L6 = 88.e; et,)om = .&5;
%)tul ir uel Rtio :# (R 2uring 7esting [unitless] %E9)ess ir (oe##i)ient [unitless] %Loer eting 6lue :# uel Mi9ture [ = Deros; %Prello)te Amm rrgmm1> = 1.8; %!ets Initil Amm 6lues ollos (urve it> 7, =800; %ssume* ll 7emperture !uggeste* 6lue>
The atmospheric inputs should be changed based on the elevaon, temperature, etc. at the point of tesng. The wall temperature is assumed in this code, but there are several methods for predicng the wall temperature based on the equivalence rao if interested, look these up online!. (.%
This secon of code uses test values to predict the speci"c heats rao as a funcon of temperature. These coecients have been obtained e#perimentally.
).%
This block of code sets inial array values at $ero. This speeds up the code and sets inial condions. *.%
%ecause the inial condions are already set, the loop runs between & and '() the "rst loop is speci"ed in the inial condions!. The "rst poron of this block of code speci"es the di*erent crank angles, the volume, and the heat transfer surface area. +.%
“+fthen” statements specify condions in which the piece of code should operate. +n this case, the burn fracon and fuel mass equaons won-t calculate unless the crank angle falls within a certain criteria between burn iniaon and the "nal degree of burning!. 8.%
This piece of code says that the temperature and pressure only change when the intake and e#haust valves are closed. ,.%
large poron of last part of the loop is used to calculate the speci"c heats rao. This adds comple#ity to the code, but also makes the code much more accurate. ll that needs to be known here is that the speci"c heats rao decreases with increased temperature this can change peak temperature/pressure predicons by several hundred units!. +ndicated torque, indicated power, indicated mean e*ecve pressures, etc. are all based on the equaons found in the 0eywood book. 1trange mulplicaon factors in the plot statements are simply conversion factors between 2nglish and metric systems. 10.% E-am!le O"t!"ts
Power Vs. Crank Angle (English) 30
20
10 ] h [ r e w o 0 P
-10
-20
0
50
100
150 200 theta[deg]
250
300
350
!or"#e Vs. Crank Angle (English) 15
10
] t 5 % & % $ l [ e # " 0 r o ! -5
-10
0
50
100
150 200 theta[deg]
250
300
350
The indicated power is the value that occurs at '()3degrees4. This plot was found through integraon integral of 5d6!. The e#act value can be found by viewing element '() in the “78dot” array in the 9T:% workspace!. The indicated torque can be found the same way.
ny variable can be found ne#t to the 9T:% command window. The indicated torque torque!, indicated power 78dot!, and indicated mean e*ecve pressure imep! can be found in this menu.
"ll M/T/B $ode %Fniversit- :# I*'o Engine !imultion %Fses G!ingle HoneG (omustion nl-sis it' 6rile !pe)i#i) ets Rtios %:nl- Mo*els 7'e (ompression n* E9pnsion !tro"es %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, )ler ll; )lose ll; )l); %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %Engine Inputs RPM = 10000; L = .053; $ = .0; l = .0&35; +,)-l = 1; (,r = 1.5;
%Revolutions Per Minute [1/min] %!tro"e o# Engine [m] %$ore o# Engine [m] %Lengt' o# Engine (onne)ting Ro* [m] %+umer o# (-lin*ers [unitless] %(ompression Rtio [unitless]
+,r = ; %+umer o# Revolutions Per Poer !tro"e t'et, = 55; %(omustion $urn 2urtion [*egrees] t'et,0 = 150; %(rn" ngle t !trt o# (omustion [*egrees] t'et,# = t'et,04t'et,; %inl (om. ngle [*egrees] I67 = 38; %7ime [*egrees] 'en Int"e 6lve (loses E67 = 310; %7ime [*egrees] 'en E9'ust 6lve :pens %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %Engine (l)ultions $se* :n Previous Inputs %ssumes verge !ur#)e re In 'i)' et 7rns#er :))urs ,p = pi/8>$J; ,)' = ,p; 6,* = +,)-l,pL; + = RPM/0; !,r,p = L+; = L/; 6,72( = 6,*/(,rB1>>/+,)-l; 6,$2( = 6,*/+,)-l>46,72(;
%(ross !e)tionl Piston re [mJ] %(-lin*er e* !ur#)e re in )'mer> %2ispl)e* 6olume :# Engine [mJ3] %(onverts RPM to RP! [1/s] %(l)ultes Men Piston !pee* [m/s] %(l)ultes (rn" R*ius 1/ stro"e>[m] %(l)ultes (lern)e 6olume [mJ3] %(-l. 6olume t $2( [mJ3]
%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %uel Inputs ,rtio = 18.; lm* = 1; L6 = 88.e; et,)om = .&5;
%)tul ir uel Rtio :# (R 2uring 7esting [unitless] %E9)ess ir (oe##i)ient [unitless] %Loer eting 6lue :# uel Mi9ture [ = Deros; %Prello)te Amm rrgmm1> = 1.8; %!ets Initil Amm 6lues ollos (urve it> 7, =800; %ssume* ll 7emperture !uggeste* 6lue> %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %7'ese re Pol-nomils Fse* 7o (l)ulte Amm s un)tion :# (rn" ngle %Pol-nomil (onstnts ,1 = .&; , = 3&.1eB0; ,3 = 5.&eB0&; ,8 = B@.eB13; ,5 = .5@eB1; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,0 = 308&.33; ,1 = B5.eB0; , = B&.5eB05; ,3 = 1.53eB0&; ,8 = B00.eB18; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ),u = .35@8; ),r = 8.1@eB03; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, *,0 = 10.810; *,1 = .@515; *,3 = B3.15; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
e,0 = B15.001e03; e,1 = B15.@3@e03; e,3 = &.13e03; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, #,0 = B.103&; #,1 = B.3@5; #,3 = .158; #,8 = B18.3; #,5 = 11@.; #, = 18.503; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, r,0 = B.&; r,1 = 11.&@; r, = B588; r,3 = B.8358; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %!pe)i#-ing Initil (on*itions or Loops %26K2Ket). re Reltive 7o ('nge In 7'et i.e. 26/2t'et> t'et1C30>=Deros; %!trting (rn" ngle [*eg] 61C30>=Deros; %Prello)te 6olume rr61>=6,$2(; %!trting (omustion ('mer 6olume [mJ3] 261C30> = Deros; %Prello)te ('nge In 6olume rr261> = 0; %!pe)i#-ing Initil ('nge In 6olume [mJ3 P1C30>=Deros; %Prello)te Pressure rrP1> = P,$2(; %Inlet Pressure ["P] 2P1C30> = Deros; %!pe)i#-ing Initil ('nge In Pressure 71C30>=Deros; %Prello)te 7emperture rr71> = 7,$2(; %Inlet 7emperture [?] 271C30> = Deros; %!pe)i#-ing Initil ('nge In 7emperture 1C30> = 0; %Prello)te Mss $urn rr21C30> = Deros; %Prello)te ('nge In Mss $urn r)tion [unitless] 2N1C30> = 0; %Prello)te et Relese rrN1C30>=Deros; %Prello)te et rrM,1C30> = 0; %Prello)te Mss In (omustion ('mer rrP,overR71C30> = Deros; %Prello)tes I*el As L rrP,overR71> = P1>/R,ir71>>; %Initil 6lue I*el As rrs1C30>=Deros; %Prello)tes 2istn)e (rn"/Piston 9es rrs1> = B)os*t'et1>>4sOrtlJ B Jsin*t'et1>>J>; %Initil 6l. = ,)' 4 ,p 4 pi$l4Bs1>>; %Initil et 7rns#er re 1C30> = Deros; %Prello)te or" rr,*ot1C30> = Deros; %Prello)te Poer rr7orOue1C30> = Deros; %Prello)te 7orOue rrN,*ot1C30> = Deros; %Prello)te et 7rns#er rru1C30> = Deros; %Prello)te Internl Energ- rr*u1C30> = Deros; %Prello)tes ('nge In Internl Energ- rr)v1C30> = Deros; %Prello)tes et (p)it- rrF1C30>=Deros; %Prello)te (onstnt GFG rrF1> = .@!,r,p4.00387,$2(6,*/6,$2(>2P1>/P,$2(>; ',g1C30>=Deros; %Prello)te et 7rns#er (oe##i)ient rr',g1> = 3.P1>/1000>J.@F1>J.@$JB.>71>JB.55>; 2N,1C30>=Deros; %Prello)te (onve)tive et Loss rr%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, #or i = C30 %!pe)i#ies 7'et [*eg] (rn" ngle t'eti> = t'etiB1>41; %!pe)i#ies 2istn)e $eteen (rn"/Piston 9es s un)tion :# t'et s = B)os*t'eti>>4sOrtlJ B Jsin*t'eti>>J>; %!pe)i#ies 6olume s un)tion :# (rn" ngle
6i> = 6,72( 4pi/8>$J>l 4 B s>; %!pe)i#ies ('nge In 6olume s un)tion :# (rn" ngle 26i> = 6i>B6iB1>; %!pe)i#ies I*el As Portion :# EOutions P,overR7i> = PiB1>/R,ir7iB1>>; %Instntneous !u#)e re or et 7rns#er> = ,)' 4 ,p 4 pi$l4Bs>; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %!pe)i#ies Mss r)tion $urn s un)tion :# (rn" ngle eie )n.> %lso !pe)i#ies Mss :# uel In (omustion ('mer s un)tion :# %7'et
i# t'ett'et,0 i>=0; else i> = 1Be9pB5t'eti>Bt'et,0>/t'et,>J3>; en* %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %!olves or InQe)te* Mss :# uel 2uring (omustion i# t'et,0 t'eti> i# t'eti> t'et,# M,i> = 6t'et,0B1>P,overR7t'et,0B1>/lm*,rtio>; en* en* %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %!pe)i#ies ('nge In Mss r)tion $urn s un)tion :# (rn" ngle 2i> = i> B iB1>; %(l)ultes et 7rns#er (oe##i)ient s un)tion :# (rn" ngle Fi> = .@!,r,p4.00387,$2(6,*/6,$2(>2PiB1>/P,$2(>; ',gi> = 3.PiB1>/1000>J.@Fi>J.5$JB.>7iB1>JB.55>; %(l)ultes (onve)tive Losses Into ll s un)tion :# (rn" ngle 2N,i> = ',gi>7iB1>B7,>0/piRPM>>; %(l)ultes ('nge In et 7rns#er totl> s Fn)tion :# (rn" %ngle 2Ni> = et,)omL6M,i>2i>B2N,i>; %(l)ultes 7otl et 7rns#er Per (-)le> Ni> = NiB1>42Ni>; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
%!pe)i#ies Pressure n* 7emperture In)reses $eteen Int"e 6lve %(losing n* E9'ust 6lve :pening i# I67 t'eti>E67 27i>=7iB1>gmmiB1>B1>1/PiB1>6iB1>>>2Ni> ... B1/6iB1>>26i>>; 2Pi>=BPiB1>/6iB1>>26i>4PiB1>/7iB1>>27i>; Pi> = PiB1>42Pi>; en* %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %Returns 7emperture 6lues 7o $eginning :# Loop
7i> = 7iB1>427i>; %(l)ultes (-lin*er or" [ = ,*oti>1000>/pi+>; %(l)ultes et Loss ["] s un)tion :# (rn" ngle N,*oti> = +,)-lNi>+/1000; %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, % 7'e olloing !e)tion :# (o*e (l)ultes n Fp*te* 6lue :# Amm % Fsing 7'e GPol-nomil Met'o*G 2evelope* $- ?riegerB$ormn % Fser :# 7'is (o*e Must $e (re#ul $e)use ))ur)- :# 7'is Met'o* % 2rops s 7'e uel Mi9ture $e)omes In)resingl- Ri)'
%(l)ultes K$ )tors or olloing $lo)" :# (o*e ,t = ,17i>4,7i>J4,37i>J34,87i>J84,57i>J5; $,t = ,04,17i>4,7i>J4,37i>J34,87i>J8; %(l)ultes )tor G2G s un)tion :# lm* 2,lm* = *,0 4 *,1lm*JB1>4 *,3lm*JB3>; %(l)ultes )tor GG s un)tion :# 7empertureKlm* E,7Lm* = e,0 4 e,1lm*JB1>4 e,3lm*JB3>>/7i>; ,7PLm* = #,0 4 #,1lm*JB1> 4 #,3lm*JB3> 4 ... #,8 4 #,5lm*JB1>>/7i>>>log#,Pi>>; %(l)ultes (orre)tion )tor or Internl Energu,)orr = ),ue9p2,lm* 4E,7Lm* 4 ,7PLm*>; %(l)ultes Internl Energ- s un)tion :# (rn" ngle ui> = ,t B $,t/lm* 4 u,)orr; %(l)ultes ('nge In Internl Energ*ui> = ui> B uiB1>; %(l)ultes et (p)it- G(,vG s un)tion :# (rn" ngle )vi> = *ui>/27i>; %(l)ultes (orre)tion )tor or GRG 6lue s un)tion :# (rn" %ngle R,)orr = ),re9pr,0loglm*> 4 r,14r,/7i> 4 ... r,3log#,Pi>>>/lm*>; %(l)ultes )tul GRG 6lue R = .@ 4 .00/lm* 4 R,)orr; i# i=3 %(l)ultes )tul Amm 6lue n* Returns 7o $eginning :# (o*e gmmi> = 1 4 R/)vi>; en*
en* %,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %!pe)i#ies (on*itions or Minimum n* M9imum Plot 6lues v,min = min6>; v,m9 = m96>; p,min = minP>; p,m9 = m9P>; P,min = min,*ot>; P,m9 = m9,*ot>; 7,min = min7>; 7,m9 = m97>; N,min = minN,*ot>; N,m9 = m9N,*ot>; 7min = min7orOue>; 7m9 = m97orOue>;
%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, %Plot !ttements #igure1> plott'etK> titleSMss r)tion $urne* 6s. 7'etS > 9lelSt'et[*eg]S> -lelSMss r)tion $urne* %>S > 9is[0 30 B.1 1.1]> #igure> plott'etK6> titleS6olume 6s. (rn" ngleS > 9lelSt'et[*eg]S> -lelS6olume [mJ3]S> 9is[0 30 v,min v,m9]> #igure3> plott'etKP.000185033@> titleS(-lin*er Pressure 6s. (rn" ngle Englis'S > 9lelSt'et[*eg]S> -lelSPressure [psi]S> 9is[0 30 p,min0.000185033@ p,m90.000185033@]> #igure8> plott'etK7> titleS(-lin*er 7emperture 6s. (rn" ngleS > 9lelSt'et[*eg]S> -lelS7emperture [?]S> 9is[0 30 7,min 7,m9]> #igure5> plott'etK,*ot1.3800&> titleSPoer 6s. (rn" ngle Englis'>S > 9lelSt'et[*eg]S> -lelSPoer ['p]S> 9is[0 30 P,min1.3800& P,m91.3800&]> #igure> plott'etK7orOue0.3518&> titleS7orOue 6s. (rn" ngle Englis'>S > 9lelSt'et[*eg]S> -lelS7orOue [l##t]S> 9is[0 30 7min0.3518& 7m90.3518&]> #igure> plott'etKP.000185033@K SS> titleSPressureKPoerKn* et 7rns#erS > 'ol* on; plott'etK,*ot1.3800&K SgS> plott'etKN,*ot1.3800&K SrS> legen* Pressure Poer 9lelSt'et[*eg]S> -lelSRespe)tive Fnits psiK'p>S >
9is[0 30 P,min1.3800&B100 p,m90.000185033@]>
View more...
Comments