English:Modelling real-world systems with computational abstractions - Computing Year 9
Introduction
Build and evaluate an original executable model of a school canteen queue. Define the boundary and rule order,trace the required scenario,compare uneven arrivals and explain why a correctly computed result is still conditional on assumptions. Year9 placement is editorial within England’s KS3 Computing pathway.
Choose the purpose, boundary and assumptions
Decide what the model is for
A computational model is a deliberately simplified representation of a system. A simulation runs its rules to explore how the represented state changes. The question comes first: a model useful for estimating the number waiting at minute boundaries may be inadequate for individual waiting times, accessible service arrangements, food choices or staffing decisions. A detailed picture is not automatically a better model; an attractive animation may still apply the wrong rule.
Our original question is: under invented arrival and service schedules, how does the number waiting at a school canteen change over three one-minute intervals? The system boundary includes the waiting count, new arrivals and the available service capacity. It excludes the kitchen, walking routes, individual identities, payment, food preparation, people leaving without service and different service durations. The omissions make the calculation manageable and also limit its conclusions. No real pupil data is needed.
| Part | Original model definition | Why it matters |
|---|---|---|
| State | Number waiting at the previous interval end | Carries the result into the next step |
| Input | Arrival batch and service capacity for each minute | Can change between scenarios |
| Initial condition | Two people already waiting | Not the same as starting empty |
| Rule order | Arrivals join first; available service happens second | Determines whether new arrivals can be served immediately |
| Output | End counts, total served and explicitly defined summaries | Does not contain individual waiting times |
| Time step | One minute per scheduled batch | Not a continuous record of each person |
Counts use people, capacity uses people per one-minute interval and the schedule length supplies the simulated duration. Capacity is a maximum, not a promise that many people are available. If only two people are present and capacity is five, two are served and three units of capacity are unused. A queue cannot contain minus three people. Keep units and the observation time alongside every number.
The source bus-queue example follows the same simplified idea: three arrivals and capacity two add one person per minute while enough people are available. That statement is conditional on the batching convention. A real bus may leave only at a departure time, have limited seats and receive uneven arrivals; a minute-by-minute service count is an abstraction, not a complete bus timetable.
Use media as a question, not a measurement
A simulation demonstration may show animated people or moving counters, but appearance alone cannot establish real arrival rates, individual waiting times or whether a service works well for every user. Separate observed features, assumed values and calculated outputs. Invented classroom parameters must never be reported as real canteen research.
IITSEC/NTSA: Modeling & Simulation 101, a historical 2009 introduction to applications. Use it to distinguish a represented system, a purpose and an omitted detail; its examples are not evidence that this classroom queue has been validated. Original: IITSEC, Modeling & Simulation 101. The written explanations and native tasks work without sound or the external player. After watching, choose one application and ask what would need checking before using its predictions. The same question applies to a simple school model: which observation would show that the chosen abstraction is fit for the intended purpose?
Trace and execute an explicit queue model
Specify the rule and trace every state
For each interval, first add the arrivals to the previous waiting count. The number served is the smaller of available people and capacity. Subtract that actual service from availability. With non-negative counts, the resulting end count is also given by the following expression. Here q is the previous end count, a is that interval's arrival batch and c is its capacity; the maximum with zero prevents a negative queue.
The required transfer starts with two people, adds four and serves up to three each minute for three minutes. In minute one, 2 + 4 = 6 people are available, three are served and three remain. The next interval begins with three, not the original two. Reusing the initial condition at every step would erase the system's memory and give an incorrect trace.
| Minute | Before | Arrivals | Available | Capacity | Actually served | After |
|---|---|---|---|---|---|---|
| 1 | 2 | 4 | 6 | 3 | 3 | 3 |
| 2 | 3 | 4 | 7 | 3 | 3 | 4 |
| 3 | 4 | 4 | 8 | 3 | 3 | 5 |
The end-count sequence is 2 initially, then 3,4,5. Fourteen people have been available over the whole run: two initially plus twelve arrivals. Nine have been served and five remain. This conservation check is an independent way to catch a trace error. It does not tell you who was served first or how long an individual waited.
Run the complete original Python model
Use a school-approved Python 3 environment. Save the following complete source as a new local practice file and run it there. The code needs no installation package, network, account or real school information. It rejects unsupported inputs rather than silently interpreting a negative count or a Boolean as a person. Schedule entries and initial counts are whole integers from zero to100; schedules have equal lengths of at most20 minutes.
def checked_count(value, name):
if type(value) is not int or not (value >= 0 and 100 >= value):
raise ValueError(name + " must be a whole count from 0 to 100")
return value
def queue_model(initial, arrivals, capacities):
current = checked_count(initial, "initial")
if type(arrivals) is not list or type(capacities) is not list:
raise ValueError("arrivals and capacities must be lists")
if len(arrivals) != len(capacities) or len(arrivals) > 20:
raise ValueError("use equal schedules of at most 20 minutes")
for value in arrivals:
checked_count(value, "arrival batch")
for value in capacities:
checked_count(value, "service capacity")
rows = []
for minute, (new, capacity) in enumerate(zip(arrivals, capacities), start=1):
before = current
available = before + new
served = min(available, capacity)
current = available - served
rows.append({"minute": minute, "before": before, "arrivals": new,
"available": available, "capacity": capacity,
"served": served, "after": current})
endings = [row["after"] for row in rows]
return {"initial": initial, "final": current,
"total_arrivals": sum(arrivals),
"total_served": sum(row["served"] for row in rows),
"peak_end": max([initial] + endings),
"mean_end": sum(endings) / len(endings) if endings else None,
"trace": rows}
def fixed_batches(initial, arrivals_per_minute, capacity_per_minute, minutes):
checked_count(arrivals_per_minute, "arrival batch")
checked_count(capacity_per_minute, "service capacity")
if type(minutes) is not int or not (minutes >= 0 and 20 >= minutes):
raise ValueError("minutes must be a whole count from 0 to 20")
return queue_model(initial, [arrivals_per_minute] * minutes,
[capacity_per_minute] * minutes)
if __name__ == "__main__":
result = fixed_batches(2, 4, 3, 3)
for row in result["trace"]:
print(row["minute"], row["before"], row["arrivals"], row["served"], row["after"])
print("final", result["final"])
print("served", result["total_served"])
print("peak_end", result["peak_end"])
print("mean_end", result["mean_end"])The main example prints the five columns minute,before,arrivals,served,after as '1 2 4 3 3', '2 3 4 3 4' and '3 4 4 3 5'. It then reports final5,served9,peak_end5 and mean_end4.0. Function inputs name the scenario; the returned dictionary separates trace data from summaries. Keep the input schedules unchanged so a later comparison uses the same declared scenario.
The peak_end summary is the largest of the initial count and end-of-minute counts. It is not the greatest transient availability just after a whole arrival batch joins. In the worked trace that availability reaches eight, while peak_end is five. The mean_end summary averages only the three ending counts: 3 + 4 + 5 divided by3 =4. It excludes the initial count and is neither a measured mean waiting time nor a continuous time average within each interval.
An empty schedule returns the initial count, zero arrivals, zero service, a peak equal to the initial count and mean_end set to None. There are no ending samples to average. Capacity zero is a valid scenario, and an arrival batch of zero is not missing data. The code rejects negative counts, fractions, unequal schedules, more than20 intervals and Boolean values. These bounds define this teaching implementation; they do not define how every simulation tool must work.

