Sie sind auf Seite 1von 47

1

of
76
CSMAJCD

1.Overview
5. Enhancing the model with
Deference (CSMA)
2. Cetting Started
6. Enhancing the model with
collision detection and
backoff (Ethernet)
3. uilding the Aloha model
7. Analyzing the Ethernet
results
4. Analyzing the Aloha
results
ThIs chapter presents a detaIIed set oI
exampIes whIch IIIustrate the modeIIng and
anaIysIs oI weIIknown Aloha and CSMA
channeI access protocoIs. n thIs Iesson,
you wIII Iearn how to:
Construct more advanced protocoIs.
DesIgn a sImpIe channeI InterIace to a muItItap bus.
Execute parametrIc sImuIatIons.
AnaIyze the sImuIated resuIts agaInst theoretIcaI
predIctIons.
2
of
76
CSMAJCD Overview
1. Overview
The task In thIs Iesson Is to desIgn modeIs whIch Incorporate the
Aloha random channeI access method and the 1persistent
carrIer sense muItIpIe access (CSMA) method on a muItItap bus
IInk, where muItIpIe nodes are connected through a shared
channeI. Each method`s perIormance wIII be compared agaInst
the others.
ThIs Iesson requIres the constructIon oI two
modeIs: an Aloha modeI and a CSMA modeI.
The Aloha modeI wIII be desIgned IIrst, sInce
It Is the sImpIest oI the channeI access
methods.
3
of
76
CSMAJCD Cetting Started
2. Getting Started
8eIore begInnIng the desIgn oI the modeIs, you may be Interested
In an overvIew oI the modeI hIerarchy. The desIgn strategy Ior the
Aloha and CSMA modeIs Is to empIoy the same network modeI.
8oth network modeIs wIII use a common transmItter node modeI
whIch sends packets, and a common receIver node modeI whIch
perIorms network monItorIng. 8y changIng the process modeI
attrIbute oI the node modeIs, new sImuIatIons usIng eIther Aloha
or CSMA propertIes can be buIIt quIckIy. The transmItter node
process modeIs wIII be unIque, whereas the receIver node process
modeI Is generIc and wIII remaIn unchanged.
Aloha and CSMA Modeling Hierarchy
Ceneric Network: cctnet
CenerIc TransmItter
Node ModeI: ccttx
CenerIc ReceIver
Process ModeI:
cctrx
CSMA TransmItter
Process ModeI:
csmatx
Aloha TransmItter
Process ModeI:
alohatx

CenerIc ReceIver
Node ModeI: cctrx
4
of
76
CSMAJCD Cetting Started
Designing the Ceneric Transmitter Node Model
The transmItter node must generate packets, process them, and
send them on to the bus. ThIs can be modeIed sImpIy usIng an
IdeaI generator to generate packets, a processor to perIorm any
necessary operatIons, and a bus transmItter to transmIt the
packets on the bus IInk.
8us transmItters aIso have InternaI queuIng capabIIIty: they wIII
Issue aII submItted packets onto the bus In FFO order.
n theory, the Aloha system couId be modeIed
as just an IdeaI generator and a bus
transmItter. However, by desIgnIng a more
generaIIzed modeI, you can reuse It Iater In
the tutorIaI Ior the CSMA modeI.
Ceneric Transmitter Node Model
5
of
76
CSMAJCD Cetting Started
Designing the Aloha Transmitter Node Process Model
The AIoha transmItter process has onIy one unIorced state:
waItIng Ior the arrIvaI oI a packet Irom the generator. SInce the
generIc transmItter node does not gather statIstIcs, the alohatx
process does not need to InItIaIIze or maIntaIn state or gIobaI
varIabIes oI Its own. Thus the process can begIn the sImuIatIon In
an unIorced IdIe state where It waIts Ior packets to arrIve.
8ecause the FSM begIns In an unIorced state, the process needs to
be actIvated wIth a begIn sImuIatIon Interrupt so that when the
sImuIatIon starts, the FSM wIII execute the IdIe state and wIII be
ready to transItIon wIth the IIrst arrIvIng packet.
The AIoha transmItter process onIy has to
receIve packets Irom the generator and send
them on to the transmItter.
lntermediate alohatx FSM
6
of
76
CSMAJCD Cetting Started
There Is onIy one dIstInct event In the alohatx FSM, the arrIvaI oI
a generated packet. At the unIorced IdIe state, the packet arrIvaI
Interrupt can be seIectIveIy detected by an approprIate transItIon.
Packet arrIvaI Interrupts are the onIy Interrupts expected, so It Is
saIe to omIt a deIauIt transItIon Ior the unIorced IdIe state. When
a packet arrIvaI Interrupt Is deIIvered, the FSM shouId perIorm
executIves to acquIre and transmIt the packet In the txpkt state,
then transItIon back to the idle state.
Complete alohatx FSM
7
of
76
CSMAJCD Cetting Started
Designing the Ceneric Receiver Node Model
The next step Is to desIgn the generIc receIver node modeI. The
modeI does not requIre a generator because It sImpIy monItors
packets movIng across the bus. t consIsts onIy oI a bus receIver
and a processor moduIe.
The generIc receIver node modeI monItors the
movement oI packets across the bus.
Conceptual Ceneric Receiver Node Model
8
of
76
CSMAJCD Cetting Started
Designing the Ceneric Receiver Node Process Model
To process receIved packets Ior statIstIcs coIIectIon, the cctrx
process needs one unIorced state where It waIts to receIve
coIIIsIonIree packets (how the coIIIsIons are detected Is presented
Iater In thIs tutorIaI). At the end oI the sImuIatIon, the process
records the channeI throughput and channeI traIIIc vaIues Ior
anaIysIs. 8ecause the receIver node process manages the
statIstIcsgatherIng varIabIes, the process shouId InItIaIIze the
varIabIes at the start oI the sImuIatIon. ThIs Ieads to the desIgn
shown beIow. Note the reIerence to the userdeIIned C IunctIons
procpkt() and recordstats() In the transItIon executIves (these
wIII be wrItten Iater).
The generIc receIver node process modeI Is
responsIbIe Ior handIIng receIved packets Ior
statIstIcsgatherIng purposes.
Complete cctrx FSM
9
of
76
CSMAJCD uilding the Aloha Model
3. Building the Aloha Model
8uIIdIng the AIoha modeI entaIIs severaI steps, whIch are outIIned
beIow:
CreatIng the AIoha transmItter node process modeI
CreatIng a generIc transmItter node modeI
CreatIng a generIc receIver node process modeI
CreatIng a generIc receIver node modeI
8uIIdIng the network modeI
The Aloha process and node modeIs wIII be
created IIrst. These modeIs wIII then serve
as the basIs Ior an enhanced modeI that wIII
be used to represent the CSMA system.
10
of
76
CSMAJCD uilding the Aloha Model
Creating the Aloha Transmitter Process Model
The IIrst part oI the AIoha modeI to buIId Is the transmItter
process modeI:
1) Start OPNET II It Is not aIready runnIng.
2) Choose New Irom the File menu, seIect Process Model Irom
the puIIdown IIst, then cIIck OK.
3) UsIng the Create State actIon button, pIace two states
In the workspace.
4) For the InItIaI state, change the name attrIbute to idle. Leave
the status as unforced.
5) For the other state, change the name attrIbute to txpkt and
the status to forced.
11
of
76
CSMAJCD uilding the Aloha Model
Next, add the approprIate transItIons between the states:
1) Draw the two transItIons as shown.
2) For the transItIon Irom idle to txpkt, change the condition
attrIbute to PKTARVL usIng capItaI Ietters. To move the
condItIon IabeI, IeItcIIck on the IabeI and drag It to a new
posItIon.
The PKTARVL macro determInes II an Interrupt receIved by the
process Is assocIated wIth a packet arrIvIng on a stream. n thIs
modeI, Interrupts are onIy expected on the Input stream Irom the
IdeaI generator, so the macro does not need to determIne whIch
Input stream receIved the packet.
12
of
76
CSMAJCD uilding the Aloha Model
You are now ready to specIIy the code Ior the process modeI.
Start wIth the header bIock:
1) Open the header block and type In deIInItIons shown beIow.
Save the changes, then cIose the edIt pad when you are
IInIshed.
The symboIIc constants lNSTRM and OUTSTRM In the header
bIock wIII be used In caIIs to KerneI Procedures whIch get packets
Irom streams or send packets to streams. To achIeve the desIred
IunctIonaIIty, these stream IndIces must be consIstent wIth those
deIIned at the node IeveI.
/* Input stream from ideal generator module */
#define IN_STRM 0
/* Output stream to bus transmitter module */
#define OUT_STRM 0
/* Conditional macros */
#define PKT_ARVL (op_intrpt_type () == OPC_INTRPT_STRM)
/* Global variable */
extern int subm_pkts;
13
of
76
CSMAJCD uilding the Aloha Model
Next, enter the temporary varIabIes and state varIabIes:
1) Open the temporary variable block and enter the IoIIowIng
decIaratIons. Save the changes and cIose the edIt pad when
you are IInIshed.
ThIs estabIIshes a temporary varIabIe packet poInter. SInce the
process modeI acquIres packets Irom the generator stream and
ImmedIateIy transmIts them, It Is not necessary to retaIn the
packet poInter between process InvocatIons.
1) Open the state variable block and enter the IoIIowIng
InIormatIon. CIIck OK to cIose the dIaIog box when you are
IInIshed.
The varIabIe maxpacketcount wIII hoId the maxImum number
oI packets to be processed In the sImuIatIon. ThIs wIII be retrIeved
Irom a sImuIatIon attrIbute and compared wIth the packet count.
/* Outgoing packet */
Packet* out_pkt;
14
of
76
CSMAJCD uilding the Aloha Model
DeIIne the actIons Ior the IdIe state In Its enter executIves bIock:
1) DoubIecIIck on the top oI the idle state to open the enter
executives block, and enter the IoIIowIng code.
2) Save your changes, then cIose the text edIt pad when you are
IInIshed.
/* Get the maximum packet count, */
/* set at simulation run-time. */
op_ima_sim_attr_get (OPC_IMA_INTEGER,"max packet count",
&max_packet_count);
15
of
76
CSMAJCD uilding the Aloha Model
AIso, specIIy the actIons Ior the txpkt state:
1) DoubIecIIck on the top oI the txpkt state to open the enter
executives block, and enter the IoIIowIng code:
The txpkt state executIve Is entered when the process receIves a
stream Interrupt Irom the SImuIatIon KerneI. ThIs Interrupt
coIncIdes wIth the arrIvaI oI the generated packet. AIter
compIetIng the executIves oI the txpkt state, the FSM transItIons
back to the idle state. 8ecause there are no other unIorced states
In the transItIon path, the FSM aIways reenters the idle state
beIore the next packet arrIves, and the eventdrIven PKTARVL
condItIonaI Is aIways appIIcabIe.
/* A packet has arrived for transmission. Acquire */
/* the packet from the input stream, send the packet*/
/* and update the global submitted packet counter.*/
out_pkt = op_pk_get (IN_STRM);
op_pk_send (out_pkt, OUT_STRM);
++subm_pkts;
/*Compare the total number of packets submitted with*/
/*the maximum set for this simulation run.If equal*/
/* end the simulation run. */
if (subm_pkts == max_packet_count)
{
op_sim_end ("Simulation ended when max packet count reached.",
"", "", "");
}
16
of
76
CSMAJCD uilding the Aloha Model
The cctrx process modeI wIII Iater decIare the gIobaI varIabIe,
submpkts, to gIobaIIy accumuIate the number oI transmItted
packets. Access to thIs varIabIe In the alohatx process modeI Is
gaIned by decIarIng It In the modeI`s header bIock usIng the C
Ianguage extern storage cIass.
Next deIIne the sImuIatIon attrIbute that wIII be set at sImuIatIon
runtIme and Ioaded Into the state varIabIe maxpacketcount.
1) Choose Simulation Attributes Irom the lnterfaces menu.
2) Enter an attrIbute Into the dIaIog box tabIe as shown:
3) Save your changes by cIIckIng on the OK button.
The modeI Is now compIete, except Ior the modeI InterIace
attrIbutes.
17
of
76
CSMAJCD uilding the Aloha Model
You must aIso edIt the process InterIaces:
1) Choose Process lnterfaces Irom the lnterfaces menu:
2) Change the InItIaI vaIue oI the begsim intrpt attrIbute to
"enabled".
3) Change the Status oI aII the attrIbutes to hidden.
You may wIsh to add a comment to descrIbe the process. When
you are IInIshed, cIIck OK to cIose the dIaIog box.
4) Compile the process modeI. SuppIy the name
<initials>alohatx.
5) When the process modeI Is IInIshed compIIIng, close the
Process ModeI EdItor.
18
of
76
CSMAJCD uilding the Aloha Model
Creating the Ceneric Transmitter Node Model
1) SeIect New Irom the File menu, and seIect Node Model Irom
the resuItIng dIaIog box, then cIIck OK.
2) UsIng the approprIate actIon buttons, create one packet
generator moduIe, one processor moduIe, and one bus
transmItter moduIe. (8e sure to use a bus transmItter.)
3) For each moduIe, open the attrIbute dIaIog box and change the
name attrIbute as shown above.
4) Connect the moduIes wIth packet streams as shown above.
Note: Open the packet stream`s dIaIog boxes to see that stream 0
Is automatIcaIIy seIected Ior Input and output oI the processor,
conIormIng to the IndIces decIared In the <initials>alohatx
process modeI header bIock.
19
of
76
CSMAJCD uilding the Aloha Model
8ecause you are Interested In assIgnIng dIIIerent vaIues to the
generator`s interarrival args attrIbute, you must promote It so Its
vaIue can be set more easIIy at sImuIatIon tIme.
1) Open the generator`s attrIbute dIaIog box and set the
interarrival pdf attrIbute to exponential.
2) LeItcIIck on the interarrival args attrIbute, then cIIck on the
Promote button to promote the attrIbute.
3) CIose the attrIbute dIaIog box.
You aIso need to set the processor`s attrIbutes approprIateIy:
1) Open the processor`s attrIbute dIaIog box and set the process
model attrIbute to <initials>alohatx.
2) CIose the dIaIog box when you are IInIshed.
20
of
76
CSMAJCD uilding the Aloha Model
Enhancing the generic transmitter node model
The enhancements wIII consIst oI a bus receIver moduIe (to
support the eventuaI IuII dupIex capabIIIty oI the CSMA protocoI),
and a sInk processor to accept and destroy packets receIved by
the receIver moduIe. The enhancements aIso IncIude an InactIve
(dIsabIed) statIstIc wIre whIch, when enabIed In the CSMA modeI,
wIII both InIorm the process (contaIned In the txproc moduIe) oI
the busy status oI the channeI, as weII as provIde Interrupts to the
process when the channeI condItIon changes.
The generIc transmItter node modeI you just
created wIII provIde the IunctIonaIIty necessary
Ior the underIyIng alohatx process modeI to
work. However, sInce you eventuaIIy pIan to
exchange CSMA Ior the AIoha process modeI, It Is useIuI to
buIId hooks Ior the antIcIpated enhancements.
The enhanced transmitter node model
21
of
76
CSMAJCD uilding the Aloha Model
Add the IoIIowIng Ieatures to the node modeI:
1) UsIng the approprIate actIon buttons, add one processor
moduIe and one bus receIver moduIe.
2) Change the name oI the new processor moduIe to sink and
the name oI the bus receIver to busrx.
3) Connect the new moduIes wIth a packet stream as shown.
4) UsIng the Create Statistic Wire actIon button, connect the
busrx moduIe wIth the txproc moduIe.
5) Open the attrIbute dIaIog box Ior the statistic wire and
change both the rising edge trigger and falling edge trigger
attrIbutes to disabled.
22
of
76
CSMAJCD uilding the Aloha Model
DoubIe check the moduIe connectIvIty to make sure aII objects In
the modeI have been connected In the correct order:
1) SeIect Show Module Connectivity Irom the Obects menu.
PIace the cursor over the txproc moduIe. The objects shouId
be connected as IoIIows:
I necessary, correct the streams by changIng the src stream and
dest strm attrIbutes oI the packet streams.
Next, deIIne the InterIace attrIbutes and wrIte the compIeted
modeI to dIsk.
1) SeIect Node lnterfaces Irom the lnterfaces menu.
2) n the Node Types tabIe, change the Supported vaIue to no
Ior the mobile and satellite types.
3) Change the Status oI aII the attrIbutes to hidden, except Ior
the one wIth promoted status, gen.interarrival args.
I you wouId IIke, add a comment to descrIbe the process. When
you are IInIshed, cIIck OK to save the changes. FInaIIy, save the
modeI as <initials>ccttx and close the edItor.
23
of
76
CSMAJCD uilding the Aloha Model
Creating the Ceneric Receiver Node Process Model
1) SeIect New Irom the File Menu, and seIect Process Model Irom
the resuItIng dIaIog box and cIIck OK.
2) UsIng the Create State actIon button, pIace two states In the
tooI wIndow.
3) For the InItIaI state, change the name attrIbute to init and the
status to forced.
4) For the other state, change the name attrIbute to idle. (Leave
the status as unforced.)
Next, you can create the generIc receIver
process and node modeIs. SInce the soIe
purpose oI the receIver process Is to count
packets and record statIstIcs, It can be used
to monItor network perIormance whether the packets are
transmItted In accordance wIth the Aloha or the CSMA
channeI access methods.
24
of
76
CSMAJCD uilding the Aloha Model
Draw the IIve transItIon states as shown:
1) For the IIrst transItIon between the states, change the
condition attrIbute to PKTRCVD and the executive attrIbute
to procpkt().
2) For the second transItIon between the states, change the
condition attrIbute to ENDSlM and the executive attrIbute to
recordstats().
3) For the IIrst transItIon Irom idle back to ItseII, change the
condition attrIbute to PKTRCVD and the executive attrIbute
to procpkt().
4) For the second transItIon Irom idle back to ItseII, change the
condition attrIbute to default.
5) For the thIrd transItIon Irom idle back to ItseII, change the
condition attrIbute to ENDSlM and the executive attrIbute to
recordstats().
25
of
76
CSMAJCD uilding the Aloha Model
Next, enter the code Ior the header bIock and the state varIabIes.
1) UsIng the approprIate actIon button, open the header block
and type In the deIInItIons shown beIow.
The Index Ior the Input stream Irom the bus receIver moduIe
(lNSTRM) Is deIIned here. The PKTRCVD macro determInes II
the Interrupt deIIvered to the process Is a stream Interrupt. OnIy
one kInd oI stream Interrupt Is ever expected, so no Iurther
quaIIIIcatIons are necessary. The ENDSlM macro determInes II
the Interrupt receIved by the process Is assocIated wIth an endoI
sImuIatIon Interrupt deIIvered by the SImuIatIon KerneI.
The gIobaI varIabIe submpkts Is estabIIshed so that aII
transmIttIng nodes can contrIbute theIr IndIvIduaI transmIssIon
attempts to thIs accumuIator. DecIarIng a varIabIe In a process
modeI header bIock causes It to behave as a gIobaI varIabIe
wIthIn the executabIe sImuIatIon.
/* Input stream from bus receiver */
#define IN_STRM 0
/* Conditional macros */
#define PKT_RCVD (op_intrpt_type () == OPC_INTRPT_STRM)
#define END_SIM (op_intrpt_type () == OPC_INTRPT_ENDSIM)
/* Global variable */
int subm_pkts = 0;
26
of
76
CSMAJCD uilding the Aloha Model
DeIIne the IoIIowIng state varIabIe:
1) UsIng the approprIate actIon button, open the state variables
block and enter the IoIIowIng code:
The generIc receIver process uses the rcvdpkts varIabIe to keep
track oI the number oI vaIId receIved packets.
27
of
76
CSMAJCD uilding the Aloha Model
Next, open the function block and enter the IoIIowIng code:
/* This function gets the received packet, destroys it, */
/* and then logs the incremented received packet total. */
void proc_pkt ()
{
Packet* in_pkt;
/* Get packet from bus receiver input stream */
in_pkt = op_pk_get (IN_STRM);
/* Destroy the received packet */
op_pk_destroy (in_pkt);
/* Increment the count of received packets */
++rcvd_pkts;
}
/* This function writes the end-of-simulation channel */
/* traffic and channel throughput statistics */
void record_stats ()
{
/* Record final statistics */
op_stat_scalar_write ("Channel Traffic G",
(double) subm_pkts / op_sim_time ());
op_stat_scalar_write ("Channel Throughput S",
(double) rcvd_pkts / op_sim_time ());
}
28
of
76
CSMAJCD uilding the Aloha Model
As deIIned In the IunctIon bIock on the prevIous page, the
procpkt() IunctIon acquIres each receIved packet as It arrIves,
destroys It, and Increments the count oI receIved packets. The
recordstats() IunctIon Is caIIed when the sImuIatIon termInates.
Next, InItIaIIze the IoIIowIng varIabIe In the InIt state:
1) DoubIecIIck on the top oI the init state to open the enter
executives block, and enter the IoIIowIng code:
ThIs state InItIaIIzes the state varIabIe used to count receIved
packets.
/* Initialize accumulator */
rcvd_pkts = 0;
29
of
76
CSMAJCD uilding the Aloha Model
FInaIIy, you can deIIne the process InterIaces and compIIe the
modeI:
1) SeIect Process lnterfaces under the lnterfaces menu.
2) Change the InItIaI vaIue oI the endsim intrpt attrIbute to
enabled.
3) Change the Status oI aII the attrIbutes to hidden.
I you wIsh, add a comment to descrIbe the process. When you
are IInIshed, cIIck OK to save your changes, then compIIe the
modeI:
4) CIIck on the Compile Process Model actIon button.
5) SuppIy the IIIename <initials>cctrx and cIIck OK.
6) Close the process modeI edItor.
30
of
76
CSMAJCD uilding the Aloha Model
Creating the Ceneric Receiver Node Model
The next step Is to create a generIc receIver node modeI.
1) SeIect New Irom the File Menu, and seIect Node Model Irom
the resuItIng dIaIog box.
2) UsIng the approprIate actIon buttons, create one processor
moduIe and one bus receIver moduIe. (8e sure to use a bus
receIver.)
3) For each moduIe, open the attrIbute dIaIog box and change the
name attrIbute as shown.
4) Connect the moduIes wIth a packet stream as shown.
Note: The Input stream Index deIauIts to stream 0, conIormIng to
the Index decIared In the cctrx process modeI header bIock.
5) Open the processor`s attrIbute dIaIog box and set the process
model attrIbute to <initials>cctrx.
31
of
76
CSMAJCD uilding the Aloha Model
The generIc receIver node modeI Is now compIete, except Ior the
InterIace attrIbutes.
1) SeIect Node lnterfaces Irom the lnterfaces menu.
2) n the Node Types tabIe, change the Supported vaIue to no
Ior the mobile and satellite types.
3) Change the Status oI aII the attrIbutes to hidden.
I you wIsh, add a comment to descrIbe the node modeI. When
you are IInIshed, cIIck OK to exIt the dIaIog box.
1) Save the node modeI as <initials>cctrx, then close the Node
ModeI EdItor.
32
of
76
CSMAJCD uilding the Aloha Model
Creating a new Link Model
For thIs Iesson, you wIII create a custom bus IInk modeI whose
pIpeIIne stages use the deIauIt bus modeIs, denoted by the dbu
modeI preIIx. The tabIe beIow IIsts pIpeIIne stage IunctIon.
The behavIor oI a bus IInk Is deIIned by Its
TransceIver PIpeIIne stages. The pIpeIIne Is
a serIes oI C or C++ procedures whIch can
be modIIIed to customIze the IInk modeI.
us Transceiver Pipeline Model Stages
Model Function
txdel Computes the transmIssIon deIay assocIated wIth the
transmIssIon oI a packet over a bus IInk (transmIssIon
deIay Is the tIme requIred to transmIt the packet at the bIt
rate deIIned In the reIevant bus transmItter moduIe).
closure DetermInes the connectIvIty between any two statIons on
the bus.
propdel CaIcuIates the propagatIon deIay between a gIven
transmItter and a receIver.
coll DetermInes whether a packet has coIIIded on the bus.
error CaIcuIates the number oI bIt errors In a packet.
ecc Rejects packets exceedIng the error correctIon threshoId
as weII as any coIIIded packets.
33
of
76
CSMAJCD uilding the Aloha Model
To create a new bus IInk modeI:
1) SeIect New Irom the Flle Menu, and seIect Link Model Irom
the resuItIng puIIdown menu.
2) n the Link Types tabIe, change the Supported vaIue to no Ior
the ptsimp and ptdup types.
ThIs IInk modeI wIII onIy support the bus and bus tap types.
I you wIsh, add a comment to descrIbe the IInk. When you are
IInIshed, cIIck OK to cIose the dIaIog box, then Save the IIIe as
<initials>cctlink and close the LInk ModeI EdItor.
34
of
76
CSMAJCD uilding the Aloha Model
Creating the Network Model
The anaIytIcaI AIoha modeI assumes that packets are aIways
Introduced Into the network at exponentIaIIy dIstrIbuted
InterarrIvaI tImes. However, thIs tutorIaI`s network modeI wIII
contaIn a IInIte number oI nodes whIch each buIIer packets untII
the prevIous outstandIng transactIon compIetes. To cIoseIy IoIIow
the anaIytIcaI modeI`s assumptIons, a reIatIveIy Iarge number oI
transmItter nodes must exIst on the bus.
The network modeI wIII be constructed wIthIn a subnet so that a
smaII scaIe coordInate system can be used.
1) SeIect New Irom the Flle Menu, and seIect Proect Irom the
resuItIng puIIdown menu. Name the project
<initials>cctnetwork and the scenarIo aloha, then cIIck OK.
2) Quit the Startup Wzard
3) Open the Obect Palette, then create a subnet node anywhere
In the workspace. Name the subnet cctnet.
The network modeI wIII be buIIt so that It
can be used when anaIyzIng both the AIoha
and CSMA protocoIs. ThIs wIII be done by
deIInIng the nodes so that they reIerence
the generIc node modeIs, and Iater changIng the reIerenced
process modeIs at the node IeveI.
35
of
76
CSMAJCD uilding the Aloha Model
The next step Is to change the propertIes wIthIn the subnet to a
more usabIe scaIe:
1) DoubIecIIck on the subnet Icon to move to the subnet vIew.
2) SeIect Crid Properties Irom the View menu.
3) Change the units attrIbute to Meters.
4) Change the resolution attrIbute to 1 pixJm.
5) Change the division attrIbute to 100.
6) LeItcIIck the Close button.
36
of
76
CSMAJCD uilding the Aloha Model
n order to easIIy buIId your network, you need a custom paIette
whIch contaIns the necessary objects Ior your network. To create
the paIette:
1) n the Obect Palette wIndow, cIIck on the Configure Palette.
button.
2) n the Configure Palette dIaIog box, cIIck Clear.
AII objects except the subnet are removed Irom the paIette.
3) CIIck on the Node Models button, then add <initials>ccttx
and <initials>cctrx Irom the IIst oI avaIIabIe node modeIs.
Close the dIaIog box when you are IInIshed.
4) CIIck on the Link Models button, then add <initials>cctlink
Irom the IIst oI avaIIabIe IInk modeIs. Close the dIaIog box
when you are IInIshed.
5) Save the CML by cIIckIng on the Save button In the Configure
Palette dIaIog box. Use <initials>cct as the IIIe name.
6) CIIck OK to cIose the Configure Palette dIaIog box.
The <initials>cct CML Is ready Ior use.
37
of
76
CSMAJCD uilding the Aloha Model
nstead oI creatIng the entIre bus network by hand, you can use
rapId conIIguratIon to buIId It quIckIy:
1) CIIck on the Rapid Configuration actIon button.
2) SeIect bus Irom the menu oI avaIIabIe conIIguratIons, then
cIIck OK.
3) n the Rapid Configuration dIaIog box, set the IoIIowIng
vaIues:
4) CIIck OK when aII the vaIues are entered.
The network on the IoIIowIng page Is drawn In the
workspace.
38
of
76
CSMAJCD uilding the Aloha Model
RapId ConIIguratIon creates the IoIIowIng bus network:
ThIs network stIII needs a receIver node. To add thIs node and
connect It to the network:
1) CIIck and drag the receIver node <initials>cctrx Irom the
paIette Into the IeIt sIde oI the tooI area.
2) CIIck on the <initials>cctlink tap IInk In the paIette, then
draw a tap Irom the bus to the receIver node.
Note: You cannot draw a tap Irom the node to the bus.
duplex link
39
of
76
CSMAJCD uilding the Aloha Model
The compIeted bus modeI Iooks IIke thIs:
FInaIIy, you can save the modeI (but do not exIt the Project EdItor)
and cIose the object paIette.
40
of
76
CSMAJCD uilding the Aloha Model
Executing the Aloha Simulation
8ecause thIs sImuIatIon produces scaIar resuIts, an output scaIar
IIIe must be specIIIed where these resuIts accumuIate Irom
successIve sImuIatIons. ThIs must be done In the SImuIatIon
ConIIguratIon EdItor, whIch can be reached by seIectIng
Configure Simulation (advanced) Irom the Simulation menu In
the Project EdItor.
The goaI oI thIs Iesson Is to observe how the perIormance oI the
protocoIs varIes as a IunctIon oI channeI traIIIc. The InterarrIvaI
tIme Input parameter wIII be varIed In a serIes oI sImuIatIons to
produce dIIIerent IeveIs oI traIIIc and hence, dIIIerent IeveIs oI
throughput. ConcIusIons wIII be drawn Irom the resuIts oI tweIve
sImuIatIons, each wIth a dIIIerent InterarrIvaI tIme vaIue.
1) SeIect Configure Simulation (advanced) Irom the Simulation
menu.
The SImuIatIon ConIIguratIon EdItor opens wIth
a sIngIe sImuIatIon set object In the workspace.
2) RIghtcIIck to open the attrIbute dIaIog box Ior the
sImuIatIon set.
41
of
76
CSMAJCD uilding the Aloha Model
There are a number oI thIngs that need to be changed In the
sImuIatIon set:
1) Set the IoIIowIng attrIbutes In the sImuIatIon set:
You need to add the max packet count attrIbute and the
interarrival args attrIbute to the attrIbute tabIe:
1) CIIck on the Add button just under the attrIbute tabIe.
2) n the Add Attribute dIaIog box, add max packet count and
cctnet.*.gen.interarrival args. CIIck OK.
3) Under max packet count, add the vaIue 1000.
4) Under cctnet.*.gen.interarrival args, add the vaIues 1000,
200, 150, 100, 80, 50, 35, 30, 25, 20, 18, 15.
(To enter muItIpIe vaIues Ior the InterarrIvaI args attrIbute, seIect
It In the tabIe, then cIIck the Values. button and enter one vaIue
per row In the resuItIng dIaIog box.)
5) CIIck OK when you are IInIshed.
Attribute Value
ScaIar IIIe <InItIaIs>ccta
Seed 531
DuratIon 20000 seconds
42
of
76
CSMAJCD uilding the Aloha Model
Note that the Icon Ior the sImuIatIon set object now Iooks IIke the
one shown beIow, IndIcatIng that the sequence contaIns more
than one run (one run Ior each vaIue oI interarrival args):
1) Save the sImuIatIon sequence.
I the output scaIar IIIe <initials>ccta does not exIst when the
sImuIatIon sequence begIns, one wIII be created so that scaIar
resuIts may be recorded. I the IIIe aIready exIsts, the sImuIatIon
executabIes wIII append theIr scaIar resuIts to thIs IIIe. To avoId
vIewIng obsoIete resuIts whIch may aIready exIst In a sImIIarIy
named IIIe, the output scaIar IIIe <initials>ccta must be deIeted
II It exIsts.
1) SeIect Delete Models Irom the File menu.
A IIst oI deIetabIe IIIe types appears.
2) SeIect the Output Scalars Item.
A IIst oI avaIIabIe output scalar files appears.
3) I the IIst contaIns the output scaIar IIIe <initials>ccta, seIect
the entry to deIete the IIIe.
4) Close the open dIaIog boxes.
43
of
76
CSMAJCD uilding the Aloha Model
The sImuIatIon can now be executed. 8ecause the sImuIatIon
sequence executes many IndIvIduaI sImuIatIons, the totaI
executIon tIme mIght take severaI mInutes.
1) CIIck on the Execute Simulation Sequence actIon
button.
2) LeItcIIck OK at the Confirm Execution dIaIog box. A
sequence composed oI many runs may be tImeconsumIng to
execute, and thIs dIaIog box gIves you the optIon oI deIerrIng
the process.
The 12 sImuIatIons dIspIay theIr progress as they execute.
Any sImuIatIon run that generates 1000 packets (the vaIue
oI max packet count) wIII termInate wIth a message such
as that shown beIow:
3) When the sImuIatIons are compIete, close the edItor.
44
of
76
CSMAJCD Analyzing the Aloha Results
4. Analyzing the Aloha Results
The resuIts oI each sImuIatIon are stored as two scaIar vaIues In
the output scaIar IIIe, aIIowIng you to vIew the network`s
perIormance as a IunctIon oI an Input parameter rather than a
IunctIon oI tIme. The channeI throughput as a IunctIon oI channeI
traIIIc across aII oI the sImuIatIons can be vIewed In the AnaIysIs
ConIIguratIon EdItor.
1) n the Project EdItor, choose View Results (Advanced) Irom
the Results menu.
The AnaIysIs ConIIguratIon EdItor opens.
2) SeIect Load Output Scalar File Irom the File menu.
3) SeIect <initials>ccta Irom the IIst oI avaIIabIe IIIes.
AIoha channeI perIormance can be
measured accordIng to the number oI
successIuIIy receIved packets as a IunctIon
oI the packets submItted, regardIess oI
whether the packets are orIgInaI or retransmItted. n thIs
network, channel throughput Is a typIcaI measurement oI
network perIormance.
45
of
76
CSMAJCD Analyzing the Aloha Results
Draw the scaIar paneI:
1) CIIck on the Create Scalar Panel actIon button.
2) SeIect the horIzontaI varIabIe Channel Traffic C IIrst,
then seIect the vertIcaI varIabIe Channel Throughput S Irom
the menu oI avaIIabIe scaIars that pops up.
3) CIIck OK.
The graph oI the scaIar paneI appears In the workspace (the
graph Is shown on the next page).
46
of
76
CSMAJCD Analyzing the Aloha Results
The scaIar graph paneI shouId resembIe the one beIow:
TheoretIcaI anaIyses have shown that a pure Aloha system has a
channeI throughput S as a IunctIon oI channeI traIIIc C gIven by S
= Ce2C. ThIs reIatIonshIp gIves a maxImum channeI throughput
oI Smax = 1J2e 0.18. At Iow traIIIc IeveIs, coIIIsIons seIdom
occur. At hIgh traIIIc IeveIs, the channeI Is overwheImed and
excessIve coIIIsIons prevent packets Irom beIng successIuIIy
receIved. ThIs behavIor Is ampIy demonstrated by the sImuIatIon
resuIts. n partIcuIar, the maxImum throughput Is achIeved near
C = 0.5 and Is cIose to the expected vaIue oI 0.18.
47
of
76
CSMAJCD Analyzing the Aloha Results
When you are IInIshed vIewIng the graph, close the graph paneI
and the AnaIysIs ConIIguratIon EdItor.
t shouId be noted agaIn that the theoretIcaI resuIts assume an
essentIaIIy InIInIte number oI sources to eIImInate the buIIerIng
eIIects whIch emerge In a reaI network. The anaIytIcaI modeI aIso
assumes that the system Is In an IdeaI steady state condItIon. Any
dIIIerences In the measured perIormance oI thIs modeI and the
anaIytIcaI modeIs can be attrIbuted to pecuIIarItIes oI the random
number seeds seIected Ior IndIvIduaI sImuIatIons (whIch can be
IIxed by usIng muItIpIe seeds) and the reaI worId IImItatIons
(IncIudIng IInIte sImuIatIon tIme and IInIte number oI nodes)
Imposed by the modeIs.

Das könnte Ihnen auch gefallen