business writing assigment
May 29, 2020
Economic Environment of Business
May 29, 2020

C program

C program

In this assignment, you will be writing a C program that simul
ates the motion of a damped spring-
mass system using some simple laws of physics. The motion of a
n animated spring will be drawn
graphically in a window using the GL graphics library (a
n example is shown in Figure
1
). The
task can be broken down into a number of stages:
€ÀšÃ‚¢
Convert the second-order ODE that describes spring motion t
o a system of first-order ODEs;
€ÀšÃ‚¢
Write a C function for solving first order ODEs using the Runge
-Kutta 4 (RK4) algorithm and
check using the given Example 1;
€ÀšÃ‚¢
Extend the C function for solving second order ODEs using RK4
and check it using the given
Example 2;
€ÀšÃ‚¢
Write a C program that when given the parameters (spring cons
tant, mass, damping ratio), it
solves the ODE to give the displacement of the mass;
1
Figure 1: Screenshot of simple spring simulator with one mas
s and spring
€ÀšÃ‚¢
Draw the animation of the moving spring in an GL window wi
th technical information and
parameters.
€ÀšÃ‚¢
Assigns keys for changing the parameters (spring constant,
mass, damping ratio) within the
simulation.
€ÀšÃ‚¢
Assigns a key for €À¹Ã…pulling€â€žÂ¢ the mass to excite the system agai
n.
€ÀšÃ‚¢
Extend the system to two or more masses connected in series vi
a springs.
You will need to work in pairs on this assignment to distribut
e the workload of the programming.
You will need to register your groups on Learning@Griffith. Pl
ease fill in your name as well as your
partner€â€žÂ¢s name on this sheet by the end of week 3. This assignm
ent is designed to be completed over
most of the semester in your own time (outside of workshop and
lab time).
2 Software required
You will need to use a C compiler that has the GL libraries
installed. For Linux users, please
make sure you have the
freeglut
library installed. For windows users, you can install
Codeblocks
to
get the C compiler. For the GL, you will need to perform so
me additional steps, as listed on
Learning@Griffith.
2
3 Assessment methods
3.1 Project demonstration
The project will be assessed in the workshop session of Week 1
3. You and your partner need to present
your working program and describe the various parts of the pr
ogram to the demonstrators, who will
ask you questions as well. This forms part of the
technical defence
, which you will encounter again in
future years. Marks will be allocated on an individual basis
based on this technical defence. You will
also need to submit all your source code to Learning@Griffith f
or checking in order to receive marks
for the assignment. You are expected to write all the program
yourself.
Academic misconduct,
such as copying others€â€žÂ¢ work, will be closely monitored and not be tolerated
.
Marks will also be given for code elegance (appropriate use o
f loops, indentation, suitable function
length, etc.) as well as informative comments in the code.
3.2 Programming report
A rough structure of the programming report that is to be prod
uced is given below:
1. Introduction and description of the functionality of the
program
2. The structure and data flow of the program (as a structure ch
art)
3. Results and MATLAB plots
4. Results from testing and validation of each component/mo
dule of the software