• Skip to main content
  • Skip to secondary navigation

Mink Hollow Media

Democratizing Information Technology

  • About Us
    • Katrin Becker
  • Newest
  • In Development
  • Contact Us
  • Teaching & Learning
  • Games
  • Memoir
  • Programming
  • Science
  • Art
  • All Books

9: Verification & Validation

 Chapter 9

Here’s were we will put color versions of the images, updates, and other extras.

How do you ensure that the simulation you design simulates your model faithfully? In order to have confidence that the key elements of the simulation are faithful implementations of the original system it is necessary to verify both the model and the resultant simulation. This chapter will explain the process and examine several example approaches.

wordl-ch-09-mar-17

  1. What is Verification & Validation in a Simulation or a Game?
  2. How Do We Know There’s A Problem?
    1. Collecting Confirming Data
  3. Verification
    1. Code Verification
    2. Solution Verification
  4. Validation
    1. Conceptual Model Validation
    2. Face Validity
    3. Internal Validity
    4. Event Validity
    5. Sensitivity Analysis
    6. Historical validation
    7. Predictive Validation
    8. Extreme Condition/Degenerate Tests
  5. Validation and Verification of Games
    1. Play Testing
    2. Effectiveness
  6. Summary
    1. Concepts
    2. Terminology
  7. References, Notes & Further Resources

Images

*Please note: all images are copyrighted, permission to use an image must be obtained from Wiley (and possibly also the original sources).

 

Figure 9.1: – Position of the weight plotted as a function of time, as generated by the first version of the Simple Harmonic Motion simulation.
Figure 9-2: How a debugger looks while running. The computer program is in source code form and is executed statement-by-statement. The yellow arrow indicates the current statement, while red dots marke statements where execution will pause so that the programmer can examine variables.

Single Server queuing model – SIMULA code, exponential arrivals/departures

comment
Single server queueing model – exponential distribution.

This is one half of the UNIX arrival process model. This is
the ‘control’ – the usual assumption on the arrival process is that
interarrival times are exponentially distributed. This model
runs for two simulated weeks, and collects queue stats and metrics
to compare with the next model, using UNIX interarrival times;

simulation begin

ref (head) q;            comment The system queue;
real u1,u2;
real lastidle, idtime, arrtsum, rtime, qtime, sizeint, ls;
real mitime, mstime, q1samp, q0samp, sersum, q2samp,t1,t2;
integer nidle, narr, nsers, nsamps, V1, V2;
integer  sizeofq, nrsamps, nzsamps, ns;
real a, b, c, d, e, f,x1,x2;

link class arrentry;
begin
real arrtime;
end;

process class arrprocess;
begin
ref(arrentry) b;
real a;

while true do
begin
b :- new arrentry;    comment  Create a new queue entry;
b.arrtime := time;    comment  save the arrival time;
b.into(q);        comment  Put this entry into the queue;
sizeint := sizeint + sizeofq*(time-ls); ns := ns+1;
ls := time;
sizeofq := sizeofq + 1;
if server.idle then
begin
nidle := nidle + 1;
idtime := idtime + (time-lastidle);
activate server after current;
end;
a := arrtime;
arrtsum := arrtsum + a;
narr := narr + 1;

hold ( arrtime );
end;
end;

process class serve;
begin
ref(arrentry) x;
real a, b, c;

while true do
begin
if q.empty then begin
lastidle := time;
passivate;
end;

x :- q.first;
q.first.out;
a := sertime;
nsers := nsers + 1;
sersum := sersum + a;
hold(a);
sizeint := sizeint + sizeofq*(time-ls);
ls := time;     ns := ns + 1;
sizeofq := sizeofq – 1;
rtime := rtime + (time-x.arrtime);
nrsamps := nrsamps + 1;
qtime := qtime + (time-x.arrtime-a);
end;
end;

process class demon;
begin
integer i;

while true do
begin
hold (60);        comment Sample every 1 Min;
nsamps := nsamps + 1;
i := sizeofq;
q0samp := q0samp + i;
if (i > 2) then
begin    q1samp := q1samp + (i-1);
nzsamps := nzsamps + 1;
end;

if i>1 then i := i-1
else i := 0;
q2samp := q2samp + i;
end;
end;

real procedure sertime;
begin
sertime :=  negexp (1.0/mstime, V2);
end;

real procedure arrtime;
begin
real x1,x2;

if (time > t2) then
begin    t1 := t1 + 900;        comment Add 15 minutes;
t2 := t2 + 900;
x1 := inreal;        comment The time period;
x1 := inreal;        comment The mean;
x2 := inreal;        comment The standard deviation;
x2 := x2 * x2;        comment Variance;
comment        outtext (”  Mean is “) outreal (x1,4,12)
outtext (” SD is “) outreal(x2,4,12)
outimage;

