0% found this document useful (0 votes)
38 views23 pages

Automatic Control Lab-General

The document discusses the evolution of computation and control systems, highlighting the advantages of computers over humans in data storage and manipulation. It covers historical milestones in computing, such as the development of Deep Blue and the ENIAC, and introduces modeling techniques in control engineering, including mathematical and state-space modeling. Additionally, it outlines the basic steps in control design and provides examples of using MATLAB and Simulink for simulations.

Uploaded by

ahmed.tce2122284
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views23 pages

Automatic Control Lab-General

The document discusses the evolution of computation and control systems, highlighting the advantages of computers over humans in data storage and manipulation. It covers historical milestones in computing, such as the development of Deep Blue and the ENIAC, and introduces modeling techniques in control engineering, including mathematical and state-space modeling. Additionally, it outlines the basic steps in control design and provides examples of using MATLAB and Simulink for simulations.

Uploaded by

ahmed.tce2122284
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Automatic Control Lab

4th Year General 2022-2023

1
Computation
Computer has three advantages over mankind
1- Store information (huge information).
2- Can remember those information precisely and fast in recalling.
3- Can manipulates arithmetic calculation to those information (data).
We human can harvest computer’s capability in storing, remembering to manipulating the
data by programming it.

Can computer do anything by itself?


The program can tell computer what to do, that is a weak point of computer.

Deep Blue was a chess-playing computer developed by IBM. On May 11, 1997, the machine,
with human intervention between games, won the second six-game match against world
champion Garry Kasparov by two wins to one with three draws. Kasparov accused IBM of
cheating and demanded a rematch. IBM refused and retired Deep Blue. Kasparov had beaten
a previous version of Deep Blue in 1996.

2
Artificial Intelligent
Computer before 1948 and Today

Data
Traditional
7*8 Computing Results

56
Programming

Data

7
Learn
Artificial Computing
Result Multiplication

56

3
A company before computer age The same company after computer age

Computation power has changed dramatically


In 1946, an electronic digital computer called ENIAC was implemented with vacuum-tube
circuits. Even though it took up an entire room, ENIAC didn’t have the computing power of
your handheld calculator.

Has the power of


ENIAC computer!!!

Has the power


of Apollo 13
computer!!!

4
Modeling

There is three type of Model Does it matter


1- Physical model, like a status of an outstanding If we know
figure, which represent a person as shape made of that sun is the
stone, may be its bigger or smaller than the real
person.
2- Mathematical Model: as we know it can be a
formula or a mathematical rule like  F= ma.
M
E
3- Processing or To do list: flow chart is one of the center of our
example, we write it to make our job easier and
know how to manage with a real problem.
solar system?

5
Modeling
Brief history: W. Leontif who was one of the USA economists, he had divided the U.S
economy into 500 "sectors", such as the coal industry, the automotive industry,
communications, and so on.
For each sector, he had written a linear equation that described how the sector distributed its
output to other sectors of the economy.
Because the Mark II, one of the largest computers of its day, could not handle the resulting
system of 500 equations in 500 unknowns, Leontief had distilled (purify – condense) the
problem into a system of 42 equations in 42 unknowns.
Programming the Mark II computer for Leontief's 42 equations had required several months
of effort, and he was anxious (restless) to see how long the computer would take to solve the
problem. The Mark II hummed and blinked for 56 hours before finally produce a solution. (It
was late summer in 1949, in Harvard University).
Leontief, who was awarded the 1973 Nobel Prize in economic science, opened the door to a
new era in mathematic modeling in economics.
The importance of linear algebra for applications has risen in direct proportion to the
increase in computing power.

