Assignment3&4_ENGR103 (1)
pdf
keyboard_arrow_up
School
Oregon State University, Corvallis *
*We aren’t endorsed by this school
Course
103
Subject
Industrial Engineering
Date
May 14, 2024
Type
Pages
6
Uploaded by CoachLightning14257
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 Assignment #3&4 –
HW3 (Part 1) Due Thursday, April 25th, 2024, at 11:59 pm HW4 (Part 2) Due Thursday, May 2nd, 2024, at 11:59 pm Assignment Overview and Outcomes The focus of this homework is on how to solve simple problems using programming language asking for user input, loading a data set, creating arrays and lists, and using loops to preform your computations on the dataset. At the end of this project, you will: •
Develop a program to read data from user input and produce data to the standard output. •
Develop a program to read in a dataset, translate a given mathematical expression to syntactically correct programming statements, and loop over the dataset to perform the mathematical operations. •
Write a program that conforms to a programming style specified by the instructor. Be sure to properly document the program. Consult the class Programming Style Guidelines document (provided by the instructor) for style expectations. You can either use a .md block or the ### block to document the attributes of your program. A well-written program is easier to debug, easier to maintain over time, and easier to extend as new requirements arise. Sustainability Motivation The United Nations (UN) has set forth 17 goals for sustainable development
. Goal 7 is designed to “Ensure access to affordable, reliable, sustainable and modern energy for all”. Access to energy resources is necessary for quality of life, including jobs, agriculture, and climate-related issues. Energy resources includes electricity as well as access to clean, renewable fuels and the technologies for harnessing and distributing energy. There are a number of renewable, clean energy sources available. In this project, we will consider hydro power as a renewable energy source
. Hydropower Technology Background Hydropower, otherwise known as hydroelectric power, offers a number of advantages to the communities that they serve. Hydropower and pumped storage continue to play a crucial role in our fight against climate change by providing essential power, storage, and flexibility services. Hydropower is a renewable source of energy. The energy generated through hydropower relies on the water cycle, which is driven by the sun, making it renewable. Hydropower is fueled by water, making it a clean source of energy. Hydroelectric power is a domestic source of energy, allowing each state to produce its own energy without being reliant on international fuel sources. Hydropower provides benefits beyond electricity generation by providing flood control, irrigation support, and clean drinking water. However, it is important to note that building dams has its tradeoffs –
it does cut off habitat access and sediment supply through the river system which have implications of coastal erosion and consequences to fish population dynamics. https://www.energy.gov/eere/water/benefits-hydropower Watch this short video about hydropower showing both the benefits and the drawbacks (
link
). Calculate the Energy consumed from hydroelectric power and how it has changed through time around the world:
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 Program to Write and Expected output:
Your program will compute as test cases (but your program should be general, i.e. handle any year or any power type): 1.
the total increase in world power generation from year 2000 to 2021. 2.
the fraction of total world energy produced from hydroelectric power in any given year, 3.
the change in hydroelectric between two years (2000 and 2021). 4.
the fraction of total world energy produced from two other power sources of your choice (e.g. solar, wind, bio., nuclear, coal, gas) in the two years, and the change between any two years. You will be given a dataset that has the following for the world from 2000 to 2021, see canvas energy_use_terrawatthours.csv World Year Energy source notes: Clean* vs Fossil** Broken down by energy source: *Clean is composed of total sum of Bioenergy, Hydro, Nuclear, Other Renewable, Solar, Wind **Fossil is composed of total sum of Coal, Gas, Other Fossil Total World Energy = Clean + Fossil Generation in terawatt-hours Instructions: To perform your computation, you will need to think about how to break the dataset down into manageable pieces and what types of things you will need to help the computer to identify in order to perform your computation. •
You will need to read
the dataset into Python. •
You will need to perform your computation of hydro-power and another power type by asking for the User of your program for input
from a list
of power type options they can choose from. •
You will be using
if
statements - if statements help you to identify one string from another. •
You will be using a for
loop - a for loop will help you to move through the dataset line-by-line and allocate the data into an array
. •
You will print
out a statement to the user telling them that total world power consumption in 2000 was ___ terawatt-hours and in 2021 the consumption has increased to ___ terawatt-hours. That means world power generation has increased by ___% over the past 20 years. •
You will print
a statement out to the user telling them that in year 2000 ___% of world energy came from hydropower (or other depending on user input) and in 2021 ___% of world energy came from hydropower (or other depending on user input). •
Your program should be designed to handle computations for any combination of years. This means that you should not write any of the numbers directly into your print statements (i.e., do not hardcode any numbers in your program output), instead print out the variable where the number is stored. •
***Your program should define two functions and call the functions that you write to perform their computations
. o
You should have a function that finds and returns the power for a given year for any type. You should then call this function to find the power for a given year of any type. o
You should have a function that finds and returns the total world power for any given year. You should call this function and use it as needed. Recall, world power = clean + fossil. o
You should have a function that computes the fraction of any specific energy source is of the total world power for any given year. So, your function should have inputs: energy type, year, and the energy_use dataset.
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 Reminders: How to define a function: (
def is a keyword that defines the function) def function_name(input, input, input, …):
code …
…
…
return output, output, …
How to define a for loop: (
for and in are keywords, x is the index, y is the array, range and len are functions
) for x in range
(
len
(y)): stuff in loop How to define an if statement: (==, >=, <=, >, <, etc.) if X == Y: then will do something
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 HW3 (30 pts): First, you will begin by going through Polya’s problem
-solving steps. Use the Polya template provided to assist with this step. Turn the HW2A Part 1 into Canvas with the following questions answered. Understanding the Problem. (10 pts) •
What are the functional requirements of the program, i.e. what does it need to do? •
What assumptions are you making? •
What are the inputs, outputs, etc.? Devise a Plan. (20 pts) •
What are the decisions that need to be made in this program? •
What are the sequence of steps you need to complete? Expand the list provided above as much as possible. •
How are you going to calculate the power use due % and the total power used by the world? •
What happens if the user gives you a statement that is not in your list? How are you going to handle bad input? •
Based on your answers, provide an algorithm as pseudocode or provide a flowchart of the specific steps that are needed to create this program, including error checking. Be very explicit! •
Label your algorithm or flowchart with relevant terms from the ENGR103_Concept_Definitions document on canvas. •
What do you expect from your results? •
What other errors do you anticipate?
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 HW4 (70 pts): Write a program to obtain user input and perform the computations using ALL of the bolded commands in the description above. Then provide a brief perspective about how world power generation has changed over the past 20 years from your perspective, write this into a markdown block of your notebook. What source of power are we now using more of? What source are we now using less of? Is this sustainable? Example case to test your program: Test case Program Output World power change between 2000 and 2021 Hydropower change between 2000 and 2021 The total world power generation in 2000 was 14978 terawatt-hours. The total world power generation in 2021 was 27549 terawatt-hours. Between years 2000 and 2021 the world power generation increased by 83.0 %. In year 2000 , 2625.18 twh came from Hydro accounting for 17.0 % of world power. In year 2021 , 4205.31 twh came from Hydro accounting for 15.0 % of world power. Between years 2000 and 2021 the Hydro power generation changed by 60.0 %. Remember: You only need to perform your computations between years 2000 and 2021. You do not need to do a computation for each year in the dataset (you can if you want to, but it is not required!) Turn the HW4 onto Canvas with the following: Your .ipynb or .py file and a .pdf of your code and the output from your program for the hydroelectric test case and the two other cases you try as well as your perspective about world power generation change over the past 20 years. Follow the format of the example output from the “Example case to test your program” section for each power source that you try.
Your .ipynb or .py file
should have proper headings/formatting and commenting! In your .pdf you should have a table that looks like this: Case Program Output World power change between 2000 and 2021 Hydropower change between 2000 and 2021 The total world power generation in 2000 is 14978 terawatt-hours The total world power generation in 2021 is 27549 terawatt-hours between years 2000 and 2021 the world power generation increased by 83 %
In year 2000 2625 twh came from Hydro accounting for 0.17526449771971486 % In year 2021 4205 twh came from Hydro accounting for 0.15264831658197517 % between years 2000 and 2021 the world power generation increased by 60.1913011679
Other energy source In year 2000 2505 twh came from Nuclear accounting for 0.16730302789552148 %
World power / Hydropower Consumption Calculation ENGR 103 Spring 2024 In year 2021 2735 twh came from Nuclear accounting for 0.09929576416720601 % between years 2000 and 2021 the world power generation increased by 9.161069942097352
Other energy source In year 2000 1 twh came from Solar accounting for 7.21038776530722e-05 % In year 2021 1023 twh came from Solar accounting for 0.037141806547676307 % between years 2000 and 2021 the world power generation increased by 94642.59259259258 %
Your perspective about world power generation change over the past 20 years. What source of power are we now using more of? What source are we now using less of? Is this sustainable? In my perspective the world power generation change in the past 20 years is interesting the source of power mostly used is wind. And we are using less of other fossil fuels. I think it is more sustainable because wind is a better, safer and more beneficial reusable resource. Points: Commands (read, input, list, array, if, for, print) you use correctly are worth 6 points each. →
42 points Two functions that you have written and are called properly (6 pts each) →
12 points Properly using mathematical operations →
5 points Properly commenting your code →
5 points Your thoughtful analysis about how power generation has changed over the past 20 years →
6 points
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help