联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2018-04-22 02:42

EGR 102: Introduction to Engineering Modeling
(Spring 2018)
EGR 102 Term Project – Flint Water Crisis
Background – The Flint water crisis is a real-world example of the challenges to engineering
modeling. In 2011, Flint, a city in the lower peninsula of Michigan, was facing bankruptcy, and
the Michigan constitution allowed the Governor to appoint an unelected emergency manager
with near-total control over the city’s finances. Flint was in the process of joining a new
countywide water treatment system, but this system was not yet operational. In an effort to save
money, the emergency manager made the decision in April 2014 to stop buying drinking water
from Detroit, which gets its water from Lake Huron, and start to use the local Flint River water
supply as a stopgap measure. While this decision would save roughly $21 million dollars, the
Flint River water is significantly more corrosive than the water in Lake Huron. This fact,
combined with inadequate treatment of the river water, led to severe damage to Flint’s pipes and
the introduction of dangerous elements, such as lead, into Flint’s drinking water.
Lead, copper, and iron, if present in high enough concentrations, are dangerous to humans,
especially to growing young children, with developing brains. Long-term exposure to lead can
lead to irreversible damage to both children’s brains and their nervous systems. Consequences
such as lower IQ and impulse control can lead to lifelong challenges. The EPA has a strict limit
on lead of 15 ppb (parts per billion or ?g/L). The following chart shows some of the effects
associated with lead:
Chart 1 showing the impact of lead Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
In addition to inadequate treatment of the Flint River water, the slow response by the State of
Michigan in testing the water exacerbated the situation. Despite almost immediate reports from
the citizens of Flint that something was wrong with the water (foul odors, discoloration), the
state did not quickly move to switch the water supply back to the safer Lake Huron supply, or to
even test the water for safety. Months passed, and it was not until researchers from Virginia
Tech went to Flint, tested the water, and discovered that over 40% of the homes had elevated
lead, that the emergency manager switched the water back to Lake Huron. Unfortunately,
damage had been done to the pipes, and harmful elements continue to seep into the water passing
through the damaged pipes. The costs due to health consequences of the contaminated water
have been estimated to be in the 100s of millions of dollars 
The chemistry and engineering of this problem is complex, but the corrosive water damages the
pipes taking water into the homes of the people of Flint. As noted above, even after the water
was switched back to Lake Huron, harmful elements continued to flow into the drinking water
from the damaged pipes. The following picture gives a sense of the damage that can be done by
the change in water supply:
Figure 1- Untreated Flint water shows stronger corrosive effect compared with Detroit water (image courtesy of MSU’s
Department of Computational Mathematics, Science, and Engineering CMSE 201 Spring 2017)
This project deals with the real-world data taken by Flint’s citizen scientist in collaboration with
academic scientists from Virginia Tech. As such, this project raises real world concerns that can
be challenging to deal with, as people’s lives are impacted. It is natural to feel powerful
emotions in light of these disturbed problems. It is also a clear demonstration of the important
role that engineering can play in the world. The entire educational team of EGR 102, professor
and teaching assistances alike, are happy to discuss these issues as you work through the project.
Additional data is available from the Flint Water Study, The Detroit 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
Free Press ,
and Vox 
Submission Guidelines
? All MATLAB files must contain your team member’s names, and section as
comments
? All MATLAB files must contain appropriate comments and units
? All MATLAB plots must be properly annotated, with legends, axis labels, titles,
etc. where appropriate
? All deliverables are to be submitted by one team member to the D2L dropbox as a
single submission submitted by one team member to theD2L dropbox as a single
submission
? All of your MATLAB code must be executable via a single parent script named
SS18_Project_TeamNameParentScript.m
? Your final report must be submitted electronically via D2L with the name
SS18_Project_TeamNameReport. All team member names, team name, and
section should be a header in the final report document.
? All scripts and functions, your parent script, and your final report are due at
the START of lab on 4-23, if you have M/W lab, or 4-24, if you have Tu/Th,
lab. Late work will not be accepted.
Task 1 – Data import and cleaning
The Excel data file “EGR 102 Flint Lead Kits ICP Data” is the data collected by the Flint Water
Study team from Virginia Tech . The Excel file consists of three
tabs/sheets of data. The first sheet consists of water data collected in August 2015. The second
sheet consists of water data collected in July 2016. The third sheet consists of water data
collected in March 2016. Each sheet provides data where the columns show the measurement of
a given element (note the units can change depending on the element). The rows are for a given
households water sample, designated by the sample ID. Additionally, each sheet has three sets of
data, separated by yellow highlighter for three different samples of data. These data are
designated by B1, B2, and B3 for “Bottle 1,” “Bottle 2,” and “Bottle 3.” Each of these bottles
contains samples of water taken from taps in a given household under different conditions. Here
are the water draw conditions:
B1=first draw sample after at least 6 hours of stagnation
B2=1-min flush sample collected after flushing the tap for 45 seconds
B3=3-min flush sample collected after flushing the same tap for another 2 minutes
In the data set, the minimum detection limit is 1 μg/L (also known as ppb for parts per billion). 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
The designation “BD” in the Excel data file means that the element in question is below this
minimum detection limit.
Here is a screen capture of the data file (might need to zoom to see details):
Figure 2- Screen capture of Flint water data set
In this task, first import the full data set from the Excel file into MATLAB using the xlsread
command. Note that different syntaxes for xlsread allow you to pull in different sheets or from
specific cell ranges from an Excel file, (see MATLAB Search Documentation for the various
syntaxes). Once you have imported this data, save the file as TeamNameVars.mat format for
further use. Second, use programming and arrays to manipulate the data so that for each date,
you have an array where the first column is Sample ID, the second column is lead (Pb) from B1,
the third column is copper (Cu) from B1, the fourth column is iron (Fe) from B1, the fifth
column is lead (Pb) from B2, the sixth column is copper (Cu) from B2, the seventh column is
iron (Fe) from B2, the eighth column is lead (Pb) from B3, the ninth column is copper (Cu) from
B3, and the tenth column is iron (Fe) from B3. In summary, for each date, you will now have an
array with the following columns:
SampleID B1-Pb B1-Cu B1-Fe B2-Pb B2-Cu B2-Fe B3-Pb B3-Cu B3-Fe
It is important to realize that not every household provided data for each date.
Deliverables – Create a script to perform the following:
? Import the raw data file.
? Split the raw data into 3 separate arrays, 1 array for each date. The columns in the array
should be in the following order: Sample ID, B1 lead, B1 copper, B1 iron, B2 lead, B2 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
copper, B2 iron, B3 lead, B3 copper, B3 iron. Name these variables DayXdata (where X
is 1, 2, or 3).
Name your script TeamNameTask1.m. Submit the script for the data manipulation. Save your
.mat file to the D2L dropbox for subsequent analysis.
Task 2 – Understanding the data, and the impact of flushing
As noted above, each sample bottle (B1, B2, and B3) contains water drawn after running the tap
for different lengths of time. While the water is stagnant, elements such as Pb, Cu, and Fe can
leak from the pipes into the water sitting in the pipes. Running the tap might flush these
elements away to a safer concentration level. The purpose of this task is to see how flushing
affects the concentration of each element.
Take the data from your arrays in Task 1 to create separate histograms showing the distribution
of each element (Pb, Cu, and Fe) for each bottle on each day (8-15, 3-16, and 7-16). You should
set up a 3x3 subplot of histograms for each element (so a single subplot will have 9 histograms
for each bottle/day combination for a single element). Have each row in your subplot correspond
to a separate day. To create a histogram you first need to “bin” the data. This involves taking a
vector, splitting it into evenly spaced intervals, and counting the number of values within each
interval. Write a MATLAB function to bin the data, then write a script to create the histograms.
Deliverables –
Function: Create a function that takes a vector of concentration data and sorts it into 10 discrete
bins. Use the minimum and maximum concentration as the lower and upper boundaries for your
bins. Sort your data such that for any given bin, values within that bin are greater than or equal
to the lowest bin edge but are less than the upper bin edge. For example, if bin edges were 5 and
10 then a value meeting the following condition would be counted: 5< value <10. Your function
should have the following format?
Name your function: binfun
? 2 output variables:
o binEdges- the boundaries for the different bins (this should have 11 values)
o counts- vector of values containing the number of values falling into each bin
(this should have 10 values, each value the count for a separate bin).
? 1 input:
o dataVec- a vector of concentration data representing the concentration of a single
element, on a single day, from a single bottle.
Script: Create a script that performs the following
? Use your binning function to bin each element in each bottle on each day.
? Take your binned data and use the histogram function in MATLAB to create. histograms
for each of the 9 combinations of bottles (B1, B2, B3) and days (8-15, 3-16, 7-16) for
each element. Format your histograms such that you have a 3x3 subplot for each element.
? Name your script TeamNameTask2.m. 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
Submit both your function and script to D2L. For your report: include the plots and create a table
that contains the maximum and minimum concentrations for each day/element/bottle
combination. Include a brief discussion of the role flushing (i.e. the difference between B1, B2,
and B3) on concentration of the various elements and any differences between the dates in your
final report. Also comment on both differences in the peaks and tails of the histograms. What
impact does flushing have on the variability of the data?
Task 3 – Model the long-time behavior of the concentration
In order to predict how the concentration of each element will change over time, we can use
regression on the collected data. To do this, we can plot the average concentration of each
element and bottle on each date (8-15, 3-16, 7-16). More specifically we will look at how the
concentration of a single element has changed over time, drawing conclusions for each bottle.
Use the MATLAB datetime function to convert the dates into a usable MATLAB format,
assuming that the sample draw occurred on the first day of the months in question. Fit this data
using linear regression. This will result in equations for B1, B2, and B3 behavior vs time for
each element.
Deliverables –
Script: Create a script to perform the following:
? Calculate the average and standard deviation of each element/bottle/date combination.
? Assume that the drawing of samples occurred on the first of the specified months, use
MATLAB’s datetime function to make a vector that holds the values of the draw dates
(8-15, 3-16, and 7-16).
? Plot the average concentration vs. date for each element. Overlay the B1, B2, and B3
averages on a single plot (make sure to somehow distinguish between the 3 different
bottles with your line formatting). At the end you should have 3 plots (1 for each
element).
? Fit each data set via linear regression such that you have equations for B1, B2, and B3
concentration vs. time for each element and calculate the R2
value of each regression. It
may be helpful to make a function that calculates R
2
for any given set of data.
Name your file TeamNameTask3.m and submit your file to the D2L dropbox. In your report,
provide plots with the data, the regression equation, and the R2
values of the fits. Comment on
the trends shown by the data and on the quality of the fits.
Task 4 – Model the impact of filtering
One method of reducing the contamination in Flint’s drinking water supply would be to use
filters to remove the toxic elements before the water is used at a household. However, there is an
additional cost to providing filters which must be considered. In order to determine the cost, we 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
must first determine how long a given filter will last.
At the end of task 3, you ended up with a model for the concentration (in ppb) as a function of
time for each element from your regression models. First, note that concentration is in units of
parts per billion (ppb), which is equivalent to micro-grams/L and note that your regression model
in task 3 is based on time in units of days. Assuming the average household faucet runs for 8
minutes/day at a flow rate of 8.3 liters per minute (The 8 minutes/day for a given kitchen faucet
is an estimate from the Department of Energy. The flow rate is a federally mandated flow
maximum. See, for example,  Using this data, convert
your regression models from concentration of a given element to mass of a given element as a
function of time. Assuming that a filter can hold 40 milligrams of an element before being
changed, write a MATLAB script to estimate how many days the average filter can last without
being changed. Calculate this duration for each of the 3 elements.
Deliverable –
Script: Create a script that does the following
? Take your regression equations and convert them to mass of a given element as a
function of time.
? Calculate for each element how long a filter would last without being changed.
Name your script TeamNameTask4.m and submit to D2L. In your report, develop a table giving
the number of days between filter changes for each element, and provide a write up in the final
report demonstrating the conversion of your task 3 model (concentration vs time) to this task’s
mass vs time model.
Task 5 – Geographical variations in water contamination
Up to this point, we have not investigated the geographical variability of the contamination
levels in Flint. Flint is divided into wards, and while individual households may differ, the
homes in each ward tend to have similar pipes. This results in local differences in the severity of
the water contamination.
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
Figure 3- Ward map for Flint Ward Map
For this task, you will analyze how the contamination varies as a function of ward. A list of
Sample IDs and the corresponding ward has been supplied in a data file named EGR 102
SampleWard ID.xlsx to aid your analysis. For this task, we will examine the concentration
distribution of each element over the different wards ONLY FOR B1.
Deliverables –
Script: Create a script that does the following.
? Sorts the B1 data for an individual element into separate vectors for the different wards.
? Takes the concentration data for each element in each ward and uses your function from
task 2 to create bins.
? Creates histograms for the concentration distribution of each element in each ward. For a
given ward, create a 1x3 subplot that contains the histogram for all 3 elements (thus you 
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
should have 1 plot for each ward)
Name your script TeamNameTask5.m and submit to D2L. In your report, provide a write up on
the variation of concentration between wards, using plots or tables to support your arguments.
Finally, based on information from the various tasks showing the impact of flushing, the longterm
trends of the pollution, the potential role of filters and how long they last, and the
geographical variation of contamination, develop an action plan for each ward assuming that you
only have enough filters for households in 3 wards. Your action plan should minimize the health
risks for Flint citizens considering the concentration limits of each element, the limit of number
of filters, etc.
Additionally, make an estimate of the costs of the filters if provided to all the wards. There are
roughly 28,000 homes in Flint according to . Assuming a point of use
water filter costs around $30 per unit, which is roughly the retail cost of a PUR water filter, what
is the estimated yearly cost of filtering the water? Using the principles of cost engineering and
time value of money calculate the NPV of using filters to provide drinkable water to Flint.
Assume that the filters were put into place on January 1st 2016, that the water needs to be filtered
until January 1st 2020, and inflation is 3%. Compare the NPV of filtering with the estimated
$21M the City was supposed to have saved via switching water in August 2014?
Task 6 - final report
For this task, imagine yourself as an engineer working for the City of Flint, tasked with
understanding the crisis, developing models on the impact of flushing, the long-time evolution of
the pollution, the potential role of filtering, and spatial variation across the wards of Flint. While
each task has specific information to be included, the final report should integrate the individual
tasks into a cohesive whole.
The final report should be professional in nature, with Times New Roman 12-point font. The
report should be submitted to D2L in pdf format, and should have a header on each page with all
team members’ names, team name, and the section number. The final report should be
structured as follows:
1. Cover page: Include a descriptive project title, submission date, section number, team
name, and list of the team members.
2. Executive summary: A summary of the entire report including brief introduction
establishing the motivation and importance of the project, critical results from each of the
tasks, and project conclusions. This should not be longer than 2 pages.
3. Introduction: Describe the Flint water crisis, the source of the challenge, and the
motivation for this report. Incorporate the various task headings to describe the various
models that this report has developed.
4. Methods: For each task, describe the logic, important variables, and equations used to
develop the model in question. Include a written explanation of the main components of
MATLAB code. Copied-and-pasted code is not a sufficient explanation of your process.
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
5. Analysis: Discuss the results of your code. Include the various write-ups requested by
each task.
6. Action Plan: As requested in Task 5, provide an action plan for each ward on how to best
reduce the impact of harmful elements, given the tools of flushing, filtering, long term
behavior of the crisis, and spatial intensity. This portion of the report is designed to
encourage creativity and to force you to grapple with the real-world challenges associated
with finite resources. Note that you only have sufficient filters for 3 wards, and that the
EPA threshold for health is 15 ppb.
7. Conclusion: Provide a brief summary of the main points of the discussion and your main
results. This should be no longer than a few paragraphs. Include any recommendation
for future models that would further develop and defend your action plan.
8. References: Include any references you used to write your report. Use IEEE format
9. Appendix: Include pertinent MATLAB code and any plots that you make reference to
but aren’t important enough to include in the main body.
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
Grading Rubric (150 total points)
Coding of Tasks 1 – 5 (each worth 10 points total)
Criteria Possible points
Code correctly comments (Name/section,
variables, etc.)
2
Figures/Plots correctly annotated 2
Clear understanding of MATLAB code to execute
task is demonstrated
4
MATLAB code gives correct answers 2
Total 10
Task 6 – Report (100 points)
Criteria Possible Points
Cover Page
Names, course code, due date 2
Descriptive title 2
Executive Summary
Less than 2 full pages 1
Summarizes project 2
Describes key findings and conclusions 3
Introduction
Background of Flint H2O Crisis 2
Summary of information in data sets 2
Description of project 3
Methods
Describe process for each of the task (5 each) 25
References to code in the appendix by number of name 4
Analysis
Detailed explanation of results of each task (5 each) 25
Proper use of figures to describe results 4
Additional content answers question in task write-up 2
Action plan
Identify key issues 2
Identify important tradeoffs 2
Michigan State University
College of Engineering
EGR 102: Introduction to Engineering Modeling
(Spring 2018)
Summary of main responses 2
Conclusion
Less than 1 full page 1
Summary of results 4
Recommendations 2
Appendices - are they referred to in the main text 2
References - do they exist 4
Formatting, professionalism 4
Total 100
Completion Strategy
The tasks are designed to build on each other, and provide some opportunity for code reuse.
However, not all tasks are equally challenging. See below for a difficulty rating (1 being
easiest/least time consuming, 5 being hardest/most time consuming) for each of the tasks as well
as a suggested deadline by which the tasks should be completed:
Task Difficulty Rating Suggested completion on/before:
1 1 April 9/10
2 5 April 11/12
3 2 April 11/12
4 3 April 16/17
5 4 April 18/19
It is important that you do not wait until the last minute – the final report will be time consuming,
and it is important you get work through the programming tasks (Tasks 1, 2, 5) quickly. Tasks 3
and 4, while they are tied together, are somewhat easier tasks, involving mathematical
manipulation and application of existing MATLAB functions (plotting, regression). It is
suggested that you write up material for each task as you finish the tasks while the information is
fresh, thereby allowing the final report to be assembled from the write-up of each task. Do not
have 1 or 2 teammates code and the other 1 or 2 write the report. In order to create an
acceptable report the code must be understood so it is not recommended to have someone who
doesn’t write any code write the report. Instead, delegate different tasks to one/two teammates.
Those teammates should complete the code for the delegated task and write the subsequent
analysis in the report.

版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp