# Python辅导 | ACS6101: Foundations of Control Systems

ACS6101: Foundations of Control Systems

Period: Weeks 1-3

Dr Viktor Fedun, v.fedun@sheffield.ac.uk, Room C9 Amy Johnson Building

Professor George Panoutsos, g.panoutsos@sheffield.ac.uk, Room B15 Amy Johnson Building

Assignment weighting

50% of module

Assignment released

Week 2

Assignment Due and Submission Instructions

End of Week 6 (Sunday 23.59, 10 Nov). You must submit the completed assignment to the relevant

ACS6101 MOLE page, via Turnitin, as a single document (Part A + Part B). You must include your

registration number at the top of every page. Your report should be word processed, using minimum

size font 11, minimum 2.5cm margins all around.

Penalties for Late Submission

Late submissions will incur the usual penalties of a 5% reduction in the mark for every working day

(or part thereof) that the assignment is late and a mark of zero for submission more than 5 working

days late. For more information see http://www.shef.ac.uk/ssid/exams/policies.

Feedback

No later than 2-3 weeks after the submission deadline. The feedback will include the overall mark,

individual component marks as well as written comments on performance on the assignment

(electronic format). You will also have the opportunity for one-to-one feedback. General feedback

on the whole class performance will also be provided via email and on MOLE. Note that final marks

may be subject to change as a result of unfair means.

Unfair Means

The assignment should be completed individually. You should not discuss the assignment with other

students and should not work together in completing the assignment. The assignment must be

wholly your own work. References must be provided to any other work that is used as part of this

assignment. Any suspicions of the use of unfair means will be investigated and may lead to

penalties. See http://www.shef.ac.uk/ssid/exams/plagiarism for more information.

Special Circumstances

If you have medical or personal circumstances which cause you to be unable to submit this

assignment on time or that may have affected your performance, please complete and submit a

special circumstances form along with documentary evidence of the circumstances. See:

http://www.shef.ac.uk/ssid/forms/special

particularly noting point 6 (Medical Circumstances affecting Examinations/Assessment).

Help

This assignment briefing, the lecture notes, and the laboratory handouts (all available on MOLE)

provide all the information that is required to complete this assignment. It is not expected that you

should need to ask further questions. Remember that you need to decide on what is the most

appropriate approach to carry out the simulations and present your results. This is also part of what

you are being assessed on and will assess your knowledge and understanding of the taught material

for ACS6101. However, if you need clarifications on the assignment then please feel free to email

the relevant lecturer.

You must complete both parts of the assignment !

Part A (25% of overall module mark – content from Week 1)

Marking Criteria: Apportioned Marks for questions are Q1: 40% Q2: 60%

In doing the assignment Part A, you should be prepared to use the MatLab help

system and the course notes, and to do some of your own research to learn about

functions or features you may need.

Your answers should consist of the code used to solve the problem and example

output where appropriate. Graphs or pictures should be saved in .png format. The

code should be headed with comments that include the title, description of the

purpose of the code and an explanation that guides the reader through the workings

of the code. Comments should also include the question number, your name and the

date the code was finished. There is no limit to code length, but the work should not

require more than 20-30 lines of code for each problem.

Put all of your code, output and plots into a report (PDF file format) which you will

submit via Turnitin, as a single document (Part A + Part B). Your codes must

also be submitted as separate .m files (MatLab scripts and function) to Dr. V.

Fedun via e-mail : v.fedun@sheffield.ac.uk.

You may discuss with other students how to approach each problem, but you must

write all your own code and all your own report. Your submission will be

checked for plagiarism using turnitin.

For each question, marks will be awarded for:

• the quality of your description;

• whether your code runs or not;

• elegance and design (show that you have thought about the best way to

solve the problem);

• simplicity and clarity (simple and clear is better, sensible variable names,

formatting, comments etc.);

• readability (description, indenting, presentation, comments etc);

• correctness (giving exactly the right answers);

• consistency.

Question 1

Write a script to do the following:

a) create the following matrices and vector y:

-2 -4.1 2 3 1 3 9 2 -1

-2 1.1 2 3.3 5 8 4 3 y = 2

4.1 2 5 8.1 10 16 8 6 -2

1 3 2.2 1.5 2 3 1 8 4

b) in well presented way and with some attempt to guard against poor user input, ask the user to

choose one of the matrices and assign it to a variable A.

c) if the determinant of A is nonzero, find the eigenvalues and eigenvectors of A and the solution x

to the equation Ax=y, or display an appropriate message otherwise

clear the workspace and command window at the start of each run and output all results to the

command window.

Question 2

Differential equations to model the HIRES reaction problem1 are:

�”̇ = −1.71�” + 0.43�- + 8.32�0 + 0.007

�-̇ = 1.71�” − 8.75�-

�0̇ = −10.03�0 + 0.43�2 + 0.035�3

�2̇ = 8.32�- + 1.71�0 − 1.12�2

�3̇ = −1.745�3 + 0.43�4 + 0.43�5

�4̇ = −280�4�6 + 0.69�2 + 1.71�3 − 0.43�4 + 0.69�5

�5̇ = 280�4�6 − 1.81�5

�8 ̇ = −280�4�6 + 1.81�5

a) Create a function called HIRES.

– The function should have two input args ordered like this: t, x.

– The function should return one output arg (a 8×1 sized vector called xdot) computed within

the body of the function using the equations above.

(Note: The arg t is unused within the function but is necessary to be in the arg list if HIRES

is passed to one of Matlab’s ode solvers).

b) Write a script that …

– calls the Matlab function ode45, using your HIRES function as an input, to obtain a