getmeans(x1,x2);
comment        outtext (“U1 is “) outreal (1.0/u1,4,12)
outtext (“U2 is “) outreal (1.0/u2,4,12)
outimage;
end;
x1 := hypoexp (u1, u2, V1);    comment Assume hypoexponential;
arrtime := x1;
end;

real procedure hypoexp (u1,u2, V2);
name V2;
real u1,u2;    integer V2;
begin
hypoexp := negexp (u1, V2) + negexp (u2, V2);
end;

procedure getmeans (x1,x2);
real x1,x2;
begin
real a,b,c,d,e,f;

a := 2.0*x2 – x1*x1;
if (a < 0.0) then
begin    outtext (“** Complex solution for mean/sd. “);
outreal (time, 4, 12);  outreal(x1,4,12); outreal(x2,4,12);
outreal (a,4,12); outimage;
u1 := 2.0/(x1);    u2 := u1;
end else begin
a := sqrt (a);

b := (x1 + a)/2.0;
c := (x1 – a)/2.0;
if (b<0.0) and (c<0.0) then
begin    outtext (“** Negative means “);
outreal (time, 4, 12);  outreal(x1,4,12); outreal(x2,4,12);
outreal (a,4,12); outimage;
end
else if (b*c > 0) then
u2 := (if b<c then b else c)
else if (b<0.0) then u2 := c
else u2 := b;
u1 := x1 – u2;
u1 := 1.0/u1;    u2 := 1.0/u2;
end;
end;

ref(serve) server;
ref(arrprocess) arrp;
ref(demon) sprocess;

q :- new head;
server :- new serve;
arrp   :- new arrprocess;
sprocess :- new demon;
activate sprocess after current;
activate arrp after current;
activate server after current;
mstime := 8.0;
mitime := 27.3;
V1 := 109827;        V2 := 87611;

sizeofq := 0;    rtime := 0.0;    qtime := 0.0;    nrsamps := 0;
a := 3600 * 24 * 7;        comment 1 week;
lastidle := 0.0;    sersum := 0.0;        arrtsum := 0.0;
q0samp := 0.0;        q1samp := 0.0;        sersum := 0.0;
nidle := 0;    narr := 0;    nsers := 0;    nsamps := 0;
q2samp := 0.0;    nzsamps := 0;
ls := 0.0;    sizeint := 0.0;    ns := 0;
t1 := 0.0;    t2 := 900.0;
x1 := inreal;    x1 := inreal;    x2 := inreal; x2 := x2*x2;
comment    outtext (”  Mean is “) outreal (x1,4,12)
outtext (” SD is “) outreal(x2,4,12)
outimage;
getmeans (x1,x2);
comment        outtext (“U1 is “) outreal (1.0/u1,4,12)
outtext (“U2 is “) outreal (1.0/u2,4,12)
outimage;

hold(a);        comment 1 day;

outtext (“Single Server Queueing System – Exponential arrival/service times.”);
outimage;

outtext (“Specified interarrival time was: “);
outreal (mitime, 4, 12);
outtext (”   Measured interarrival time was “);
outreal (arrtsum/narr, 4, 12);
outimage;
mitime := arrtsum/narr;

outtext (“Specified service time was “);
outreal (mstime, 4, 12);
outtext (”     Measured service time was “);
outreal (sersum/nsers, 4, 12);
outimage;

outtext (“Total idle time was “); outreal (idtime,4,12);
outtext (” in “); outint(nidle, 10); outtext (” idle periods.”);
outimage;
outtext(“Mean idle period was “); outreal(idtime/nidle,5,12);
outimage;
outtext(“Probability of being idle was “); b := idtime/a;
outreal (b, 5,12); outtext (” Predicted was “); c := mstime/mitime;
outreal (1.0-c, 5,12); outimage;

d := c/(1.0-c);
outtext (“Mean system size was “); outreal (q0samp/nsamps, 4, 12);
outtext (” Predicted was “); outreal (d, 4, 12);
e := sizeint/a;
outreal (e, 4, 12);
outimage;

e := 1.0/(1.0-c);
outtext (“Mean queue size (>0) was “);
if (nzsamps <> 0) then
outreal (q1samp/nzsamps,4,12);
outtext (” Predicted was “); outreal (e, 4, 12);
outimage;

e := (c*c)/(1.0-c);
outtext (“Mean queue size was “);
if (nsamps <> 0) then
outreal (q2samp/nsamps,4,12);
outtext (” Predicted was “); outreal (e, 4, 12);
outimage;

e := 1.0/( (1.0/mstime) – (1.0/mitime) );
outtext (“Mean response time was “); outreal (rtime/nrsamps,4,12);
outtext (” Predicted was “); outreal (e, 4, 12);
outimage;

a := 1.0/mitime;    b := 1.0/mstime;
e := a/(b*(b-a));
outtext (“Mean queue wait time was “); outreal (qtime/nrsamps,4,12);
outtext (” Predicted was “); outreal (e, 4, 12);
outimage;

end;

 

 

Copyright © 2026 · Author Pro on Genesis Framework · WordPress · Log in