0:16
hello everyone welcome to automation
0:19
community In this session we are going
0:21
to see about one of the most important
0:24
and you know useful instruction in
0:27
homegrown PLC which is called as
0:30
SC scaling function So this is one of
0:34
the most important instruction in PLC
0:37
programming Why because whenever we are
0:40
going to deal with some analog values we
0:43
have to do this scaling function Correct
0:47
for example let's take you have a water
0:50
tank over there in your industry So you
0:53
are having the level transmitter there
0:55
So what will be the output of the level
0:57
transmitter it will be in terms of uh
0:59
you know 4 to 20 milliamps Level
1:02
transmitter is giving the output as 4 to
1:04
20 milliamps But you want to uh you know
1:08
calculate that in the percentage like
1:10
how much percentage uh my water is
1:13
filled in the water tank Okay you are
1:15
you know calculating that as a 0 to 100
1:18
in terms of 0 to 100 percentage right so
1:23
now you want to write a program so that
1:26
the level transmitter output 4 to 20
1:28
milliamps can be readed in the form of
1:31
percentage Can you understand the
1:33
concept so this is called a scaling You
1:37
scale any input to the required
1:41
output All right So let's see that in
1:44
the program So this is how ACL will be
1:49
instruction will be like ACL in the
1:51
overall and the first one is having the
1:53
source word So which is the data you
1:56
want to transfer like your level
1:58
transmitters input is the source word
2:00
here Okay And what is your result word
2:04
result word will be your percentage
2:06
output Okay So you are going to read 4
2:09
to 20 milliamps any any any value in
2:12
between 4 to 30 milliamps and your
2:14
output is any value between 0 to 100 All
2:16
right So now what is this P1 so this P1
2:20
is going to uh you know play the vital
2:23
role So what it is going to do means you
2:26
have to tell the scaling function that
2:29
you're going to convert 4 to 20
2:34
100% or for example 0 to 10 volt to 4 to
2:38
20 m or 0 to 10 volt to some degree uh
2:41
you know 30° to 500° like that you can
2:44
fix any range according to your
2:46
application So you have to tell the Sccl
2:49
that this is my input range input
2:52
minimum and maximum range and this is my
2:54
output input and maximum range like that
2:57
you have to tell the SCL so that it will
2:59
calculate the you know output and it
3:02
will it will give the output according
3:04
to your application All right I hope you
3:07
have understand the basic concept of CI
3:11
So look at this This is your input
3:15
source Okay Imagine this is your 4 to 20
3:18
milliamps This is your unsigned BCD
3:21
output This is our okay result So this
3:31
percentage So now this as S is the
3:35
minimum range in your input So what is
3:37
the minimum range of our input which is
3:39
four Correct minimum value not range
3:41
sorry it's a value So four BS
3:45
is your 20 milliamps Correct And how
3:49
about this A R which is your zero BR is
3:53
100 Look at this So P is having some
4:02
100 is having a R A R is nothing but the
4:07
lower minimum value of your output Okay
4:11
Which is zero What is a as minimum value
4:14
of your input which is what
4:17
four Are you following it's easy to
4:20
understand now So a R is the minimum
4:24
value of your output AS is the minimum
4:27
value of your input BR is maximum of
4:30
output Maximum of output And BS is
4:33
minimum of your input Sorry maximum of
4:37
your input Okay So by using this SCL
4:43
will be knowing that okay this is the
4:45
range and this is the input I have to
4:48
convert like that so that can understand
4:50
the concept and it will give you
4:53
the okay so I'll explain you in the
4:57
program so that you can understand in a
5:00
way This is my running
5:04
condition and let's take AC L What is my
5:08
source address let's take D00
5:23
give this parameter address now So this
5:29
And the next fellow code is
5:46
D parameter minimum maximum This is
6:07
correct All right So go for the
6:20
simulation Let's take a watch table
6:32
200 D 2 not 1 2 3 and this is going to
6:38
be my 300 Okay So why I'm taking all
6:42
these because I have to give the minimum
6:44
and maximum H correct
6:56
Now what is this value this is
7:04
Correct this is my outputs minimum First
7:07
value is the output minimum This is
7:14
maximum Output minimum
7:54
then okay I'm giving this
7:59
as zero Okay And this fellow is going to
8:04
be your 100 Correct 100
8:07
This is going to be your
8:09
four This is going to be your 20
8:13
milliamps All right So you have given
8:15
the value So this is your parameters
8:20
first address So that is going to be
8:22
your outputs minimum This is output
8:24
maximum This is input minimum This is
8:27
input maximum Why I'm telling you this
8:33
this conversion 4 to 20 milliamps to 0
8:38
100% So if it is input is if your level
8:42
transmitter is giving 4 milliamps that
8:44
means what there is no water inside that
8:46
is a 0% water If your level transmitter
8:49
is giving 20 milliamps then we get to
8:52
know there is a 100% loaded and in
8:54
between 50%age half water tank is per
8:59
mills Okay So we'll apply this input
9:03
condition and we'll check whether we are
9:13
give four here 4 milliamps is given by
9:19
transmitter Output have to be
9:23
what it have to be zero Right so we are
9:31
Now we'll give 12 which is 50%
9:51
over okay let's give 20% let's see
9:55
whether it is giving it's giving
10:01
64 so the answer is in BCD that one also
10:05
we have to see the answer is in BCD
10:31
less So if I give 20 millia I should get
10:35
100 Okay I'm giving I'm getting 64
10:55
BCD is 100 Yes See here look at this 064
11:01
is nothing but the 100 So it's giving
11:17
So try to change the data type of this
11:33
understand Okay Can you see here
11:39
12 So it should give 52 Can you see it's
11:44
50 That's a problem with run on because
11:47
we cannot able to see the expected uh
11:50
way If you want you can make use of such
11:54
options in the home run software Okay
11:56
It's showing in the BCD You have to
12:00
that we are we are expecting the answer
12:03
in the decimal See 12 you know 0 to 100
12:05
is nothing but the decimal value right
12:08
here it is showing the BCD you have to
12:09
understand okay 32 BCD is nothing but 50
12:12
in the decimal that's what you can
12:15
here you can convert all so that you can
12:19
see everything in the
12:36
Okay this is how scaling will be
12:41
working and this is like in the
12:44
practical way we have taken the example
12:46
like 4 to 20 milliamps to you know
12:50
So you can make use of any
12:53
application There are so many
12:55
conversions people will be calculating
12:58
uh the same 4 to 20 milliamps to some
13:01
you know uh to the voltage 0 to 5 volt
13:05
volt or in temperature range like that
13:08
they will be calculated correct look at
13:11
this 0 to 100 4 to 20 milliamps the
13:15
answer is 50 Okay What if if you're
13:19
16 16 is nothing but nearly it will be
13:31
18 8 milliamps answer is
13:36
22 okay so for this it should be
13:39
actually 25 this is giving 22 no this
13:42
should be some offset value you have to
13:43
add offset according to
13:47
answer Okay So this is the offset we
13:50
usually call it as you can add the
13:55
three it should be the 25 So you can add
13:59
or subtract the offset according to
14:05
okay So if again you give over to giving
14:11
zero the exact percentage are coming So
14:23
right So let's see what 19 is giving 19
14:26
is giving 96 is the most
14:29
close Okay So this is called as a
14:32
scaling application in industry So
14:36
scaling is most important instruction
14:42
So you can apply this to
14:44
any scaling function anything like 4 to
14:48
20 millia as I have told you I have
14:50
taken the level transmitter you can uh
14:53
you know take the temperature
14:54
transmitter or pressure transmitter that
14:58
to convert to the you know some other
15:01
value So this conversion is mostly used
15:03
for processing it is used to uh help in
15:07
data Okay So this is scaling function
15:12
and one more application over here that
15:15
scaling We'll see that
15:18
also What is reverse
15:20
scaling so reverse scaling is your B r
15:28
R So what does that mean
15:32
your sometimes what will happen no let's
15:35
take the same example 4 to 20 milliamps
15:37
is converting to 0 to 100 uh percentage
15:40
Sometimes the requirement will be like
15:43
zero have to be I mean four have to be
15:47
100 20 have to be matched to zero In
15:50
that case what you will do you have to
15:51
reverse the range What is this
15:56
means let's take uh you know flow flow
15:59
of some liquid or something is there
16:02
Okay according to your level transmitter
16:04
value You are going to close the val or
16:08
valve Okay So there are two types of val
16:11
that is normally closed val or normally
16:13
open val So for this you are going to
16:16
give the instruction whether that may be
16:18
the 100%age or zero percentage So you
16:21
can fix whether four is matching with
16:24
the 0 percentage or four is matching
16:27
100% 20 is matching with 100 or 20 is
16:30
matching with 0 percentage
16:32
Okay So suppose in the previous scaling
16:36
function what we have done 4 is equal to
16:38
0 and 20 is equal to 100 In your some
16:42
other application you want four have to
16:43
be equal to 100 In that case what you
16:46
will do you can do the reverse scaling
16:49
Okay So it's simple You can see the
16:52
difference Here a R is down BR is up Now
16:58
so here also A R is BR is down AR is up
17:02
That means what the lower range have to
17:05
be up Lesser range have to be
17:07
down So what you can do in the
17:15
is you can interchange the 100 and zero
17:21
big How the output you want like that
17:23
you can put So here I'm giving
17:27
100 Here I'm giving zero This is reverse
17:30
scaling nothing big Okay I'm doing
17:36
force Now see you are giving 20
17:39
milliamps but your output is zero 0% 0
17:45
percentage here 0% you give 4
17:49
milliamps your answer is output is 100
17:52
100%age open valve is 100% open Now for
17:57
empty empty tank what is 4 milliamps
18:01
there is empty tank so you have to open
18:02
the work you know fully so you are
18:07
100%age correct so like this you can
18:10
make use of scaling and reverse scaling
18:11
in your application I hope you have
18:14
understood this concept I'll meet you in
18:16
a session with another interesting topic