solution over a time interval 0 to 300 seconds, with initial conditions �” = 1, �- = 0, �0 =

0, �2 = 0, �3 = 0, �4 = 0, �5 = 0, �6 = 0.0057. Make your call of ode45 for the function

HIRES in anonymous function style rather than as a string. (See matlab help for guidance).

– Use the options arg with your solver to set ‘RelTol’ to 1e-3 and ‘AbsTol’ to 1e6.

– Use tic and toc to find the execution time for the ode45 call and save to a suitably

named variable.

c) Add to your script to repeat the task again, only this time use ode15s.

d) Further add to your script to …

– Plot the eight returned components of xdot from your ode45 call in one set of axes in a

subplot, and the eight returned components of xdot from your ode15s call in another

subplot, arranging the subplots one above the other in the same figure.

– Use a logarithmic x-axis.

– Label the axes as Concentration for the y axis (assume units are mol/dm3

), Time for the x

axis (assume units are seconds), and add a legend placed northeast within each plot to

identify the eight reagents.

– Set the figure to occupy the left half of full screen when the script is run.

– Create a two-line title for each plot, giving the title of the plot in line 1 and the execution

speed, and AbsTol, RelTol values on the second line. Make the second line of the title blue

colour and fontsize 9.

e) Further add to your script to produce a second figure and

– In the second figure make eight subplots (eight rows, one column) and in each subplot

overlay a plot of the first 100 points of data obtained from ode45 and ode15s.

– Plot ode15s as a green line and ode45 as black dots.

1 Ref: https://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf

– Give each subplot a title, axes labels and a legend.

– Set the figure to occupy the right half of full screen when the script is run.

Part B (25% of overall module mark – content from Week 2)

THIS PART OF THE ASSIGNMENT MUST BE COMPLETED IN 8 SIDES OF A4 PAPER. NO MARKS WILL BE

AWARDED FOR SOLUTIONS BOYOND THE LIMIT OF 8 SIDES.

This assignment/report will assess your fundamental understanding of systems modelling and

simulation, including basic use of MATLAB/Simulink. The assignment is based on content from Week

2, part of ACS6101

The assignment is divided into two sections: B1) Basic concepts B2) Advanced concepts. The

expectation is for section B1 to assess your understanding of the basic concepts in the module and

associated learning objectives, while section B2 is to challenge your understanding in more advanced

topics.

In your report you need to address all questions in each part, include your working methodology, the

resulting Matlab/Simulink plots/diagrams, and brief discussion of the results.

Marking Criteria

This this is the marksheet (below) that will be used to assess the assignment. The marksheet

indicates the marks available for each part of the assignment and also indicates some of the factors

that will be used in assessing the quality/correctness of your work. It is strongly recommended that

you study this marksheet before completing the assignment.

Assignment

Task

Marking Guideline Apportioned

Mark

Section B1

Task 1 This is a theory-related task, marks will be awarded for

demonstration of correct understanding of the topic

5%

Task 2 This is a theory-related task, which also includes a practical

aspect. Marks will be awarded for demonstration of correct

understanding of the topic as well as correct final solution

and methodology.

5%

Section B2

Task 1 This is a theory-related task, marks will be awarded for

demonstration of correct understanding of the topic

5%

Task 2 This is a theory-related task, which also includes a practical

aspect. Marks will be awarded for demonstration of correct

understanding of the topic as well as correct final solution

and working out methodology.

8%

Overall Report

for Part B

To assess your report writing skills, marks will be awarded

for report structure, clarity of writing, use of

figures/pictures as well as references.

2%

Total: 25%

Please answer all questions in Section B1 and Section B2.

Section B1

Task 1

Derive a linear approximation mathematical model of the pendulum system shown

in Figure 1 to describe the relationship between the torque developed on the mass

M and the angle theta between the rod and the vertical plane. State clearly your

assumptions and your modelling methodology.

Figure B 1

Task 2

For the mechanical system (simplified car suspension) shown in Figure 2:

a. Derive the mathematical model of the system in the time domain to describe

the displacement associated with the three masses M1 (wheel), M2 (chassis)

and M3 (car seat), and represent the mathematical model in its matrix form

b. Derive the transfer function model of the system

c. Derive a state space representation of the system, and represent it in its state

space matrix form.

Clearly state any assumptions you may make.

Figure B 2

Section B2

Task 1

What is a signal flow graph, and how does it compare against the block diagram

representation? For the system modelled in Part A, Task 2 derive the signal flow

graph (working methodology and diagram).

Task 2

In this part of the assignment the aim is to study the behaviour of a dynamic system,

via modelling and simulation methods.

Using the ACS6101 handout “Practical simulation experiments using SIMULINK”

select one system only for this part of the assignment. You must follow the rule:

“Sum all the numbers of your student registration number (you can find this in you

U-card) to a single digit (ODD/EVEN NUMBER), then select a system according to the

list provided below.”

For example: Student ID: 0123456789, sum of all digits: 0+1+2+3+4+5+6+7+8+9 = 45,

4+5 = 9 (ODD NUMBER), System: 1: Depth Control for a Torpedo.

System selection List:

System 1. (ODD NUMBER) Depth Control for a Torpedo

System 2. (EVEN NUMBER) Positioning System

(you need to show in your report the above calculation and the resulting system that

is selected for analysis)

For the simulation system, in your report you should include 1) A brief introduction

to the system and its modelling. 2) your main results obtained – with justifications of

work when necessary- from completing each task as in the lab sheet, and 3) a brief

conclusion section that summarises the analysis of the system.

– END OF ASSIGNMENT BRIEFING –