0% found this document useful (0 votes)
8 views13 pages

Lab5 - Nguyễn Hoàng - Eeaciu22164

This document outlines Lab 5 of the Programmable Logic Control (PLC) course, focusing on math functions supported in TIA Portal. It covers objectives, introduces various math and comparison instructions, and provides exercises and experiments related to counting products on a conveyor belt. The lab emphasizes the application of these functions in control logic and data manipulation within PLC systems.

Uploaded by

Nguyễn Hoàng
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)
8 views13 pages

Lab5 - Nguyễn Hoàng - Eeaciu22164

This document outlines Lab 5 of the Programmable Logic Control (PLC) course, focusing on math functions supported in TIA Portal. It covers objectives, introduces various math and comparison instructions, and provides exercises and experiments related to counting products on a conveyor belt. The lab emphasizes the application of these functions in control logic and data manipulation within PLC systems.

Uploaded by

Nguyễn Hoàng
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
You are on page 1/ 13

INTERNATIONAL UNIVERSITY

SCHOOL OF ELECTRICAL ENGINEERING

Programmable Logic Control (PLC) Lab-EEAC007IU

LAB 5: MATH FUNCTIONS

Full name: Nguyễn Hoàng


Student’s ID: EEACIU22164
Class/Group: PLC Lab – 01
Date: ……………………………………………….

Programmable Logic Control (PLC) Lab Page 1 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

I. OBJECTIVES
1. Introduction of a number of math functions that are supported in TIA PORTAL;
2. Apply to an experiment and exercises.

II. INTRODUCTION
The introduction of mathematical operations in the PLC provided major benefits to control logic.
Numeric data could be combined with logic to provide more powerful control strategies. For
instance, decisions could be made concerning mathematical operations concerning counts of
products, weights of a product, the temperature of an oven or any numeric variable in a process.

The instructions are briefly divided into three categories: Compare, Math, and Move.
1. Compare
Compare instructions

Figure 1
The compare instructions are used to compare two values of the same data type (6 types: Int, DInt,
Real, Word, Dword). When the LAD contact comparison is TRUE, then the contact is activated.
Relation type TRUE/ FALSE
== IN1 equals to IN2
<> IN1 does not equal to IN2
>= IN1 is greater than or equal to IN2
<= IN1 is less than or equal to IN2
> IN1 is greater than IN2
< IN1 is less than IN2

In range and Out of Range instructions

Programmable Logic Control (PLC) Lab Page 2 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Figure 2
The IN_RANGE and OUT_RANGE instructions are used to test whether an input value is in or out
of a specified value range. If the comparison is TRUE, then the box output is TRUE. The input
parameters MIN, VAL, and MAX must be the same data type.

Relation type TRUE/ FALSE


IN_RANGE MIN<=VAL<=MAX
OUT_RANGE VAL<MIN or VAL>MAX

2. Math

Add, Sub, Mul, Div, Calculate instructions

Figure 3
When enabled (EN = 1), the math instruction performs the specified operation on the input values
(IN1 and IN2) and stores the result in the memory address specified by the output parameter
(OUT). After the successful completion of the operation, the instruction sets ENO = 1. Note
that, ENO is the status to indicate whether there is error in the calculation. EN0=1 indicates that
there is no error while ENO=0 indicates the error depending on the situation that the process has
made error.

Programmable Logic Control (PLC) Lab Page 3 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Limit instructions

Figure 4
The LIMIT instruction is used to test if the value of parameter IN is inside the value range
specified by parameters MIN and MAX. The OUT value is clamped at the MIN or MAX value,
if the IN value is outside this range.
• If the value of parameter IN is inside specified range, then the value of IN is stored in
parameter OUT.
• If the value of parameter IN is outside of the specified range, then the OUT value is the
value of parameter MIN (if the IN value is less than the MIN value) or the value of
parameter MAX (if the IN value is greater than the MAX value).

3. Move
Use the MOVE instructions to copy data elements to a new memory address and convert from one
data type to another. The source data is not changed by the move process. There are some types of
Move instructions such as:
i. MOVE: Copies a data element stored at a specified address to a new address
ii. MOVE_BLK: Interruptible move that copies a block of data elements to a new address
iii. UMOVE_BLK: Uninterruptible move that copies a block of data elements to a new Address
Rules for data copy operations
i. To copy the Bool data type, use SET_BF, RESET_BF, R, S, or output coil (LAD)
ii. To copy a single elementary data type, use MOVE
iii. To copy an array of an elementary data type, use MOVE_BLK or UMOVE_BLK
iv. To copy a structure, use MOVE
v. To copy a string, use S_CONV
vi. To copy a single character in a string, use MOVE
vii. The MOVE_BLK and UMOVE_BLK instructions cannot be used to copy arrays or
structures to the I, Q, or M memory areas.
Description of MOVE, MOVE_BLK, UMOVE_BLK

