In[]:=
2+3
Out[]=
5
In[]:=
ClearAll["Global`*"]C2=3.*^6;T=16.*^-6;plist={4096,1024,512,48};acquisitionProb[Q_?NumericQ]:=If[Q==1,1.,(1-1./Q)^(Q-1)];waitSlots[Q_?NumericQ]:=(1-acquisitionProb[Q])/acquisitionProb[Q];efficiency[P_?NumericQ,Q_?NumericQ]:=Module[{W=waitSlots[Q]},(P/C2)/((P/C2)+W*T)];fmt[x_]:=NumberForm[x,{4,2}];table=Grid[Prepend[Table[With[{Q=q},Prepend[fmt/@(100*efficiency[#,Q]&/@plist),Q](*%*)],{q,{1,2,3,4,5,10,32,64,128,256}}],Prepend[plist,"Q \\ P (bits)"]],Frame->All,Alignment->Center]
Out[]=
Q \ P (bits) | 4096 | 1024 | 512 | 48 |
1 | 100.00 | 100.00 | 100.00 | 100.00 |
2 | 98.84 | 95.52 | 91.43 | 50.00 |
3 | 98.56 | 94.46 | 89.51 | 44.44 |
4 | 98.42 | 93.96 | 88.62 | 42.19 |
5 | 98.34 | 93.67 | 88.10 | 40.96 |
10 | 98.18 | 93.10 | 87.09 | 38.74 |
32 | 98.07 | 92.72 | 86.42 | 37.37 |
64 | 98.05 | 92.63 | 86.27 | 37.08 |
128 | 98.04 | 92.59 | 86.20 | 36.93 |
256 | 98.03 | 92.57 | 86.16 | 36.86 |
In[]:=
acquisitionProb[Q_?NumericQ]:=If[Q==1,1.,(1-1./Q)^(Q-1)];acqPlot=Plot[acquisitionProb[q],{q,1,256},AxesLabel->{"Q","A(Q)"},PlotRange->{0,1},ImageSize->Medium,PlotLabel->"Acquisition Probability per Slot",GridLines->Automatic,PlotStyle->Thick];acqPlot
Out[]=
In[]:=
waitSlots[Q_?NumericQ]:=(1-acquisitionProb[Q])/acquisitionProb[Q];waitPlot=Plot[waitSlots[q],{q,1,256},AxesLabel->{"Q","W(Q) slots"},ImageSize->Medium,PlotLabel->"Expected Contention Slots",GridLines->Automatic,PlotStyle->Thick];waitPlot
Out[]=
In[]:=
ClearAll["Global`*"];channelRate=3.*^6;slotTime=16.*^-6;acquisitionProb[Q_?NumericQ]:=If[Q==1,1.,(1-1./Q)^(Q-1)];waitSlots[Q_?NumericQ]:=(1-acquisitionProb[Q])/acquisitionProb[Q];efficiency[P_?NumericQ,Q_?NumericQ]:=Module[{W=waitSlots[Q]},(P/channelRate)/((P/channelRate)+W*slotTime)]throughput[P_,Q_]:=channelRate*efficiency[P,Q];payloads={4096,1024,512,48};palette=ColorData[97]/@Rescale[Range[Length[payloads]]];effPlot=Plot[Evaluate@Table[efficiency[p,q],{p,payloads}],{q,1,256},PlotStyle->Thread[{palette,Thick}],PlotLegends->(ToString[#]<>" bits"&/@payloads),AxesLabel->{"Queued stations Q","Efficiency η(Q,P)"},PlotRange->{0.35,1},GridLines->Automatic,ImageSize->Large,PlotLabel->"Ethernet Efficiency vs. Offered Load"];effPlotqs={2,10,64};effPlot2=LogLinearPlot[Evaluate@Table[efficiency[p,q],{q,qs}],{p,48,8192},PlotStyle->Thread[{palette[[;;Length[qs]]],Thick}],PlotLegends->(Style["Q = "<>ToString[#],Bold]&/@qs),AxesLabel->{"Payload size P (bits)","Efficiency η(Q,P)"},PlotRange->{0.3,1},ImageSize->Large,PlotLabel->"How Frame Length Influences Efficiency"];effPlot2acqPlot=Plot[acquisitionProb[q],{q,1,256},AxesLabel->{"Q","A(Q)"},PlotRange->{0,1},ImageSize->Medium,PlotLabel->"Acquisition Probability per Slot"];acqPlotwaitPlot=Plot[waitSlots[q],{q,1,256},AxesLabel->{"Q","W(Q) slots"},ImageSize->Medium,PlotLabel->"Expected Contention Slots"];waitPlot
Out[]=
Out[]=
Out[]=
Out[]=