Grade by Grade
D. Topics in Computer Science · Topics in Computer Science: Sustainability, Emerging Research and Careers

Computers That Save Resources: Modelling, Simulation and Managing Nature

D1.3About 70 minutes
Learning goals
  • I can describe ways computers reduce the use of physical resources, including computer modelling.
  • I can explain how computers help manage natural resources such as forests, fish, water and energy.
  • I can run and change a simple simulation in Python and interpret its results.
  • I can explain the limits of a model and why its assumptions matter.

Words to know

model
A simplified representation of a real system, often as equations or a program, used to understand or predict it.
simulation
Running a model over time or under different conditions to see what would happen.
virtual prototype
A computer model of a product that can be tested before anything physical is built.
assumption
Something a model takes as true to keep it simple, such as a constant growth rate.
sensor
A device that measures something in the real world (temperature, moisture, light) and sends the data to a computer.
remote sensing
Collecting information about Earth from a distance, for example with satellites, aircraft or drones.
smart grid
An electricity network that uses computers and sensors to match supply and demand efficiently.

Computers can be part of the solution

The first lessons of this unit focused on harm. Now flip the question: how can computers help us use fewer resources and protect the environment? The curriculum gives two big examples: computer modelling to reduce the use of physical resources, and the management of natural resources.

1. Modelling instead of building

Before computers, the main way to test a design was to build it and see if it worked. Car makers crashed real cars. Aircraft designers built model wings for wind tunnels. Every failed test used up materials and energy.

Today engineers build a virtual prototype: a computer model of the car, wing, bridge or building. They run a simulation to see how it behaves and change the design on screen. Examples:

  • Crash simulations test how a car body crumples long before a real car is crashed.
  • Computational fluid dynamics simulates air or water flowing around a shape, to design more efficient vehicles, wind turbines and buildings.
  • Building energy models predict how much heating a new school will need, so designers can compare insulation and window choices before construction.

Real tests are still done, because a model is only as good as its assumptions, but far fewer prototypes are built.

Physical testing onlyComputer model firstBuild prototype(materials, energy)Test it(often destroys it)Redesignrepeat many times: many prototypes builtSimulate hundredsof designsKeep the best fewBuild and test onereal prototypefar fewer prototypes built
Testing designs in a computer model first means far fewer physical prototypes are built and destroyed, saving materials, energy and time.

2. Managing natural resources

Computers help people measure, predict and manage resources:

  • Forests: satellite and aircraft remote sensing and geographic information systems (GIS) map forest cover, track wildfires and help plan which areas to harvest and which to protect.
  • Fish and wildlife: population models estimate how much can be harvested without the population collapsing.
  • Water: sensors and models track water levels and predict floods and droughts.
  • Agriculture: precision agriculture uses GPS, soil sensors and maps so farmers put water and fertilizer only where they are needed.
  • Energy: a smart grid and smart thermostats use computers to match supply and demand, and route-planning software reduces kilometres driven by delivery trucks.
  • Climate: climate models help scientists and governments compare the effects of different choices.

Many First Nations, Métis and Inuit communities in Canada combine their own long-term knowledge of land, water and wildlife with tools such as GIS and community-run monitoring programs, so that decisions about resources reflect both.

A simulation you can run

Here is a tiny model of a fish population in a lake. Each year the fish grow (fast when there are few fish and lots of food, slower as the lake fills up) and people harvest a fixed number of tonnes. The question a resource manager asks is: what harvest limit is sustainable?

The growth formula is growth = 0.4 × stock × (1 − stock ÷ 1000). The 1000 means this lake can support at most about 1000 tonnes of fish.

def simulate(harvest, years):
stock = 500 # tonnes of fish at the start
for year in range(years):
growth = 0.4 * stock * (1 - stock / 1000)
stock = stock + growth - harvest
if stock < 0:
stock = 0
return stock
for h in [80, 100, 120]:
print("Harvest", h, "t/yr -> stock after 20 years:", round(simulate(h, 20)), "t")

A simple fish-population model. The numbers (growth rate 0.4, a lake that can support at most 1000 t) are invented for teaching. Output (one line each): Harvest 80 t/yr -> stock after 20 years: 714 t / Harvest 100 t/yr -> stock after 20 years: 500 t / Harvest 120 t/yr -> stock after 20 years: 0 t

051015200200400600800YearFish stock (tonnes)80 t/yr100 t/yr120 t/yrcollapse in year 14
Model output for three harvest limits. At 80 t a year the stock grows, at 100 t it holds steady at 500 t, and at 120 t it collapses to zero in year 14.
Worked example

Example 1: Using the model to choose a policy