Programmable Logic Control (PLC) Lab Page 4 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

a)

b)

c)
Figure 5
The MOVE instruction (Figure 5a) copies a single data element from the source address
specified by the IN parameter to the destination address specified by the OUT parameter. The
MOVE_BLK (Figure 5b) and UMOVE_BLK (Figure 5c) instructions have an additional
COUNT parameter. The COUNT specifies how many data elements are copied. The number of
bytes per element copied depends on the data type assigned to the IN and OUT parameter tag
names in the PLC tag table.

Besides, MOVE_BLK and UMOVE_BLK instructions differ in how interrupts are handled:
1. Interrupt events are queued and processed during MOVE_BLK execution. Use the
MOVE_BLK instruction when the data at the move destination address is not used
within an interrupt OB subprogram or, if used, the destination data does not have to
be consistent. If a MOVE_BLK operation is interrupted, then the last data element
moved is complete and consistent at the destination address. The MOVE_BLK
operation is resumed after the interrupt OB execution is complete.
2. Interrupt events are queued but not processed until UMOVE_BLK execution is
complete. Use the UMOVE_BLK instruction when the move operation must be

Programmable Logic Control (PLC) Lab Page 5 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

completed and the destination data consistent, before the execution of an interrupt
OB subprogram
The summary of the three listed Move instructions is described in the following table:

Instruction Usage Properties


MOVE Copy value o The IN input to the parameter of the OUT
output.
o The parameters at the input and output must
be of the same data type.
o The parameters can also be structured tags
(PLC data types).
MOVE_BLK Copy array o Copies the content of an array to another
array.
o The source and target array must be of the
same data type.
UMOVE_BLK Copy array without o Copies the content of an array without any
interruption interruption to another array.
o The source and target array must be of the
same data type.
Table 1
There is another function that is supported in TIA PORTAL, that is Convert.

Convert:
The CONVERT instruction is used to convert a data element from one data type to another data
type. Click below the box name and then select IN and OUT data types from the dropdown list.

Figure 6
After selecting the (convert from) data type, a list of possible conversions is shown in the
(convert to) dropdown list. Notice that Conversions from and to BCD16 are restricted to the Int
data type. Conversions from and to BCD32 are restricted to the DInt data type.

Programmable Logic Control (PLC) Lab Page 6 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

III. EXERCISES (PRE-LAB)


Exercise 1. Use Compare instruction to compare the data value from the address MW10 (data
type is integer) with value 16. Known that this comparison is only performed if a button START
is pressed.
Ans:

Exercise 2. Use Convert instruction to change a BCD value in the memory MW30 to become a
Real data in the memory MD96.
Ans:

IV. EXPERIMENTS

Experiment 1. Write a PLC algorithm to count the number of products which are carried on a
conveyor belt to a storage house. The procedure is described as follows
1. Press START to allow the conveyor belt to transport the products to the storage house. A
light sensor PEB is used to detect the number of products which have been transported to the
storage house.
2. If there is any product in the storage house, the light Stor_not_Empty is ON.
3. If there are 5 products in the storage house, the light Stor_50%_Full is ON.
4. If there are 9 products in the storage house, the light Stor_90%_Full is ON.
5. If there are 10 products in the storage house, the light Stor_Full is ON and the belt stops
transporting the products.
6. The system only restarts working after all the products have been moved out from the storage
house and the START button is pressed
7. Note that the operator can press STOP to cancel the working process in emergency case.
After the fault has been dealt, the operator can press START to resume working.

Programmable Logic Control (PLC) Lab Page 7 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Input/ Output Memory address Types

Start %I0.0 Input

Stop %I0.1 Input

sensor Peb %I0.2 Input

RESTART %I0.3 Input

conveyor belt %Q0.0 Output

store not empty %Q0.1 Output

store 50% full %Q0.2 Output

store 90% full %Q0.3 Output

store empty %Q0.4 Output

b) Result:

Programmable Logic Control (PLC) Lab Page 8 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Programmable Logic Control (PLC) Lab Page 9 of 13


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Start simulation:

Programmable Logic Control (PLC) Lab Page 10 of


13
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Programmable Logic Control (PLC) Lab Page 11 of


13
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Programmable Logic Control (PLC) Lab Page 12 of


13
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

c) discussion:
- In this lab, we apply the concepts of Math Instructions and review the functionality of
the CTU (Count Up) block. By utilizing Compare instructions, we address all problem
requirements effectively.
- Through this process, we evaluate the values of Compare contacts and determine the
appropriate relationship type for each case.
- Upon completing the problem, we gain a clear understanding of how to use Compare
contacts in the TIA Portal and how to define their required inputs accurately.

Programmable Logic Control (PLC) Lab Page 13 of


13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy