Title: TCOM 512 Modeling and Simulation
1TCOM 512 Modeling and Simulation
2What is Modeling?
- Modeling is a process for studying the behavior
of complex systems - abstracting important details of system
- Ignore rest
- Study simpler system to understand behavior of
complex system. - How do we know what details we can ignore?
- Knowledge
- Heuristics
- Experience
- Iteration
3How do we choose between alternatives?
- What are the properties we need?
- What are the properties each approach possesses?
- Known
- Need analysis
- Estimate performance
- average case
- worst case
- Under what assumptions?
4Approaches to modeling
- Various Approaches
- Analytic Equations (or other formalisms) that
result in closed-form solution of system. - Simulation Program, or physical model, or
systems of equations, that describe instantaneous
state of system --- that we can use to emulate
the behavior of the system - Emulation combine simulation and a live network
- Prototype a proof of concept implementation
- Operational system The real stuff
- In all approaches, several basic steps
- Develop model
- Verify model
- Evaluate results of model
- Validate model
- Iterate, if necessary
5Developing a model
- What does my system do?
- Understand how to deal with basic issues how do
I deal with things that proceed in parallel? - How do I know when I can ignore details?
- Hard rules? No
- Heuristics.
- Often dependent on particular type of analysis
6 Back of envelope calculations
- Simplest form of analysis
- Implication get rid of all details so resulting
computation can fit on a piece of paper as small
as the back of an envelope - Another implication you can do this sort of
analysis in your head
7Sensitivity
- Given model, how sensitive is it to values of
parameters? - When can I round numbers?
- How sensitive is it to errors?
- How accurate is my estimate?
- When can I drop more details?
- Do I need to simulate a component in detail, or
can I summarize it?
8Verification
- Is the model represented correctly? Bugs in the
equations? - Are the input parameters accurate? Correct?
9Validation
- Is model/results believable?
- Matches known/measurable behavior?
- Consistent (roughly) with another model?
- Careful that you don't make the same mistake!
- Usually use one or more attempts at
back-of-the-envelope modeling to validate other
approaches. Not as useful for validating back of
the envelope approach, unless more than one model
is possible. - Violates laws of probability or reality?
10Simulations
- Must start with a model that abstracts away
certain details. - Abstraction differs from analytic model
- Functional/procedural/operational description
- Must frame things in terms of events
11What is simulation?
system boundary
system under study (has deterministic rules
governing its behavior)
exogenous inputs to system (the environment)
real life
observer
12Why Simulation?
- goal study system performance, operation
- real-system not available, is complex/costly or
dangerous (eg space simulations, flight
simulations) - quickly evaluate design alternatives (eg
different system configurations) - evaluate complex functions for which closed form
formulas or numerical techniques not available
13Simulation advantages/drawbacks
- advantages
- save lives, money
- find bugs (in design) in advance
- generality over analytic/numerical techniques
- detail can simulate system details at arbitrary
level - drawbacks
- caution does model reflect reality
- large scale systems lots of resources to
simulate (especially accurately simulate) - may be slow (computationally expensive 1 min
real time could be hours of simulated time) - art determining right level of model complexity
- statistical uncertainty in results
14Programming a simulation
- Whats in a simulation program?
- simulated time internal (to simulation program)
variable that keeps track of simulated time - system state variables maintained by
simulation program define system state - e.g., may track number (possibly order) of
packets in queue, current value of retransmission
timer - events points in time when system changes state
- each event has associated event time
- e.g., arrival of packet to queue, departure from
queue - precisely at these points in time that simulation
must take action (change state and may cause new
future events) - model for time between events (probabilistic)
caused by external environment
15Discrete Event Simulation
- simulation program maintains and updates list of
future events event list - simulator structure
initialize event list
get next (nearest future) event from event list
- Need
- well defined set of events
- for each event simulated system action, updating
of event list
time event time
process event (change state values, add/delete
future events from event list
update statistics
n
done?
16Simulation example
- processes arrive (avg. interrarrival time 1/ l)
for execution (avg. execution time 1/m) on
dual-processor system - arriving customer joins CPU queue with smallest
number of waiting processes
m1
l
m2
- state of system size of each queue
- system events
- job arrivals
- service time completions
- define performance measure to be gathered
17Simulation example
- Simulator initialization
- event list
- state variables
18Simulation example
- Simulator actions on arrival event
- if a queue empty place job in service (pick
one of empty queues), determine its service time
(a random number drawn from service time
distribution) add future event onto event list
for job completion, set number of jobs in queue
to 1 - if both queues full increment dropped
packets, ignore arrival - else find which queue to place job in
(shortest, with ties broken randomly), increment
number in queue where queued - create event for next arrival (generate
interarrival time) stick event on event list
19Simulation example
- Simulator actions on departure event
- Remove event, update simulation time, update
performance statistics - decrement counter of number of jobs in queue
- If (number of jobs in queue gt 0) put next job
into service schedule a completion event
(generate service time for job) -
20Back of the envelope calculation
21Objectives
- Back of envelope calculation
- Goal is to make rapid estimates
- To eliminate candidate solutions
- Establish feasibility
- Sketch potential paths to a solution
- Most engineers remember key numbers related to
their field, no one has all the details - Need to estimate not only the values of numbers
we need, but which numbers are appropriate, and
how to perform the calculation - Need to emphasize that these are rough estimates
- Emphasis here is on order of magnitude
estimates
22Accuracy of calculations
- Well-known curve of calculations accuracy versus
mental effort
23Fermi questions
- How many piano tuners are there in Chicago?
- Idea is to think about the process of estimating
an answer without any specialized knowledge - Requires estimation of physical quantities to
arrive at an answer - Goal is to get an answer to an order of magnitude
by making reasonable assumptions about the
situation - Not relying on definite knowledge for an exact
answer
24Fermi questions
- Posed with limited information given
- How many water balloons would it take to fill the
school gymnasium? - Requires that many more questions be asked
- How big is a water balloon
- What are the approximate dimensions of the gym
- What measurement must be estimated using the
dimensions of the gym - Requires communication
- Utilizes estimation
- Emphasizes process rather than the answer
25Fermi question
- How many piano tuners in NYC?
- Approximately how many people in NYC?
- 10,000,000
- Does every individual own a piano?
- No
- Okay families own a piano
- How many families are there in NYC
- Perhaps 2,000,000 families in NYC
- Does every family own a piano?
- No
- Perhaps one out of every five does
- It means that there are about 400,000 pianos in
NYC
26Fermi question
- How many piano tuners for 400,000 pianos
- Assume on the average every piano gets tuned once
a year, that there are 400,000 piano tunings
every year - How many piano tunings can one piano tuner do?
- Lets assume four pianos a day
- Assume 200 working days per year
- So every tuner can tune about 800 pianos per year
- How many piano tuners are needed in NYC?
- Number of tuners is approximately 400,000/800 or
500 piano tuners
27General principles
- Einsteins famous advice
- Everything should be made as simple as possible,
but no simpler - Ignore factors of 2, pi etc
- Round to the nearest 0,5,10
- Corollary do not make numbers more precise than
is necessary - Guess numbers that you do not know
- Try to make your guesses good ones within the
bounds of common sense - Adjust geometry to suit you
28General principles
- Use the principle of conservation
- What goes in must come out or stay
- Ensure formulas are dimensionally correct
- Apply a plausibility filter
- Need best case or worst case
29Some examples
- What is the mass in pounds of the number of
students in this class? - How many gallons of gasoline are used by cars
each year in NYC? - How high would a stack reach if you piled on a
million dollar bills in a single stack - How many hairs are on your head
30WLAN networks
- How many data sessions possible?
- How many voice sessions possible?
31WLAN networks
- How many voice conversations are possible in a
WLAN network? - How many data conversations are possible in a
WLAN network? - How many APs needed to support an enterprise?
- Size of the office
- Types of applications desired
- Coverage area of AP
32802.11 medium access rules
Basic medium access
Fragmentation
Transmission of multiple fragment MSDU using SIFS
33TCP throughput/loss relationship
packets sent per period
W
TCP window size
W/2
period
time (rtt)
34TCP throughput/loss relationship
packets sent per period
W
TCP window size
W/2
period
time (rtt)
B throughput formula can be extended to model
timeouts and slow start (PFTK)
35The end!