Compiled
Compiled
3 BITS Pilani, Deemed to be University under Section 3, UGC Act 6 BITS Pilani, Deemed to be University under Section 3, UGC Act
4/30/2022
7 BITS Pilani, Deemed to be University under Section 3, UGC Act 8 BITS Pilani, Deemed to be University under Section 3, UGC Act
• The input/output unit provides the interface between the system and the outside world, allowing • The operation is not simultaneous for the entire ladder diagram.
for connections to be made through input/output channels to input devices such as sensors and
output devices such as motors and solenoids. • The process of reading the inputs, executing the control application program,
• Every input/output point has a unique address which can be used by the CPU. and updating the output is known as SCAN.
Read Execute
inputs program
PLC SCAN
• Each I/O device has to be identified with a unique address for exchange of data. Different
manufacturers adopt different schemes to identify I/O device. For ex.: X1 X2 X3 X4 X5 Update Diagnostic &
• X1 – input (1) or output (0); X2: I/O rack no.; X3: module slot number; X4X5: terminal number outputs Comm.
9 BITS Pilani, Deemed to be University under Section 3, UGC Act 11 BITS Pilani, Deemed to be University under Section 3, UGC Act
4/30/2022
A complex manufacturing results in a 30 ms PLC scan time. The PLC must detect 2 cm • The use of high level language to write programs in microprocessor requires some skill in
individual objects moving on a high-speed conveyor belt. If the object breaks a light beam programming and PLCs are intended to be used by users without any great knowledge of
providing a high input to the PLC, then calculate the highest sped of the conveyor to be sure programming.
that the object is detected. • As a consequence, ladder programming was developed. This is a means of writing programs
which can then be converted into machine code by some software for use by the PLC
2 microprocessor.
𝑇 =
𝑆 • An international standard has been adopted for ladder programming and indeed all the
Where, S = conveyor speed, so, methods used for programming PLCs. The standard published in 1993, is IEC 1131-3
(International Electrotechnical Commission).
if, 𝑇 = 1 𝑠𝑐𝑎𝑛 𝑡𝑖𝑚𝑒 = 30 𝑚𝑠, then, • The IEC 1131-3 programming languages are ladder diagrams (LAD), instruction list (IL),
sequential function charts (SFC), structured text (ST), and function block diagrams (FBD).
𝑺 = 𝟐/𝟎. 𝟎𝟑 = 𝟔𝟔. 𝟕 𝒄𝒎/𝒔.
12 BITS Pilani, Deemed to be University under Section 3, UGC Act 13 BITS Pilani, Deemed to be University under Section 3, UGC Act
Contd… Examples
LATCH: A B
EX-OR Gate:
Scanning a ladder diagram Use of relay and switch to start the motor X400 X401
14 BITS Pilani, Deemed to be University under Section 3, UGC Act 16 BITS Pilani, Deemed to be University under Section 3, UGC Act
4/30/2022
Develop the physical ladder diagram • PLC timers and counters are internal instructions that provide the same functions as
AND a programmable ladder hardware timers and counters.
diagram for a motor with the • They activate or deactivate a device after a time interval has expired or a count has reached a
following: NO start button, NC stop preset value.
button, thermal overload limit switch • Timer and counter instructions are generally considered internal outputs.
opens on high temperature, green
light when running, red light for • These are generally represented by blocks in the ladder diagrams.
thermal overload.
17 BITS Pilani, Deemed to be University under Section 3, UGC Act 19 BITS Pilani, Deemed to be University under Section 3, UGC Act
There are typically five types of timers: • The instruction Generate pulse sets
output Q for duration PT.
• TP: generate Pulse
• The instruction is started when the
• TON: ON-delay timer (MOST Common) result of logic operation (RLO) at
• TOF: OFF-delay timer input IN changes from 0 to 1 (positive
signal edge).
• RTO: Retentive timer ON • The programmed time PT begins when
the instruction starts.
The timers use a preset or count and a time base to implement it’s function. • Output Q is set for the duration PT,
regardless of the subsequent course of
𝑃𝑟𝑒𝑠𝑒𝑡 𝑡𝑖𝑚𝑒 = COUNT × 𝑇𝑖𝑚𝑒 𝑏𝑎𝑠𝑒
the input signal.
• Even if a new positive signal edge is
detected, the signal state at the output
Q is not affected as long as the PT time
is running.
20 BITS Pilani, Deemed to be University under Section 3, UGC Act 21 BITS Pilani, Deemed to be University under Section 3, UGC Act
4/30/2022
22 BITS Pilani, Deemed to be University under Section 3, UGC Act 23 BITS Pilani, Deemed to be University under Section 3, UGC Act
• Counter up (CTU)
• Counter down (CTD)
• Counter UP/DOWN (CTUD)
24 BITS Pilani, Deemed to be University under Section 3, UGC Act 25 BITS Pilani, Deemed to be University under Section 3, UGC Act
4/30/2022
26 BITS Pilani, Deemed to be University under Section 3, UGC Act 27 BITS Pilani, Deemed to be University under Section 3, UGC Act
Thank You
Fuzzy systems
These slides should only be considered as supporting material. To have a • A fuzzy set is a collection of real numbers having partial membership in the
thorough understanding of the course, these must be accompanied by set.
textbook, reference materials and lecture notes. • This is in contrast to a conventional or crisp set.
• For example, consider a set of “all heights of people 6 - ft tall or taller”
2 BITS Pilani, Deemed to be University under Section 3, UGC Act 5 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
𝑀 = { 𝑥, 𝜇 𝑥 ∶ 𝑥 ∈ 𝑋}
7 BITS Pilani, Deemed to be University under Section 3, UGC Act 9 BITS Pilani, Deemed to be University under Section 3, UGC Act
8 BITS Pilani, Deemed to be University under Section 3, UGC Act 10 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
Fuzzy Compliment
𝜇 (𝑥) = 1 − 𝜇 𝑥
11 BITS Pilani, Deemed to be University under Section 3, UGC Act 18 BITS Pilani, Deemed to be University under Section 3, UGC Act
Examples… Examples…
∩
𝜇 𝑥 = min 𝜇 𝑥 , 𝜇 𝑥 : 𝑥 ∈ 𝑋
OR
∩
𝜇 𝑥 = {𝜇 𝑥 𝜇 𝑥 : 𝑥 ∈ 𝑋}
Examples… Examples…
∪
𝜇 𝑥 = m𝑎𝑥 𝜇 𝑥 , 𝜇 𝑥 : 𝑥 ∈ 𝑋
OR
∪
𝜇 𝑥 = {𝜇 𝑥 + 𝜇 𝑥 − 𝜇 𝑥 𝜇 𝑥 ∶ 𝑥 ∈ 𝑋}
Fuzzy Union:
20 BITS Pilani, Deemed to be University under Section 3, UGC Act 22 BITS Pilani, Deemed to be University under Section 3, UGC Act
21 BITS Pilani, Deemed to be University under Section 3, UGC Act 23 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
Center of area
Let’s Calculate the wind chill using Minimum T-norm and COG defuzzification.
24 BITS Pilani, Deemed to be University under Section 3, UGC Act 26 BITS Pilani, Deemed to be University under Section 3, UGC Act
𝜇 7 = 0.3
𝜇 7 = 0.7
𝜇 7 =0
𝜇 7 =0
0, 𝑇<0
𝑇
1, 𝑇<0 , 0 > 𝑇 ≥ 10
𝑇 𝜇 = 10
𝜇 = − + 1, 10 > 𝑇 ≥ 0 1
10 − (𝑇 − 20), 10 > 𝑇 ≥ 20
0, 𝑇 ≥ 10 10
0, 𝑇 > 20
25 BITS Pilani, Deemed to be University under Section 3, UGC Act 27 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
𝜇 22 = 0
𝜇 22 = 0.44
𝜇 22 = 0.76
0, 𝑇 < 2.5
𝑆 0, 𝑆 < 12.5
− 0.2, 15 > 𝑇 ≥ 2.5 𝑆
𝜇 = 12.5 𝜇 =
𝑆 − 1, 25 > 𝑆 ≥ 12.5
12.5
− + 2.2, 27.5 > 𝑇 ≥ 15 1, 𝑆 ≥ 25
12.5
0, 𝑇 > 27.5
Implied fuzzy sets
28 BITS Pilani, Deemed to be University under Section 3, UGC Act 30 BITS Pilani, Deemed to be University under Section 3, UGC Act
𝜇 7 = 0.3
𝜇 22 = 0
𝜇 7 = 0.7
𝜇 22 = 0.44
𝜇 7 =0
𝜇 22 = 0.76
𝜇 7 =0
29 BITS Pilani, Deemed to be University under Section 3, UGC Act 31 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
32 BITS Pilani, Deemed to be University under Section 3, UGC Act 34 BITS Pilani, Deemed to be University under Section 3, UGC Act
Input-output characteristic for wind-chill fuzzy Implied fuzzy sets: Product T norm
system (min -T norm and COG defuzzification) (COG)
33 BITS Pilani, Deemed to be University under Section 3, UGC Act 35 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
36 BITS Pilani, Deemed to be University under Section 3, UGC Act 38 BITS Pilani, Deemed to be University under Section 3, UGC Act
Or,
40 BITS Pilani, Deemed to be University under Section 3, UGC Act 42 BITS Pilani, Deemed to be University under Section 3, UGC Act
X1 and X2
41 BITS Pilani, Deemed to be University under Section 3, UGC Act 43 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/7/2022
44 BITS Pilani, Deemed to be University under Section 3, UGC Act 47 BITS Pilani, Deemed to be University under Section 3, UGC Act
Δ𝑢(𝑛𝑇) N Z P
N NB NS Z
Thank You
𝑒(𝑛𝑇)
Z NS Z PS
P Z PS PB
46 BITS Pilani, Deemed to be University under Section 3, UGC Act
5/4/2022
1
5/4/2022
b: bias weight,input is 1
f is activation function
2
5/4/2022
Architecture (topology of how the 1. The ability to learn and model images,
network is structured) videos , audio , speech etc
Activation Functions
Two types of Activation
Functions y y
threshold linear
1. Linear Activation Function
net net
y y
2. Non-linear Activation
Functions piece-wise linear sigmoid
net net
3
5/4/2022
.
f(net) =1 if net ≥0 .
=0 otherwise . wn
1 if net q
y= {
xn
0 if net < q
hardlim in matlab
4
5/4/2022
y ' f '(net ) y (1 y )
A reason for its popularity in neural
Log sigmoid activation function networks is because the sigmoid
1 function satisfies a property between the
log sigmoid y f (net)
1 exp(.net) derivative and itself such that it is
Slope computationally easy to perform.
5
5/4/2022
2
tansigmoid y f (net) net
1
(1 e )
1 enet
1 enet
Find f ’(net) w.r.t. net in terms of y
f ' (net ) 0.5(1 y 2 )
For tanh
x is net, f(x) is f(net) derivative is (1-y2 )
6
5/4/2022
if c=1, f’(net)=1
7
5/4/2022
UNIPOLAR
HARDLIMITER
8
5/4/2022
x2
architecture
• Able to solve non-linear
classification problems x2
CLASSIFICATION OF ANN
Feed-forward nets
• Informationflow is
ARCHITECTURE unidirectional
9
5/4/2022
FEEDBACK/RECURRENT NETWORKS
Learning methods
Supervised learning
Unsupervised learning
Reinforcement learning
10
5/4/2022
• Unsupervised Training
11
5/4/2022
12
5/4/2022
What is a Hyper-parameter?
It is a parameter in machine learning whose value
is initialized before the learning takes place. They
are like settings that we can change and alter to
control the algorithm’s behavior.
Used to learn parameters If Y_pred is very far off from Y, the Loss value
will be very high.
A single value, not a vector, it rates how
if both values are almost similar, the Loss
good the neural network did as a whole.
value will be very low.
13
5/4/2022
wi (new) = wi (old) + η E
wi (new) > wi(old)
wi (new) = wi (old) - η E
wi (new) < wi(old)
14
5/4/2022
Learning rate
MODES OF TRAINING
BACK-PROPAGATION LEARNING ALGORITHM
15
5/4/2022
Mini-batch learning –
In batch mode the weight up gradation is done
after the whole N patterns are presented
E3 = (yd – y) f’(neto)
E2 = f’(neth2) E3 g(t)
E1 = f’(neth1) E2 w(t)
Calculate new weights Randomly select a vector pair (xp, yp) from the training
g (t +1) = g(t) + η E3 f(neth2 ) set X
w (t +1) = w (t) + η E2 f(neth1 ) and compute the outputs of all neurons in the network (
at hidden and output layers) – Forward pass
h (t +1) = h (t) + η E1 x
16
5/4/2022
GENERAL BPA
17
5/4/2022
18
5/4/2022
( y1 y 2 y3 ) 0.2 2 0.6899(1 0.6899) 0.0909 wx H1 H1 x 0.2 0.0909 1.0 0.0181
H H1
H 2 ( y1 y 2 y3 ) 0.2 2 0.6899(1 0.6899) 0.0909 wx H 2 H 2 x 0.2 0.0909 1.0 0.0181
19
5/4/2022
X current X
X normalised
X
20
5/4/2022
ADVANTAGES OF NEURAL
DISADVANTAGES OF NEURAL NETWORK
NETWORK
Good fit for non-linear models. Needs lots of training data sets.
Ability to adopt, learn, generalize, extrapolate, Needs lots of CPU power and
ability to operate in high noise environment, ease
time or horsepower.
of maintenance.
They have very good learning ability.
Unpredictable for utilization in
Their fault and uncertainty tolerance is good. untrained areas.
21
5/4/2022
The data based models are especially ANNs accurately recognize the inherent
relationship between any sets of inputs and outputs
appropriate for problems that are data without formulating a mathematical model of a
rich, but hypothesis and/or information phenomenon under consideration.
poor.
Ability of ANN, trained on a finite set of examples,
for accurate prediction on unseen inputs, is called
In all the cases the availability of Generalization.
sufficient number of quality data points
are required to propose a good model. From a function approximation point of view, such
new examples can be regarded as either
interpolation or extrapolation of the training data.
Quality data defined by noise free
data; free of outliers is ensured by data With respect to neural networks, the operation of
mining and pre conditioning/processing. interpolation is preferred over extrapolation.
22
5/4/2022
Over-fitting results in
poor generalization.
Network fails to respond well when
tested and simulated with an unseen
data set.
23
5/4/2022
perf = 1.4639e-04
net=feedforwardnet([10,10,10]);
24
5/4/2022
a= rand(1,1000);
b=rand(1,1000);
c=rand(1,1000);
n=rand(1,1000)*0.05;
y = a*5 + b.*c + 7*c + n;
n is the noise, added deliberately to make it
more like a real data.
So our input is set of a ,b and c and output is
y. P=[a; b; c];
T=y;
net = feedforwardnet(4); /*hidden layer size as
4
net = train(net,P,T);
25
5/4/2022
H 2 (s) R2
y1=sim(net,[1 1 1]'); Qi ( s) 1 2 s 2 (1 2 A1R2 ) s 1
OR Three inputs :1) time t
y1=net(1 1 1) 2) time constant 1 (=τ1)
3) time constant 2 (=τ2)
y1=13.0279. which is close to 13 the actual One output : height of tank 2,h2
output (5*1+1*1+12*1); Generate input/output for (τ1,τ2 )
=(1,1),(1,2)(2,1)(2,2)
• I
• a=ones(2,n);
• clear all;
• /* 2 rows 10 columns of 1111111111
• close all;H2(s)/Qi(s)= R2/ [T1T2s2+(T1+T2+A1R2)s+1] • 1 1 1 1 1 1 1 11 1
• clc; • a1=a;
• t = 0:1:10; /* 0 1 2 3 4 5 6 7 8 9 10 • a2=[1 0;0 2]*a; 1 0 1111111111
• [m n] = size(t); m (row) =1, n (columns) =11 • 0 2 1 1 1 1 1 1 1 11 1
• % R2= 1 A1 =2 •
1111111111
• sys1 = tf([1],[1 4 1]);% to generate training data for H2 with • 2222222222
T1=1,T2=1
• r11 = step(sys1,t); • a3=[2 0;0 1]*a; 2 0 1111111111
• 0 1 1 1 1 1 1 1 1 11 1
• sys1 = tf([1],[2 5 1]);% to generate training data for H2 with •
T1=1,T2=2 2 22 2 2 2 2
222
• r12 = step(sys1,t); 111111111
• sys1 = tf([1],[2 5 1]);% to generate training data for H2 with • a4=2*a; 2 0 1111111111
T1=2,T2=1 • 0 2 1 1 1 1 1 1 1 11 1
• r21 = step(sys1,t); 2222222222
2222222222
• sys1 = tf([1],[4 6 1]);% to generate training data for H2 with
26
5/4/2022
27
5/4/2022
END
28