Sunteți pe pagina 1din 26

Laboratory Manual

EEME4011: Control Engineering Lab


Name: ___________________________
Reg. No: ___________________________
Section: ___________________________

Department of Electrical Engineering

Capital University of Science and Technology


Islamabad, Pakistan
© Copy Rights, Department of Electrical Engineering, CUST Islamabad

All Rights Reserved

Prepared By: Attabik Tabib

ii
Experiment No 1

Modeling of Electrical and Mechanical Systems in MATLAB and Simulink

Objectives:
1. Learn the basics of modeling of different systems.
2. Simulating a Cruise Control Model in Simulink.
3. Modeling in Simulink

Introduction to Control Systems:


Suppose a slave who used to fan his master using some kind of a cloth and he does this all day
long. To make his life easy, fans were introduced. To this Modern day, different types of
engineering techniques are being put together to make the life easy for a normal man. Control
system is just one and the most important of these fields.

Whenever the name of Control systems is taken, it always comes with the name of Control
Systems Analysis. It basically analyses the system parameters like velocity, temperature, mass,
damping ratio, etc… which are necessary for its quality output. Using these parameters one can
judge its real life state and then implement it. WWII accelerated the development of classical
control theory and practice. Heavy guns had to be rapidly and accurately positioned. Precise
navigation and target tracking were increasingly important, and aircraft performance was
improved greatly with the incorporation of complex control systems to aid the pilot. Today,
control systems are pervasive in industry and in our everyday lives. They range from
governmental regulation (such as that governing monetary policy) to automated and highly
flexible manufacturing plants to sophisticated automobiles, household appliances, and
entertainment systems. It is our purpose to learn to design control systems for a wide variety of
applications.

Control systems in Human body:


Human body contains various control mechanism like the balancing mechanism is carried out by
gyros in our ear, all the six senses are very good example of control systems as they are giving
feedback required by the body to function accurately, if any one of our senses gets disturbed we
can our self-feel the malfunctioning of our body like this example, Just stand with your feet one
in front of other and place your hands on your back and make sure your eyes are open. After you
are in the desired position close your eyes, you will notice the importance of feedback control
systems.

Department of Electrical Engineering 1


Transfer Functions in MATLAB
Transfer function:

A Transfer Function is the ratio of the output of a system to the input of a system, in the Laplace
domain considering its initial conditions and equilibrium point to be zero. This assumption is
relaxed for systems observing transience. If we have an input function of X(s), and an output
function Y(s), we define the transfer function H(s) to be:

𝐻(𝑆) = 𝑌(𝑠)/𝑋(𝑠) (1)

Lab Task 2:
Q1.a) Find the Laplace transform of the following differential equations:

1) 𝑥′′ + 3𝑥′ + 2 = 4𝑦′ + 12𝑦

2) 𝑥′′′ + 19𝑥′ = 𝑦

Q1.b) Repeat the above question but this time using MATLAB

Attach the MATLAB code and Plots in notebooks.

Department of Electrical Engineering 2


Introduction to Simulink
SIMULINK is a program for simulating dynamic systems. As an extension to MATLAB,
SIMULINK adds many features specific to dyn0amic systems while retaining all of MATLAB’s
general-purpose functionality. SIMULINK has two phases of use: model definition and model
analysis. A typical session starts by either defining a model or retrieving a previously defined
model, and then proceeds to analysis of that model. These two steps are often performed
iteratively until the model achieves the desired behavior. To facilitate model definition,
SIMULINK adds a new class of windows called block diagram windows. In these windows,
models are created and edited principally by mouse driven commands. Part of mastering
SIMULINK is to become familiar with the manipulation of model components within these
windows. After you define a model, you can analyze it either by choosing options from the
SIMULINK menus or by entering commands in MATLAB’s command window.

Constructing a Simple Model:

At the MATLAB prompt type >>Simulink. This command displays a new window containing
icons for the subsystem blocks that make up the standard library. These subsystems can be
opened (by double-clicking) to produce the windows containing the prototype blocks to be
copied into your models. Click on File and New, and then move the window to a comfortable
position.

Figure 1—Simulink Blocks


Open Sources, Sinks, Continuous, and Connections by double-clicking on the icon with the left
mouse button. Move the windows to a comfortable position. Blocks can be copied from one
window to another by dragging them from the original location to the new location by holding
down the left mouse button. Assemble the following diagram in your working window. [e.g. Step
Input -> Sources; Sum ->Math operations, Transfer Fcn -> Continuous; Scope -> Sinks]

Department of Electrical Engineering 3


Figure 2—Different Simulink Blocks

Location of Different Important Blocks:

• Simulink > Continuous > Integrator.


