ENEN90031: Quantitative Environmental Modelling
MATLAB Programming Assignment
DUE DATE: 25-March-2019, 10:00 AM
This assignment contributes 10% to your final subject mark.
Overview
This assignment requires you to develop a MatLab function to model an infiltration basin from 01-Jan-1990
to 31-Dec-2015 (if your catchment don’t have continuous data for this period, you can choose any other 15
year time period) and to analyse the behaviour of the system over time. Successful completion of this
assignment will assist you in the completion of later assignments within this subject.
You will need to complete a function that models the interaction between rainfall, recharge and runoff.
Then you need to analyse the results over time. You will also need to complete a script that calls your
function and analyses the outputs. The script needs to produce a series of plots. A brief write-up of your
results is required.
Task
You are required to finish a MatLab program (this is a function with inputs and outputs, not just a script) to
model an infiltration basin (look in the appendix for a conceptual diagram and other information about the
system). The overall purpose of this program is to model the water infiltrated to the underlying unconfined
aquifer and to examine how the recharge and runoff from the basin varies over time. Your program should
undertake the following tasks.
a) Model the overall system and produce appropriate plots. We have provided a partly written
MatLab function, but you will need to complete it. Before you start adding to the function, please
read the programming tips on page 2, the description of the model in Appendix 1 and the function
itself. Your first step should be to add some comments to the existing code as you decipher how it
works. Then make a plan of the key steps involved and add this as comments to the function.
b) Your function will produce one output structure. The first line of your function looks like this:
function [InfiltrationOutput]=infiltration(Rainfall,PETData,basinCharacter)
Where;
Rainfall is an nx2 matrix with col 1: date in datenum format and col 2: daily precipitation in mm/d
PETData is an nx2 matrix with col 1: date in datenum format and col 2: daily pet in mm/d
basinCharacter is a structure with different basin characteristics such as
basinArea: Basin area in m2
? maxStorageVolume: Maximum storage capacity in m3
catchmentArea: catchment area contributing runoff from to the basis (assume this is
impervious with 100% runoff) m2
RechargeMax: Maximum recharge rate from the basin in mm/d
c) The output structure has already been initialised within the provided function. It includes members
that are all vectors and are:
recharge: the rate at which water is recharged to the aquifer (m3
/d)
overflowRate: the rate at which water overflows from the basin (m3
/d)
volume: the volume of water stored in the basin at the end of each time step (m3
)
d) You should also write a script to load the data, call the modified function and to analyse the model
outputs by generating the following graphs and values:
timeseries graphs of one month of data for the three model outputs (choose a period with some
rainfall and overflow events) The first column of the PETData has dates in MatLab datenum
format.
Annual timeseries of overflow from the basin
Bar graphs showing the total number of days the basin overflows per month (Select any one year
for this)
Your graphs should have appropriate axis labels, axis scales, titles, and legends.
Your script should also check that your infiltration.m function calculations are conserving the
water balance over the simulation period (we are assuming zero losses from the system and all
the relationships are linear in nature). This is an example of one way to test whether your model
outputs make sense. Testing is important part of quality checking. You might think of other ways
of checking your model.
In your report please include a table with mean annual recharge, mean annual overflow and
mean storage volume for the simulation period.
Note: Make sure you choose the PET and Precipitation of the same time period for running your
infiltration basin model and all the inputs and outputs are in correct units.
A suggested programming process
To assist you with writing your function (or script), the following tips may be useful.
The first line must define the function name, inputs and outputs (not needed for scripts). This is
already done for you.
After you’ve written the first line, write comments explaining each sub-section of your program.
This will help you plan and structure each aspect of the program. Given some of the code is
already written, start by writing comments explaining what it does. You might also find it useful
to fix up the formatting at this time.
The comments should be clear enough so that someone else could understand the overall
purpose of your program. They should also clearly state the program's major assumptions and
limitations; the inputs required and the outputs created; and an explanation of each majorstep.
After you’ve written the comments, start writing MatLab commands for the first sub-section of
your program. Save the program, and then use the MatLab debugger check that the first subsection
is working as you expect. Repeat this process until the whole program isfinished.
The first sub-section of your program should initialise the outputs. This can be done by setting
the output variables, say “output1”, to output1=NaN(rows,1). Again this has been done for you
here, so you can learn from this example.
Calling the figure() function before a new plot creates a new figure window and stops an old plot
from being over-written. This might be useful in your script.
You should review the plotting section of help to see what graph types are available and select
those that suit your purposes.
Report/Submission
You will need to submit the following
1. Your MatLab function that models the infiltration basin and the script that produces the graphs. You
need to use comments and formatting (indenting if blocks and for loops, etc) to make your function
and script clear to read. You will need to do some formatting of the code supplied! You can indent
lines by highlighting them as a block and using the tab key (or shift-tab to reduce indent).
2. Your MatLab script that calls the function and organises and plots the data. Also make sure your
script is clear to read.
3. Write a report of up to 3 pages (plus appendices) showing the results requested above and briefly
describing them. Please note, this does not need to be a formally structured report and only the first
three pages will be marked (plus your MatLab code in appendices). Your report and MatLab files
should be submitted online via the subject LMS link for MATLAB file. Follow the instructions there.
Your script and function should be included in your report document as Appendix 1 and Appendix 2.
Please copy your code from the MatLab editor and paste it by right-clicking and selecting the option
to “Keep Source Formatting”. The MatLab code is not included in your page limit.
Your report should include:
your plots for your infiltration basin as specifiedabove;
tables as specified above; and a brief description of any additional error checking you have added to the function and the various
results you have produced.
All plots should include titles, axis labels and legends (where there are multiple series plotted). Axis
limits should be set appropriately. All figures (plots) and tables should have appropriate captions.
Assessment
Late Penalty: assignments submitted late will be penalised 10% per day or part thereof; assignments
submitted more than 5 days late will not bemarked.
Over-length reports: we will stop marking at the end of page 3 of the main body of your report.
Your assignment will be assessed as follows:
? 20% for the function structure;
10% for clear commenting and indentation;
10% for the numerical outputs from the program;
10% for handling of battery full and empty special cases;
30% for the quality of the plots produced, especially the labelling andformatting;
10% for function testing; and
10% for the quality of yourscript.
Appendix 1
Infiltration basins are impounding facilities which temporarily store surface runoff and allow it to infiltrate
into the subsurface.
In this problem the infiltration basin is considered as a leaky bucket. The leakage from the bottom of the
bucket will be going to the groundwater systems as recharge. In this case, total water (i.e., (Catchment Area
+ Basin Area ) x Rainfall - Basin Area x PET) will be available for recharge, overflow or change in volume. The
basin was assumed to be leaking at a constant rate which is independent of the total water available. The
overflow will occur only after the recharge is satisfied and the storage is full.
We can use a conservation equation as the core of the infiltration model. This conservation equation says
that the rate of change of volume in the basin is equal to the rate of inflow minus the rate of outflow.
V = Volume
t = Time
I = Total inflow
Re = Recharge
Recharge
Runoff Inflow
Max. Soil moisture
holding capacity
Ru = Runoff
For more details on infiltration basin design follow the link below
http://www.water.wa.gov.au/__data/assets/pdf_file/0017/1691/99302.pdf
Appendix 2: Downloading Climate Data
To obtain your data for your MatLab Assignment you should:
1. Go to http://www.bom.gov.au/climate/data/stations/
2. Select the Weather Station Number tab
3. Enter you station number in the Number box
4. Go to step 2
5. Select the weather element(Rainfall-total)
6. Select the reporting frequency (daily)
7. Go to step 3
8. You can download the data from the links on the right-hand side under Data availability. Your
station should be the first on the list.
The following table shows student ID numbers and station numbers – use this station for step 3.
Student ID Station ID Student ID Station ID Student ID Station ID
1057975 86071 761462 83083 1007728 84016
893750 90015 923060 81049 941470 76047
767423 82039 947512 88164 760354 85096
1006796 86038 754869 76064 1006877 88109
971039 87113 905458 88110 1006880 80023
1039422 85279 918276 84070 1066032 80091
963755 87031 1019430 86038 864506 79028
813187 85072 807198 88023 882719 88043
902586 76031 882020 86282 907975 86104
834770 89002 999937 86077 290102 86371
696273 85279 733295 82042 884827 86127
834204 80015 979055 86383 952258 89085
954875 85072 966358 86354 887294 78077
934932 82076 1002132 81123 884308 82076
925588 86351 1022348 83083 868569 86351
974872 89002 990881 84143 953648 90171
883380 86361 1033239 83024 982409 90173
1048165 86375 1050847 85283 948610 85280
1031359 83084 860336 82138 825653 84016
983244 90176 887721 90180 878825 81123
880132 83085 1035151 83084 876738 86371
899282 88110 1010244 90175 905076 90184
1021802 87168 886616 86373 854774 84142
967920 80015 241334 89085 1029294 82139
976341 86361 1006886 88162 724028 84084
961280 90184 584954 81124 977846 85296
1056911 84144 757354 86383 878562 88051
852928 88164 928538 84143 1035690 90015
876401 81125 864689 86375 901122 84142
973193 79105 1006823 77094
949946 86351 918040 86371
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。