Modeling real-world (]‫)داڕشتهکردنی جیهانی راستهقینه [به ڕێساکردنیان‬: We use numbers every
day. We use numbers to decide how tall we are, how much we weigh, how much money we
have. Some times we notice patterns in numbers –and that's where algebra comes in-. By
using letters to stand for numbers, we can describe patterns and solve problems.
In real life there are many things that can be counted in pattern. Let's cite and example; an
ocean diver knows that the deeper he dives the higher the pressure. The table gives the
pressure at various depths:
Depth Pressure
( ft ) ( lb/in2)
0 14.7
10 19.2
20 23.7
30 28.2
40 32.7
50 37.2
We can find a pattern in reading those values that recorded the pressure with depth increase,
if we write d for depth and P for pressure, we can replace the entire table by a single
algebraic formula:
P = 14.7 + 0.45d
We can think of this formula as giving the pattern of how pressure relates to depth. This
formula contains the whole table, and more. For instance, to get the second row in the table
we replace d by 10 and calculate P.
P = 14.7 + 0.45 (10) = 19.2
We can also use the formula to find the pressure at a depth of 3000 ft, a value that can't be
easily obtained by diving. To find any value we can use the formula to solve the problem.

6
Result: The process of finding formulas that describe real-world situations is called
modeling.
An extra example: A mountain climber wants to know about the temperature, he/she can use
this formula T = -10h + 20 which is brought from the data of the table bellow:
Elevation Temperature
( Kw ) (Co )
0 20 Co
1 10 Co
2 0 Co
3 -10 Co
4 -20 Co
Note: for every 1 km there will be a
decrease of 10 Coin temperature.
Question: Find a formula for the Area of a rectangular whose length is twice its width.
Answer:
Area = length * width
=2w*w
Answer is: = 2 w2 (model)

Graphic
One Picture Worth thousand of words
We have to take the following step in order to draw a function:
1- Define the function to draw.
2- Specify the range of values over which to draw the function.
3- Call the Matlab command: ›› plot(x,y)

For example to see the graph of a sin wave (the sine function), we have to locate x as its
(input data) ranging from 0  2pi, and then compute y which is in this context is (output
data)  y = sin x, then call plot(x,y)
Let’s begin: (Note: x and y must be of the same number of data)
›› x = 0 : pi /100 : 2 * pi
›› y = sin (x)
›› plot ( x , y )

7
Using Scilab:
Same as Matlab we will rewrite those line of code, and the result will be the same as Matlab program.
clear;
clc;
x=(0:0.1:2)*%pi;
y=sin(x);
plot(x,y,’r.’)

Using Python: (you can use Jupyter Notebook or Colab from Google>> this is called new democratic.

import numpy as np
import [Link] as plt
x=[Link](0,2*[Link],0.1)
y=[Link](x)
[Link](x,y)
[Link](True)

The Main basic step in controlling design:

1- Identify the process that we want to control, for example keep a water level of a tank in any factory in a
certain level, or kept full. This process of keeping a tank for a certain level full of water is the process we
have to control.
2- Choose a sensor that will take care about measurement (for instance measuring the height of the water in
our tank).
3- Design the controller (PID), which stand for Proportional-Integral-Derivative Controller. And how to tune
them.

8
Experiment (1):
In control the first step is by finding a model to control our process, the process may be a free fall of a body
(any body like a ball, parachuting a man or shooting stars (metero)) or filling a tank and keeping its hight or
level of water at a certain hight.
The simpliest process is lighting a room with a lump
Control unit
Lump (lighting Process) Senser (our eyes)
(switch)

We as mathematician will try to describe the physical systems in a mathematical equations, this is called
mathematical Model. We use the first principle in doing so. Those principles are Newton’s second law in
Mechanic and Kirchhoff's Law in Electric.
In case of dynamic systems we use differential equation to describe our physical system. Some time we are
not able to do so, therefore we resort to numerical solution instate of analytical solution.
Beside these two method in finding solution to our differential equations we can empirically (Using
laboratory) find the mathematical Model.
 Computation: In modern time, laboratory must provided by computer. Computing is very essential in
modern day. Beside we can also do our computation using google search engine or [Link] which is
a python editor or IDE (Integrated Development Environment).

Let’s start with an example to clarify all we have said in this introduction:
Free Fall:
If we have a ball which is freely falling toward earth, as we know the attraction force exerted by earth is one
of the force, then the drag force which is standing against the falling ball.

1st Step: Find the Mathematical Model


We use one of the first principle: Newton’s 2nd law � = ��.
The forces are: (1) Gravity Force: Fg = mg
(2) Drag Force: Fd = cv
- � = ��
Fg − Fd = ��
mg - cv= �� F Drag
m
��
= �� − �� Force
��
��
m
��
+ �� = �� F Gravity
�� � Force
+ �=�
�� �
The last equation is:
 1st order Differential Equation
 Linear
 Dynamic Equation (it depend on time or there is a change with respect to time)

9
2nd Step: Computation (using Simulation)
Simulink
6-1 Simulink: is an interactive, graphics-based program that allows you to solve
problems by creating models using a set of built-in “blocks.” It is part of the MATLAB
software suite, and requires MATLAB to run.

LabView, National Instruments, is Simulink’s biggest competitor

Simulink’s strength is its ability to model dynamic systems—which are modeled


mathematically as differential equations. Usually these systems change with time,
but the independent variable could also be location. Differential equations can be
solved numerically in MATLAB by making use of functions such as ode45, which
utilizes Runge–Kutta techniques. They can also be solved analytically using the
symbolic algebra toolbox, which utilizes the MuPad engine. Simulink uses similar
methods, but they are transparent to the user. Instead of programming equations
directly, a visual model is created by collecting appropriate Simulink blocks and
connecting them together, using a graphical user interface.

6-2 Script file or M-file:

If we want to see the Sine Wave function, we have to follow the steps bellow:
1- Define a domain as input value x=(0:0.1:2)*pi.
2- Use Function of Sine to estimate the output value: y=sin(x).
3- Use plot function to see the graph of the Sine Wave.

Basic Elements:
There are two major classes of items in Simulink: blocks and lines:
Blocks are used to generate, modify, combine, output, and display signals.
10
Blocks have zero to several input terminals and zero to several output terminals. Unused input
or output terminals are indicated by an open triangle.
Lines are used to transfer signals from one block to another. Lines transmit signals in the
direction indicated by the arrow. Lines must always transmit signals from the output terminal of
one block to the input terminal of another block. One exception to this is a line can tap off of
another line, splitting the signal to each of two destination blocks. Lines can never inject a signal
into another line; lines must be combined through the use of a block such as a summing
junction.

Source Math Sink


Constant Function Display

11
6-3 dynamic system:
Differential equation is any equation that includes a dependent variable, an independent
variable, and the derivative of the dependent variable with respect to the independent
variable. For example,

For our study case (Free Fall)

�� �
+ �=�
�� �
�� �
=�− �
�� �

12
Experiment (2)

DC motor modeling, dc motor contain two parts which are:


1- Electrical Power (input)
2- Mechanical Power (output)
We have to derive these equations, first [electrical part] from Kirchoff’s Law (the
algebraic summation of voltage is equal to zero � = �), second [mechanical
part] from Newton’s Second Law[ � = �θ] for rotation of the dc motor
armechar.

Electrical Part Mechanical Part

� = 0 (Kirchhoff's 2nd Law � = �� Newton's 2nd law


�� ��
��� = �� + � + �� � − �� = �
�� ��
�� ��
� + �� = ��� − �� � + �� = ��
�� ��
Because (Eback=k ω) Because ( T=k i )

Rearrange your equation Rearrange your equation


�� ��
� = ��� − �� − �� � = �� − �ω
�� ��

13
Note: Eb is Back Electric Force (Back Voltage) induced by the change in current flow which is
equal to Eb=k�, k is Motor constant.
Also our (T) is proportional to (ki), I is dc motor current as you know.

14
Experiment (3):

STATE SPACE MODELING


In control engineering, a state-space representation is a mathematical model of a physical system as
a set of input, output and state variables related by first-order differential equations or difference
equations. State variables are variables whose values evolve over time in a way that depends on the
values they have at any given time and on the externally imposed values of input variables. Output
variables’ values depend on the values of the state variables.

15
1st lest talk about: TRANSFER FUNCTION MODELING

Using Netwon’s Second Law of Linear Motion we can find the equation of
motion of this mass and predict the out put for different (spring constant k and
damping coefficient b).
� = �� [a (acceleration is dv/dt or d2x/dt2]
m � + �� + �� = �(�) time domain (t)
m s2 X(s)+b s1 X(s)+k s0 X(s)=F(s) Transformed to s domain (s)
m s2 X(s)+b s X(s)+ k s X(s)=F(s) Transformed to s domain (s)

�(�) 1
=
�(�) m �2 + � � + �

2nd lest talk about: STATE SPACE MODELING

16
Using Matlab:
If m=1, b=1 and k=1 then our transfer fuction will be

Laplace transform representation State space representation


num=[1]; A=[0 1; -1 -1];
den=[1 1 1]; B=[0 ; 1];
sys=tf(num,den) C=[1 0];
D=[0];
sys =
sys=ss(A,B,C,D)
1 .
----------- .
s^2 + s + 1 .
.
Continuous-time transfer function. step(sys)

step(sys)

17
Experiment (4)

Motor Differential Equations


Motor Electrical Part Motor Mechanical Part

� = 0 (Kirchhoff's 2nd Law � = �� Newton's 2nd law


�� ��
��� = �� + � + �� � − �� = �
�� ��
��
�� � + �� = ��
��
� + �� = ��� − �� �� �(�) + � �(�) = � �(�)
��
�� �(�) + � �(�) = ��� − ��(�) �(�) �� + � = ��(�)
�(�) �� + � = ��� − ��(�) �(�)
��� − ��(�) �(�) =
�(�) = �� + �
�� + �

If R is 1, and L is also 1 then our transfer If J is 1, and b is also 1 then our transfer
function will be as the follow: function will be as the follow:

��� − ��(�) �(�)


�(�) = �(�) =
�+1 �+1

Note: Eb is Back Electric Force (Back Voltage) induced by the change in current flow which is
equal to Eb=k�, k is Motor constant.

18
19
Experiment(5)
Time domain analysis
Objectives:-
To determine the time domain specifications by using unit step response
Theory
With reference to the unit step response, the time domain specifications are defined as
follows:-

20
>> num = [1];
>> den = [1 2 4];
>> sys = tf (num,den);
>> step (sys)
>> stepinfo (sys)

21
Assignment -1 This is the format of your assignment
(only 2 page, handwriting)
Start your assignment with the purpose and justification you need
‫سەرەتایەک بنووسە لەسەر ئەو بابەتەیی دەوێت لەسەری بدوێیت‬
)‫(دیاریکردنی مەبەست و هێنانەوەیی بیانوویەک‬
[Engineer need a tool to test his/her idea, his mathematical model in order to find
a big picture (insight) about what his system can do, and find the answer to his
questions about the design like: Is it reliable and proper for different situations as
he expected or it will fail!]
Cite an example if any
Pictures and video are enhance your idea
!‫ناوهێنانی نموونەیەک گەرهەبوو‬
‫وێنە و ڤیدیۆ پشگیری زیاترت دەکەن‬
[As an example Airbus design was simulated before creating and building its full
model and fly. The first prototype failed because of its bad design, but that
doesn’t cost Airbus Company too much money. They make a simulation on
computer, and the result was surprised them, but fortunately they didn’t faced a
destructive and unrecoverable mistake.]
What is the tool you use for solving your engineer study case?
‫ئەو ئامرازەیی لە چارەسەریی ئەو حاڵەتەیی تۆ کۆششی تیا )خوێندنی لەسەر( دەکەیت؟‬
[Scilab and Matlab are two computer programming used in modern day for
computation, scilab is a free program but Matlab is not an open source as scilab.
We use scilab-Xcos which can be used to find a bigger picture of your modeled
mathematical equations. Let us give some example to clarify that.]
Your study case
‫باس لە ئەو حاڵەتەیی کە کۆششی تیا دەکەیت‬
[Mechanical system as an instance has three main element that can be used to
represent any complicated system in this sector of science. These elements are
(Mass, spring and damper).
Every system has a mass and has a flexibility which is a spring like beside that
every mechanical system structure will act as a damper toward its vibration.
Let us watch an airplane wings, this wings has mass, and flexible as a spring and
their structure is working as a damping toward vibration.
Also this model of (mass-spring-damper) is applied to many systems like a
bridge, building and so on…]
22
Your Mathematical Model Derivation
And the program which is used
‫چۆنێتی داتاشینی مۆدێلە بیرکارییەکە‬
‫ئەو بەرنامەیەی کە بەکارهاتووە‬
Mass-Spring-Damper system:

�2 �
�=m Newton’s 2nd Law
� �2
�2 � ��
m +� + �� = � (Force)
� �2 ��

Note: m is mass, c is damping coefficient and k is spring constant. It worth to say F is force applied
to our system.

23

You might also like