Unit-4

Cards (38)

  • Abstraction
    Making a problem simpler by leaving out details
  • Abstraction
    • Leave out details that are not needed for the purpose
    • Keep details that are needed for the purpose
  • Abstraction turns a big and complicated system into a few key facts
  • Surface area

    Width multiplied by length
  • Volume of water

    Surface area times the depth
  • Values used in the model
    • Pond width
    • Pond length
    • Pond depth
    • Surface area
    • Volume of water
  • Algorithm
    A plan to solve a problem that sets out the steps in order
  • An algorithm should tell you the inputs, the processes that turn inputs into outputs, and the outputs
  • Python program
    1. Input values (width, length, depth)
    2. Calculate surface area
    3. Calculate volume
    4. Calculate number of fish
  • Evaporation
    • The sun shines on the pond and some of the water turns into water vapour, causing the amount of water in the pond to go down
  • Rainfall
    • Can increase the amount of water in the pond
  • Both rainfall and evaporation are affected by the surface area of the pond
  • The villagers will have to pipe more water into the ponds to prevent the water level from going down too far and the fish from dying
  • The goal is to make a model of evaporation and rainfall each month to help the villagers keep the ponds full of water and prevent the fish from dying
  • Evaporation means the sun shines on the pond and some of the water turns into water vapour. The amount of water in the pond goes down.
  • Rainfall might increase the amount of water in the pond.
  • The water cycle
    1. Evaporation
    2. Condensation
    3. Collection
  • The villagers need to know how these factors will affect their ponds. It is particularly serious if the weather is hot and there is not much rain. The water level will go down. If the water level goes down too far, the fish might die.
  • To prevent this, the villagers will have to pipe more water into the ponds.
  • Evaporation lowers the level of the pond by a few millimetres every day. In this village the evaporation rate is 75 mm a month ('mm' means millimetres).
  • There are 1000 millimetres in a metre. To convert evaporation to metres you will have to divide by 1000.
  • Calculating water loss due to evaporation
    1. Calculate surface area in square metres
    2. Multiply by evaporation rate in metres
  • Algorithm

    Sets out the inputs, outputs and processes for calculating evaporation
  • Rainfall is also shown as millimetres per month. You must multiply the rainfall by the surface area. Then divide by 1000 to turn it into cubic metres.
  • Calculating volume increase due to rainfall
    1. Calculate surface area
    2. Multiply by rainfall in millimetres
    3. Divide by 1000 to get cubic metres
  • Calculating total change in pond volume

    1. Calculate rain
    2. Calculate evaporation
    3. Subtract evaporation from rain
  • Multiply seepage rate by surface area and divide by 1000. Add this value to the calculation of the change in the volume of water.
  • Add these commands to the end of the program: volume = volume + change, print("The new volume is", volume). These commands work out the new volume, by adding all the changes. Then the program prints out the new volume.
  • To repeat part of a program you will use a loop. There are two types of loop in Python. A for loop counts up to a set value. A while loop uses a conditional test.
  • Volume of water
    The amount of water in the pond
  • Storing volume of water
    1. Add volume at end of each month to list
    2. Traverse list and print each stored value
  • Change print command
    Produce more user-friendly output: "The volume of the pond is 250 cubic metres"
  • For loop
    Best choice for this program
  • Assumption about water flow
    Between the pond and the river
  • Minimum volume
    Smallest possible value without overcrowding the fish
  • Calculating minimum volume
    1. Input number of fish
    2. Minimum volume = number of fish / 2
  • Volume of water falls below minimum
    Display warning message
  • Adapting the program
    1. Add commands to show how much extra water is needed to bring volume up to minimum
    2. Input the amount of extra water added from the reservoir