Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

GNG 1106 Project Part 2.docx GNG1106 – Fundamentals of Engineering Computation Course Project Mechanical Engineering Emma Wharton & George Lai Date: November 28, 2022 1 Problem Identification...

1 answer below »
GNG 1106 Project Part 2.docx
GNG1106 – Fundamentals of Engineering Computation
Course Project
Mechanical Engineering
Emma Wharton & George Lai
Date: November 28, 2022
1 Problem Identification and Statement
Say a machine is pulling a block along a certain distance. This machine can both change the
amount of force it is pulling on the block and also, the angle in which the pulling arm is pulling
on the block. We want to calculate the work done on the block and so, we have to program
functions so the machine can both change its force applied and the angle of the pulling arm on
the block and so finally, we can calculate the total work done on the block when the block is
pulled for example, 5m.
First and foremost, the initial problem this question asks is the calculation of work done over a
distance which can be expressed in a simple form W = F(d) where F is the force applied and d is
the displacement. In most cases, it is not this simple as in real life, variables such as the angle
where the force applied can vary or force applied can change by a machine changing the amount
of force applied but still in the same direction. This is where integrals come into play where work
can be calculated as an integral function and thus, an integral function as a limit sum.
2 Gathering of Information and Input/Output Description
2.1 Constraints
Constraints:
- Polynomial degree cannot be greater than 5 where F(x) and θ(x) are both polynomials
- F(x) must be positive
- θ(x) must be between be 0 and π/2 (so that cos(θ(x)) is positive)
2.2 Physical Laws
Physical Laws:
- F(x) must be positive because negative force does not exist (not to be confused with force
in the opposite direction)
- θ(x) must be between 0 and π/2 because this is the interval where cos(θ(x)) is positive
efore it goes negative.
- Acceleration of the Earth’s gravity is g = 9.8m/s^2
2.3 Equations
Mathematical Equations:
- F(x) is a polynomial function where the degree can vary up to a value of 5 as inputted by
the user. F(x) equals the force applied by the machine.
F(x) = ax^n + bx^n-1……
- θ(x) is also a polynomial function where the degree can vary up to 5 as inputted by the
user. θ(x) equals the angle between the pulling arm and horizontal.
θ(x) = ax^n + bx^n-1……
- w(x) is the integral that calculates the work done over an interval(displacement of the
lock). It integrates F(x)*cos(θ(x))dx.
● w(x) also equals the limit sum that is an equal alternative to the integral and what
we will be programming
2.4 Input & Output
Input:
- The user inputs the initial and final distance, and the constants a and b.
- Degrees of both F(x) and θ(x)
- The individual inputs of both F(x) and θ(x), x itself
-
Output:
- The console will plot the work between the two values inputted by the user, and it will
display all the input values entered by the user, along with the option to save those values
to a file.
- The console will also display a numerical value in Joules for the total work done by the
selected inputs.
3 Software Design
3.1 Functions
All of these functions are planned to be implemented into this algorithm while leaving room fo
modification, clarity, addition or removal of functions later on for continual improvement.
- typedef Struct
typedef Struct
{
double a;
origin of the integral measured from b to a
double b;
final of the integral measured from b to a
double x;
input value for F(x) and THETA(x)
int DGREE_F(x);
input value for the degree of F(x)
int DGREE_THETA(x);
input value for the degree of THETA(x)
}WORK;
- Intro: This function is meant to store input values from an a
ay that was imputed by
the use
- Parameters: The parameters for this function will include 5 elements containing the 5
input values. The function must also be able to store values in a binary file so that input
value can be modified
- Return Value: Using a pointer, the value of the element will be retrieved fo
calculations
- Logic: From the user input function, the values are stored in a defined a
ay and using
pointers to link the values to the address of the element, the value can be stored into the
structure
- void main()
- Intro: This function is to define the values from the a
ay and then ultimately print out
the values calculated from the other functions.
- Parameters/Logic: To define the values that came from the a
ay, the function must call
the user-input functions for the calculations themselves from the order of F(x) and
THETA(x) all the way to the final calculations of work being done from the integral sum
and these values will return to the main function where main will print out the work done
y the machine.
- void getUserInput()
- Intro: Purpose is to obtain the user inputs
- Parameters: Must be outlined from the code that the inputs are within the constraints of
the functions so that calculations can be made as intended, such as no negative work can
e done
- Logic: The function will prompt the user to input values for the various calculations
and will also warn the user to use values that are within the constraints of the
calculations. the functions will then scan these values where they will be stored within
the a
ay
- double calculateTHETA()
- double calculateF()
- double calculateWork()
- Intro: All three of these function calculate the components and final value of the work
done by the machine
- Parameters: As the input values have already conformed to the previous restrictions
outlined by the other functions, the only parameters for these functions is that the
functions must calculated in the proper order for work to be calculated
- Logic: F(x) takes the degree of user input and x to calculate the force while THETA(x)
takes its degree and x to calculate the input for cosine so that the machine can adjust its
arm. Function Work then takes these two values and the domain from b to a to calculate
the work done from the machine as a limit sum and then finally returns the value to main.
Test Cases:
Origin (a) in
meters
Final (b) in
meters
Degree F(x) Degree
THETA(x)
(x) Work done in
joules
XXXXXXXXXX ?
XXXXXXXXXX ?
XXXXXXXXXX ?
XXXXXXXXXX ?
XXXXXXXXXX ?
*Have not found the co
ect coefficients for F(x) or THETA(x) yet so final work is still unknown

