- .Creating Process Model
–Using the Process Editor to create a modified version of the sink process model.
–Adding a new statistic to compute ETE delay.
1. Create modified sink process model to compute ETE delay.
2. When there is a packet arrival, get the packet, obtain the creation time, write out its ETE
delay as a global statistic and destroy the packet.
3. Incorporate new sink process model into existing node model.
4. Create ETE delay statistic probe.
4. Run simulation for a duration of 2,000 seconds to ensure convergence.
5. Filter the “View Results” graphs to answer questions.
Step 1: Creating a new process model
1) Select: File / New / Process Model.
2) Left-click on the “Create State” button and place 3 “states” on the workspace.
3) Left-click on the “Create Transition” button. Starting at “st_1”, connect “st_1” to “st_2”.
4) Starting at “st_2”, create a transition to “st_3”.
Note: Left-clicking while drawing a transition will add vertices to your transition. When you
reach the next state (in this case “st_3”), left click again and the transition will have a curved
shape if you haven’t drawn a straight line.
5) Starting at “st_3”, create a transition back to “st_2”.
6) Right-click on each state and set the following attributes:
st_1: name = INIT status = forced
st_2: name = ETE_Destroy status = forced
st_3: name = WAIT
7) Right-click on the transition going from the “WAIT” state to the “ETE_destroy” state. Set
- the “condition” attribute to: PK_ARRIVAL (This is the name of the macro for this transition).
8) Left-click the Header Block (“HB”) button. Enter the following line of code to define the
#define PK_ARRIVAL (op_intrpt_type () == OPC_INTRPT_STRM)
9) Select File / Save in the Header Block window.
10) Click the “TV” button.
11) Enter the following:
double ete_delay; (HIT RETURN)
double creation_time; (HIT RETURN)
double current_time; (HIT RETURN)
int stream_index; (HIT RETURN)
- 12) Select File / Save (In the “Temporary Variables” dialogue box).
13) Double-click the top half of the “ETE_Destroy” state.
14) Enter the following in the “Enter Execs” window:
/* Get stream index number. */ (HIT RETURN)
stream_index = op_intrpt_strm(); (HIT RETURN)
/* Get pointer to packet from stream index. */ (HIT RETURN)
pkptr = op_pk_get(stream_index); (HIT RETURN)
/* Destroy packet. */ (HIT RETURN)
You will be adding more to the “Enter Execs” window later to calculate and collect statistics
15) Click File / Save (In the “Enter Execs” window).
Step 2: Defining a new statistic to compute ETE delay
1) Select Interfaces / Global Statistics.
2) In the “Declare Global Statistics” table enter the following:
Stat Name = ETE Delay Mode = Single
Count = N/A Draw Style = linear
Low Bound = 1.0 High Bound = disabled
3) Click “OK”.
- 4) Click on the “State Variables” (SV) button.
5) In the “state variables” table enter:
Type = Stathandle Name = ete_gsh
6) Click “OK”.
7) Double-click on the top half of the “INIT” state.
8) Enter the following in the “Enter Execs” window:
/* Register handle for statistic collection. */ (HIT RETURN)
ete_gsh = op_stat_reg("ETE Delay", OPC_STAT_INDEX_NONE,
9) Click File / Save (In the “Enter Execs” window).
10) Double-click on the top half of the “ETE_Destroy” state.
11) Enter the following in the “Enter Execs” window starting on line 6 (e.g. before
Place the cursor on line 6 and HIT RETURN.
/* Get creation time of packet. */ (HIT RETURN)
creation_time = op_pk_creation_time_get(pkptr); (HIT RETURN)
/* Get current simulation time. */ (HIT RETURN)
current_time = op_sim_time(); (HIT RETURN)
/* Calculate ETE Delay. */ (HIT RETURN)
ete_delay = (current_time - creation_time); (HIT RETURN)
/* Write statistics. */ (HIT RETURN)
op_stat_write(ete_gsh, ete_delay); (HIT RETURN)
12) Click File / Save (In the “Enter Execs” window).
13) Click the “Compile” button
- 14) Name the File “ETE_Destroy”
15) Click “OK”.
16) Close the Process Editor window.
Step 3: Modifying an existing project to include new changes
1) Select File / Open / Project / bank_net.
2) Select Scenario / Duplicate Scenarios and name the new scenario: “process”.
2) Double-click on the Philly_dest node to enter the Node editor.
3) Right-click on the “sink” module and change the following:
name = ETE_Destroy
process model = ETE_Destroy
4) Click “OK”.
5) Select File / Save in the Node Editor.
6) Close the Node Editor.
7) In the Project Editor, select File / Save.
Step 4: Configuring the Probe Model
1) Select Simulation / Choose Statistics (Advanced).
2) Create a “Global Statistic Probe”.
3) Right-click on the probe to bring up the probe attributes.
4) Changed the following attributes:
name = ETE Delay
5) Right-click on the probe and select “Choose Statistic”.
Select the statistic = ETE Delay
- 6) Click “OK”.
7) Select File / Save in the Probe Editor.
8) Close the Probe Editor.
Step 5: Configuring the Simulation
1) Configure the simulation as follows:
duration = 2000 seconds
2) Click “Run”.
–Transmitter data rate is 9600 bits/second.
–The size of a transaction varies according to a normal distribution with a mean size of 3200
bits and a variance of 400 bits.
–Transactions are modeled as exponential interarrivals, with an arrival rate of 2
Step 6: Viewing Results:
1) Select Results / View Results.
2) Select Global Statistics / ETE Delay (Average).
3) Select Global Statistics / ETE Delay (As Is).
4) In the “View Results” window select:
Global Statistics / ETE Delay (Cumulative Distribution [CDF])
5) Place the mouse pointer on the point where the blue curve intersects with the 1second mark
on the horizontal axis. The “tool tips” box will pop up and tell you the values of the horizontal
and vertical axes where your mouse pointer is located.