A manager wants the largest yearly harvest that keeps the stock at 500 t or more for 50 years. Use the model to find it.

  1. Plan: try harvests 0, 5, 10, ..., 200 t, run the model for 50 years each time, and keep the largest harvest that ends with at least 500 t.
  2. Check by hand at 100 t: growth at 500 t = 0.4 × 500 × (1 − 0.5) = 100 t. Harvesting 100 t takes exactly the growth, so the stock stays at 500 t forever.
  3. Check by hand at 105 t: the first year the stock becomes 500 + 100 − 105 = 495 t. Growth at 495 t is about 99.99 t, less than 105, so the stock keeps falling.
  4. Run the search in Python (below). It confirms 100 t/yr.

The largest sustainable harvest in this model is 100 t per year.

def simulate(harvest, years):
stock = 500
for year in range(years):
stock = stock + 0.4 * stock * (1 - stock / 1000) - harvest
if stock < 0:
stock = 0
return stock
best = 0
for h in range(0, 201, 5):
if simulate(h, 50) >= 500:
best = h
print("Largest harvest that keeps the stock at 500 t or more:", best, "t/yr")

Running the model many times to search for the best policy. Output: Largest harvest that keeps the stock at 500 t or more: 100 t/yr

Every model has limits

This model assumes the growth rate never changes, there is no disease, no warm summers, no illegal fishing and perfect counting. Real resource managers use more detailed models, real survey data, and the knowledge of people who live on the land and water, and they leave a safety margin below the model's best answer. A model helps you think; it does not replace careful observation.

Just for fun

A scientist ran a computer model of a boiling kettle 10 000 times.

Not one drop of water was used, and the virtual kettle never once whistled at her. Modelling: great for resources, terrible for tea.

Hands-on activity

Change the model, change the future

You need: a computer with Python (or a free browser-based Python editor).

  1. Type in the first simulation program and run it. Check that you get 714, 500 and 0.
  2. Change the starting stock from 500 to 300. Run it again for the same three harvests. What changes?
  3. Add a line inside the loop that prints the year and the stock (rounded) for a harvest of 120 t. In which year does the stock first fall below 250 t?
  4. Make the growth rate a parameter. What happens to the sustainable harvest if a warm summer lowers the rate from 0.4 to 0.3?
  5. Write three sentences: what did the model teach you, and what does it leave out?

What to look for: In step 3, the stock first falls below 250 t in year 10 (about 241 t). In step 4, at rate 0.3 the steady harvest at 500 t is 0.3 × 500 × 0.5 = 75 t, so a harvest limit set for 0.4 would cause a collapse.

Your turn

1

What is a virtual prototype?

2

Give two examples of computer modelling that reduces the use of physical resources.

3

Name three natural resources that computers help manage, and one tool for each.

4

In the fish model, what does the number 1000 represent?

5

Find the growth when the stock is 200 t.

6

Why do engineers still do some real tests after simulating?

More practice: warm-up

1

What is a simulation?

2

What is remote sensing?

3

What does a smart thermostat do to save energy?

4

In the model, what happened with a harvest of 120 t a year?

5

What is an assumption in a model?

More practice: on your own

1

Calculate the stock after one year if it starts at 500 t and the harvest is 80 t.

2

Calculate the stock after one year if it starts at 800 t and the harvest is 100 t. Is the stock rising or falling?

3

Explain how precision agriculture reduces resource use.

4

A company replaces most business trips with video meetings. Name one environmental benefit and one environmental cost.

5

Name two things the fish model leaves out that could matter in a real lake.

Challenge

1

Show algebraically that, in the model, the largest harvest that can be held steady forever is 100 t a year. (Hint: a steady state means growth = harvest. Find the largest possible growth.)

2

Modify simulate so that it returns the first year in which the stock reaches 0, or −1 if it never does. What does it return for a harvest of 120 t over 20 years?

3

A government must set a fishing limit. The model says 100 t is the maximum. Recommend a limit and justify it using what you know about models.

Check your understanding

Quiz

1.

Which is an example of using computer modelling to reduce the use of physical resources?

2.

What does remote sensing do?

3.

In the fish model, growth = 0.4 × stock × (1 − stock ÷ 1000). What is the growth when the stock is 500 t?

4.

Why should a real fishing limit be set below a model's maximum sustainable harvest?

5.

Which technology helps farmers use water and fertilizer only where needed?

6.

A simulation's prediction disagrees with careful real measurements. What should the scientists do?

For parents and teachers

Big idea: Expectation D1.3 asks students to describe ways computers can reduce resource use and help the environment, such as computer modelling to reduce the use of physical resources and the management of natural resources.

How to help: Ask your teen to run the fish model for you and explain why a harvest of 120 t collapses while 100 t holds steady. Then ask the key question: "What does the model leave out?" Weather apps, flood forecasts and smart thermostats at home are everyday examples of models and sensors.

Common difficulties:

  • Treating a model's output as fact. Models depend on assumptions.
  • Order of operations in the growth formula: compute stock ÷ 1000 first, then 1 minus that, then multiply.
  • Forgetting that the simulation updates the stock each year, so each year's growth depends on the new stock.