Try capacity four with the original constant arrival schedule: the ending counts are2,2,2 and twelve people are served. With capacity five the ending counts are1,0,0; the service counts are5,5,4. The final interval cannot serve a fifth person when only four are available. Predict these rows before executing the changed scenario.
Compare scenarios and evaluate model limits
Change assumptions, not just the picture
An experiment with a model should state exactly what changes and what stays fixed. Keep the initial count and arrival schedule fixed when examining a change in capacity. Keep capacity fixed when examining the timing of arrivals. Several simultaneous changes may be worth investigating later, but a difference in output would then have several possible explanations. Do not treat one altered run as proof of a cause in a real school.
| Scenario, all starting with2 | Arrivals by minute | Capacity by minute | End counts | Final | Total served |
|---|---|---|---|---|---|
| Even arrival batches | 4,4,4 | 3,3,3 | 3,4,5 | 5 | 9 |
| Early burst | 8,0,4 | 3,3,3 | 7,4,5 | 5 | 9 |
| Late burst | 0,0,12 | 3,3,3 | 0,0,9 | 9 | 5 |
| Higher capacity | 4,4,4 | 5,5,5 | 1,0,0 | 0 | 14 |
The first three schedules have the same twelve total arrivals and the same average arrival batch of four per minute. Yet the late burst ends with nine waiting because early capacity could not be stored for later use. Substituting an average arrival rate can conceal timing that matters. In the early-burst case the final count equals the even case, but peak_end rises from5 to7. A final count alone misses that difference.
The average sampled end count also needs careful interpretation. The even case gives4; the early burst gives16 divided by3, about5.33; the late burst gives3. The late burst has the lowest of these three sampled averages but the highest final backlog. That does not make it the best service arrangement. You have changed when people arrive, and the aggregate model has no individual waiting-time output. Select metrics that answer the purpose and report trade-offs rather than choosing whichever number makes a proposal look good.
Verify the program and validate the abstraction
Verification asks whether the program implements the specified rule. A hand trace, conservation check, empty schedule, insufficient-people case and exhaustive small-input tests can help. Validation asks whether that specified model is appropriate for the real question. A perfectly coded batch rule may still omit important real variation. Correct software and a plausible picture are not independent evidence that its predictions describe a particular canteen.
Compare arrival-first with service-first: starting empty with one arrival and capacity one, arrival-first ends at zero; service-first serves nobody from the empty starting queue and then ends at one. Both can be coherent conventions, but they answer different timing assumptions. Do not switch order midway through a trace or silently compare outputs from different conventions.
For a real study, arrange any observations through the school and record only approved aggregate counts at a clearly defined boundary. Avoid names, photographs of pupils, payment details or individual schedules. Compare the model output with separate observations; adjusting parameters to match one observation is calibration, not proof that it predicts other intervals. Variation in arrivals, service time, available counters and people leaving may motivate a better model. More variables also require evidence and testing; complexity alone is not improvement.
For a broader comparison, Uri Wilensky’s original NetLogo Traffic Basic model represents cars on a continuous-loop road using local acceleration and deceleration rules. Its state and purpose differ from this aggregate queue. Read its own assumptions before using its optional external runner. You do not need to install anything or create an account to complete this course’s native exercises.
Submit a specification naming purpose,boundary,units,initial conditions,state,inputs,rule order and outputs. Include the required2→3→4→5 trace,a changed scenario,an independent check and at least two limitations with a justified improvement. Say what was actually executed and what is only proposed. Neither a model experiment nor a quiz score is authorisation to change real staffing,accessibility arrangements,traffic control or service procedures.
Interactive Tasks
Quiz: Test Your Knowledge
What makes a computational model useful? (It represents relevant features well enough for a stated purpose) (!It includes every detail regardless of available evidence) (!It always predicts reality without uncertainty) (!It has the most impressive animation)
Which information is outside this model’s state? (The waiting time of each identified person) (!The aggregate number waiting) (!The arrival batch for a minute) (!The service capacity for an interval)
In the required first minute,what is the correct end count? (3 people after 2 plus4 arrivals and3 served) (!6 people because service is ignored) (!2 people because the initial count never changes) (!Minus3 people because capacity is always subtracted first)
Which ending sequence matches the required three-minute scenario? (3,4,5) (!2,2,2) (!1,0,0) (!7,4,5)
If two people are available and capacity is five,how many are served? (2) (!5) (!7) (!Minus3)
What does the conservation check establish in the required run? (Two initial plus twelve arrivals equals nine served plus five remaining) (!Five final means every person waited five minutes) (!Capacity three guarantees fifteen people were served) (!The model has measured a real canteen)
Why do equal mean arrival rates not guarantee equal final queues? (The timing of arrivals can leave earlier service capacity unused) (!Averages automatically preserve every event time) (!A queue must be negative before it can grow) (!The initial condition becomes irrelevant)
Which description of peak_end is correct? (The largest initial or end-of-minute count in this implementation) (!The largest transient availability after every arrival batch) (!The longest individual wait measured in minutes) (!The number of people served in the whole run)
What is validation of a model mainly concerned with? (Whether the chosen abstraction is appropriate for the real purpose) (!Only whether Python accepts its indentation) (!Whether the screenshot looks realistic) (!Whether every run prints the same number)
What is the honest interpretation of an empty schedule? (No intervals ran and no ending-sample mean is available) (!Every initially waiting person was necessarily served) (!The mean wait for each person was measured as zero) (!The input must be replaced with an invented minute)
Memory Game
| State | The represented condition carried between model steps |
| Input | A supplied value or schedule used by the model |
| Boundary | What is included in and excluded from the system |
| Assumption | A declared simplification or condition |
| Verification | Checking implementation against its specification |
| Validation | Checking fitness of the model for its real purpose |
Drag and Drop
| A photo looks realistic but supplies no arrival counts | Keep numerical schedules labelled as assumptions |
| Capacity exceeds people available | Serve only the available people |
| Two schedules share an average but differ in timing | Trace the separate batches before comparing outcomes |
| The program passes a hand trace | Claim verification evidence for that case,not universal real-world validity |
| A final count is used as individual waiting time | Reject the inference because individual histories are absent |
Crossword Puzzle
| MODEL | What represents selected features of a system? |
| STATE | What condition is carried into the next step? |
| BOUNDARY | What identifies included and omitted parts? |
| CAPACITY | What is the maximum service available per interval? |
| ARRIVAL | What brings a new person into the represented queue? |
| ASSUMPTION | What condition must accompany an output claim? |
LearningApps
Optional extra practice. Choose an appropriate activity with your teacher. If the external collection is unavailable, use the native activities and independent tasks in this course.
Cloze Text
Open Tasks
Easy
- Identify model parts: Name the purpose,boundary,state,input and output of the original canteen model.
- Complete the required trace: Start with2,add4 and serve up to3 each minute for three minutes;show every intermediate availability.
- Check insufficient people: Explain what happens when two are available and capacity is five.
- Read a metric carefully: Distinguish final count,peak_end and an individual waiting time.
Standard
- Build the required model specification: State the question,units,initial conditions,rule order and limitations for the canteen example.
- Execute and verify: Run the complete source in an approved Python3 environment,record the required trace and conservation check.
- Compare a changed assumption: Keep arrivals fixed and change capacity;predict before executing and compare exact outputs.
- Test uneven arrivals: Compare even,early-burst and late-burst schedules and explain why equal means conceal timing.
Advanced
- Challenge the time convention: Compare arrival-first and service-first for an empty queue with one arrival and capacity one.
- Evaluate metrics: Explain why the late-burst mean_end of3 does not establish better service than an even schedule with mean_end4.
- Plan model validation: Propose approved aggregate observations,separate calibration from testing and avoid personal pupil data.
- Improve purposefully: Choose one omitted factor,justify why it matters and specify additional evidence and tests before adding it.
Learning Check
- Required state trace: Model initial2,arrival4 and capacity3 for three minutes.
- Conservation and units: Verify the required total and interpret outputs.
- Capacity change: Find the trace with arrival4 and capacity5 for three minutes.
- Timing and averages: Compare late arrivals0,0,12 with even arrivals4,4,4 at capacity3.
- Boundary case: Explain a zero-length run starting with2 and a zero-capacity interval.
- Evaluation and improvement: Give two limitations and distinguish verification from validation.
Worked checks and assessment guidance
- Rows before/available/served/after are2/6/3/3,3/7/3/4 and4/8/3/5. End counts3,4,5 follow the declared arrival-first convention;initial2 is used only at the start.
- Initial2 plus total arrivals12 equals served9 plus final5. Counts are people,not minutes. peak_end5 samples initial/end states;transient availability reaches8. mean_end is4 people from the three ending samples,not an individual mean wait.
- Starting2 gives available6,5,4;actual service5,5,4;ending1,0,0. Total14 are served and final0. Capacity is an upper bound,so the final unused unit cannot be used on a nonexistent person.
- Both total12 arrivals. Late ends0,0,9 with served2,0,3,so final9 versus even final5. Early idle service cannot be stored. Late sampled mean_end3 does not establish shorter individual waits or better service.
- Empty schedules run no intervals:final2,arrivals0,served0,peak_end2,mean_end None. With initial2,arrival4,capacity0 for one interval:available6,served0,after6. Neither case requires negative counts or invented observations.
- Batch arrivals and aggregate state omit within-minute timing and individual histories. A hand trace verifies implementation for its case;approved independent aggregate observations can inform fitness for purpose. Add variation or individual state only when the purpose and evidence justify it;do not claim a real school was measured here.
Learning evidence
Keep the specification,required trace,source/version,actual execution output,conservation check,changed scenario,metric definitions,two limitations and a justified improvement/validation plan. Clearly separate invented parameters,observations and computed outputs. Explain why no individual waiting-time conclusion follows from an aggregate count alone.
OER and Wikipedia
Ricki G. Ingalls, Introduction to Simulation, Winter Simulation Conference2008; background on purpose,state and evaluation,not copied example data or code. Wilensky,U.1997,NetLogo Traffic Basic model,Northwestern University; separate optional model with its own assumptions. IITSEC/NTSA: Modeling & Simulation101,2009; original historical publisher video,not current capability certification. Primary sources reviewed14November2026. This course’s queue specification,program,schedules,traces,questions and feedback are original.
Python Code.jpg, Weal2019, CC0. Unchanged original; caption and learning activities are original.
Corey Schafer: Python Tutorial for Beginners 8: Functions; optional original publisher programming support,not a partnership or freely relicensed video.
Linked learning areas
aiMOOC Projects
Schulfach+


aiMOOCs


aiMOOC Projekte


MOOCwiki · Deutsch
Nach dem Lernen ist vor dem Lernen
Entdecke direkt den nächsten Lernkurs. Weitere Inhalte erscheinen, wenn Du weiter nach unten scrollst.
Zur MOOCwiki-HauptseiteMediathek
Mediathek wird aus dem Wiki geladen ...
Keine passenden Inhalte gefunden. Bitte ändere Suche oder Filter.
NEWSLernweltNOAH fragen