• Simulink > Continuous > Transfer Function.
• Simulink > Continuous > Differentiator.
• Simulink > Math Operations > Absolute.
• Simulink > Math Operations > Gain.
• Simulink > Math Operations > Slider Gain.
• Simulink > Math Operations > Sum.
• Simulink > Signal Routing > Demultiplexer.
• Simulink > Signal Routing > Multiplexer.
• Simulink > Sinks > Display.
• Simulink > Sinks > Scope.
• Simulink > Sources > Clock.
• Simulink > Sources > Pulse Generator.
• Simulink > Sources > Ramp.
• Simulink > Sources > Signal Generator.
• Simulink > Sources > Signal Builder.
• Simulink > Sources > Sine Wave.
• Simulink > Sources > Step Signal.

Department of Electrical Engineering 4


Lab Task 3:

Q: Investigate the open loop step response of the integrator.

Figure 3—Implementation of Open loop Integrator in Simulink


Step 1: Open Simulink by typing Simulink on MATLAB command window

Step 2: A new window will appear .Select the option to create new model.

Step 3: Select the integrator, gain, step and scope blocks.

• Simulink > Continuous > Integrator.


• Simulink > Math Operations > Gain.
• Simulink > Sources > Step Signal.
• Simulink > Sinks > Scope.

Step 4: Now connect these blocks as shown in Figure 3.

Step 5: Press play button.

Step 6: Now click on scope block to visualize the graph. You can get the response as shown in
the figure below.

Department of Electrical Engineering 5


Figure 4—Output of Step Response of Integrator on Scope
Step 7: Now plot your graph below and compare it with Figure 4.

Figure 5—Step Response of the open loop Integrator

Department of Electrical Engineering 6


 Compare Figure 4 and Figure 5.

Lab Task 4:

Q: Investigate the closed loop step response of the integrator.

• Repeat the same steps as described above for the following figure.

Figure 6–Close loop Integrator with Negative feedback in Simulink

Department of Electrical Engineering 7


 You can get the response as shown in the Figure 7.

Figure 7 –Output of Close loop Integrator on Scope

 Now plot your graph below.

Figure 8 — Step Response of the closed loop Integrator

Department of Electrical Engineering 8


 Compare Figure 7 and Figure 8.

Department of Electrical Engineering 9


Mathematical Modeling:

Mathematical modeling is the mathematical representation of any system. System can belong to
any field of science. A mathematical model is the replica of the exact behavior of the system, it
represents the relations between the inputs and outputs. How the output corresponds by changing
the inputs.

1. Modeling of an Electrical Network

RC Circuit

Figure 9: RC Series Circuit


Where,
Vin is the input voltage applied
Vout is the output voltage.
R=1k C=1uf

Step 1: Find the transfer function Vout/Vin.


Step 2: Write the transfer function in MATLAB.
Step 3: Take step of the transfer function. The graph will be display as shown below

Department of Electrical Engineering 10


Figure 10

Step 4: Take 63 percentage of the final value as shown in graph above. The value of
time at this amplitude will be equal to T
Step 5: Now put values in the first order general transfer function
𝐴
𝑇𝑠 + 1
Where A is final value
T is 63% of final value

 Write the equations for step 1 and 5 in the space provided

Department of Electrical Engineering 11


 Provide MATLAB code for the above equations in the given space and attach graphs

The transfer function find in step 1 and step 5 should be same

Department of Electrical Engineering 12


Figure 11
Design the Simulink model in the space given below

Figure 12

Department of Electrical Engineering 13


Lab Task 1:

RLC Circuit

Figure 13

Q1.a) Find out the relation between the output voltage of capacitor to the input voltage
applied. Use RL= 1k, L= 1mH, C= 1uF.
Q1.b) Simulate the system on MATLAB and Simulink and comment on the results.
Q1.c) Find the transfer function from the graph.
Q1.d) Compare results of part a and part c.

 Write the equations in the space provided below

Department of Electrical Engineering 14


 Provide MATLAB code for the above equations in the given space and attach graphs

The transfer function in both cases should be same.

Design the Simulink model in the space given below

Figure 14

Department of Electrical Engineering 15


Lab Task 2:
2. Modeling of a Mechanical Network

Cruise Control Model:


Following is the equation of motion for an automobile.
v'+(b/m)v=u/m
Using this differential equation, we can find the transfer function of this cruise control.
Now implement the transfer function using Simulink and analyze its output. Use the values of m
= 1580 kg , and b = 26 N*sec/m period of time. Its output will be quite similar to a car whose
driver accelerates it for instance and then leaves the car to decelerate at its own speed. Also, use
the differential equation to make a second model of the same system using Simulink. Compare
the output of both the systems now. It should be same.