GNG1106 – Fundamentals of Engineering Computation
Class Project
Mechanical Engineering
Computing Work[footnoteRef:1] [1: This project is based on content presented in “Numerical Methods For Engineers”, Steven C. Chapra, Raymond P. Canale, 6th Edition, McGraw-Hill, New York, 2010]
Many engineering problems involve the calculation of work. The general formula is
Work = force x distance
When you were introduced to this concept in high school physics, simple applications were presented using forces that remained constant throughout the displacement. For example, if a force of 10 newtons (N) was used to pull a block a distance of 15 meters (m), the work would be calculated as 150 joules (1 joule = 1 N-m).
Although such a simple computation is useful for introducing the concept, realistic problem settings are usually more complex. For example, suppose that the force varies during the course of the displacement. In such cases, the work equation is reexpressed as
                Equation 1
where W = work (joules), x0 and xf are the initial and final positions, respectively, and F(x) a force that varies as a function of position. If F(x) is easy to integrate, equation 1 can be evaluated analytically. However, in a realistic problem setting, the force may not be expressed in such a manner. In fact, when analyzing measured data, the force might be available only in tabular form. For such cases, numerical integration is the only viable option for the evaluation.
Further complexity is introduced if the angle between the force and the direction of movement also varies as a function of position (Figure 1). The work equation can be modified further to account for this effect, as in
        Equation 2
Again, if F(x) and θ(x) are simple functions, equation 2 might be solved analytically. However, as in Figure 1, it is more likely that the functional relationship is complicated. For this situation, numerical methods provide the only alternative for determining the integral.
Figure 1 – Variable force acting on a block.
Consider that both F(x) and θ(x) are both polynomials, that is,
        Equation 3
        Equation 4
In equation 3, the coefficients must be selected such that F(x) is always positive. In equation 4, the coefficients must selected such that θ(x) varies between 0 and π/2 for the range of interest for x. As well, the maximum order is restricted to 5, that is M and N can be no larger than 5. Recall that the Trapezoidal rule applied to the definite integral is:
        Equation 5
where h =(yn – y0)/n is the step size which divides the range of y into n equal segments which varies y from y0, y1, y2, … to yn. Applying Equation 5 to Equation 2, the work, w(x), computed from an initial position x0 to x, where x > x0, can be computed using the following:
where
· y0 = x0
· yn = x
· h = (x – x0)/n
· yi = yi-1 + h for i = 1, 2, 3, …, n
· g(yi) = F(yi)cos(θ(yi))
Develop software that allows the user to study how the total work varies over a range of distance. The user will provide the following input:
· The initial distance and final distance that defines the range of displacement of the block, x0 and xf, over which the software computes work.
· The constants ai and bi for the two functions F(x) and θ(x). The degree of the polynomials (number of terms in the polynomial) can vary, that is, the number of constants given by the use determines the degree of the polynomial. The following constraints must be respected by the user:
· The degree of the polynomials can be no greater than 5, that is, no more than 6 coefficients can be given by the user.
· F(x) must always be positive in the range of interest for x.
· θ(x) must vary between 0 and π/2 in the range of interest for x.
· Consider plotting the functions of F(x) and θ(x) as feedback to the user when the user gives improper coefficients.
For the selected input, the software will plot the work w(x) for the selected range of x (x0 to xn). In addition to the plot, the software shall display on the console all input values provided by the user.
When new input values are given, the user is given the option to save them into a file; up to five sets of values can be stored. Thus, when the software starts the user can elect to use one of the five stored values or enter new values.
Hints:
· In your design, you will need to define a method to create a step size for applying the trapezoidal rule.
· In your design, select a value for varying the distance x, i.e. select the number of values of x to create a reasonable graph. Note that the increment of x for graphing is not the same as the step size for the trapezoidal rule.
· Although analytical solutions are possible for first order polynomials, as the order increases, integration becomes very difficult if not impossible. Excel provides the means to accumulate the area under the function F(x)cos(θ(x)) to obtain a reasonable estimate of the expected graph of w(x). See the provided Excel file. Note that the technique used in the Excel file is NOT the trapezoidal rule.
Copyright and Plagiarism
You may not distribute this document or any work that you produce with this document. You may use this document in developing the project deliverables for the GNG1106 Course, including cutting and pasting text from this document into your project deliverables. Sharing and distributing this document and your project deliverables is prohibited under the University of Ottawa Academic fraud policy ((1) https:
www.uottawa.ca/administration-and-governance/academic-regulation-14-other-important-information 2) https:
www.uottawa.ca/vice-president-academic/sites/www.uottawa.ca.vice-president-academic/files/academic-integrity-students-guide.pdf ).
@Copyright Gilbert A
ez@
0
()cos(())
f
x
x
WFxxdx
q
=
ò
12
0121
()
NNN
NN
Fxaxaxaxaxa
--
-
=+++++
L
12
0121
()
MMM
MM
xbxbxbxbx
q
--
-
=+++++
L
0
()
n
y
y
gydy
ò
0
1
0
1
()()2()()
2
n
n
y
in
y
i
h
gydygygygy
-
=
éù
éù
=++
êú
êú
ëû
ëû
å
ò
0
1
0
1
()()cos(())()2()()
2
n
x
in
x
i
h
wxFyydygygygy
q
-
=
éù
éù
==++
êú
êú
ëû
ëû
å
ò
0
()
f
x
x
WFxdx
=
ò

GNG1106 Fall 2017 – Project Deliverable 3
Available: Nov 27, 2022
Due: Dec 11, 2022, midnight
Instructions
This deliverable is to be done in teams of 2. The following are specific instructions for this deliverable:
1. You will need to submit your project deliverable electronically to Brightspace in a zip file that contains your project document and your C code.
1. The project document is provided in both PDF and Word file (Word, Rich Text Format). For this deliverable, complete the Code and Section 5 with the output from
Answered Same Day Dec 15, 2022

Solution

Vikas answered on Dec 15 2022
45 Votes
Outputs
TEST CASE 1:
TEST CASE 2:
TEST CASE 3:
TEST CASE 4:
TEST CASE 5:
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here