Figure 15

Q2.a) Find the relation between the input force (u) and the output velocity (v)
Q2.b) Simulate the system on MATLAB and Simulink.
Q2.c) Find the transfer function from the graph.
Q2.d) Compare results of part a and part c.

 Write the equations in the space provided below.

Department of Electrical Engineering 16


 Provide MATLAB code for the above equations in the given space and attach graphs.

 Write your analysis in the space given below.

Department of Electrical Engineering 17


Design the model in Simulink and sketch the model in the space given below

Figure 16

Department of Electrical Engineering 18


Lab Exercise and Summary
Summary should cover Introduction, Procedure, Data Analysis and Evaluation.

Department of Electrical Engineering 19


Department of Electrical Engineering 20
Department of Electrical Engineering 21
Problem Exercise and Questions
Q1. What is the difference between the open loop and closed loop systems?

Q2. Simulate the step response of the transfer functions given in question Q1.a in MATLAB and
Simulink.

Department of Electrical Engineering 22


LABORATORY SKILLS RUBRIC (Psychomotor)

Total Marks: 100

Criteria Level 1 Level 2 Level 3 Level 4 Score


(Max Marks) 0% ≤ S < 50% 50% ≤ S< 70% 70% ≤ S< 90% 90%≤ S ≤100% (S)
Procedural Selects Selects and applies Selects and Selects and
Awareness inappropriate appropriate skills applies the applies
(20) skills and/or and/or strategies appropriate appropriate
strategies required by the strategies and/or strategies and/or
required by the task with some skills specific to skills specific to
task errors the task without the task without
significant errors any error

Practical Makes several Makes few critical Makes some non- Applies the
Implementation critical errors in errors in applying critical errors in procedural
(30) applying procedural applying knowledge in
procedural knowledge procedural perfect ways
knowledge knowledge
Safety Requires constant Requires some Follows safety Routinely
(10) reminders to reminders to procedures with follows safety
follow safety follow safety only minimal procedures
procedures procedures reminders
Use of Uses tools, Uses tools, Uses tools, Uses tools,
Tool/Equipment equipment and equipment and equipment and equipment and
(20) materials with materials with materials with materials with a
limited some competence considerable high degree of
competence competence competence
Participation Shows little Demonstrates Demonstrates Actively helps to
to Achieve commitment to commitment to commitment to identify group
Group Goals group goals and group goals, but group goals and goals and works
(10) fails to perform has difficulty carries out effectively to
assigned roles performing assigned roles meet them in all
assigned roles effectively roles assumed
Interpersonal Rarely interacts Interacts with other Interacts with all Interacts
Skills in positively within group members if group members positively with
Group Work a group, even prompted spontaneously all group
(10) with prompting members and
encourages such
interaction in
others

Marks Obtained

Department of Electrical Engineering 23


LABORATORY SKILLS RUBRIC (Cognitive)

Total Marks: 40

Criteria Level 1 Level 2 Level 3 Level 4 Score


(Max. Marks) 0% ≤ S < 50% 50% ≤ S < 70% 70% ≤ S < 90% 90% ≤ S ≤ 100% (S)

Introduction Very little Introduction is brief Introduction is Introduction complete


(5) background with some minor nearly complete, and well-written;
information mistakes missing some minor provides all necessary
provided or points background principles
information is for the experiment
incorrect
Procedure Many stages of Many stages of the The procedure The procedure is well
(5) the procedure procedure are could be more designed and all stages
are not entered entered on the lab efficiently designed of the procedure are
on the lab report. but most stages of entered on the lab report.
report. the procedure are
entered on the lab
report.
Data Record Data is brief and Data provides some Data is almost Data is complete and
(10) missing significant complete but has relevant. Tables with
significant information and has some minor units are provided.
pieces of few critical mistakes. Graphs are labeled. All
information. mistakes. questions are answered
correctly.
Data Analysis Data is Data is presented in Data is presented in Data are presented in
(10) presented in ways (charts, ways (charts, tables, ways (charts, tables,
very unclear tables, graphs) that graphs) that can be graphs) that best
manner. Error are not clear understood and facilitate understanding
analysis is not enough. Error interpreted. Error and interpretation. Error
included. analysis is analysis is included. analysis is included.
included.
Report Report contains Report is somewhat Report is well Report is well organized
Quality many errors. organized with organized and and cohesive and
(10) some spelling or cohesive but contains no grammatical
grammatical errors. contains some errors. Presentation
grammatical errors. seems polished.

Marks Obtained

Department of Electrical Engineering 24

S-ar putea să vă placă și