HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATIONGRADUATION THESIS MAJOR: THERMAL ENGINEERING TECHNOLOGY INSTRUCTOR: LAI HOAI NAM NGUYEN DUC HUNG NGUYEN QUOC LUONGDESIGN A CONTROL
General Introduction To The Topic
Thermal engineering is increasingly utilized across diverse industries, with boilers playing a crucial role by generating steam for various applications such as textiles, food processing, heating, brewing, and chemical technology.
The rapid advancement of science and technology necessitates collaborative growth across various industries As automation, electrical engineering, and information technology progress, other sectors like thermal engineering are also evolving to keep pace with these developments.
In modern systems, the control system is essential for coordinating equipment operations, particularly in complex environments with multiple physical quantities Traditional analog control circuits are insufficient for simultaneous control, necessitating the use of logic control systems Historically, relay-based logic control was common, but advancements in technology have led to the development of Programmable Logic Controllers (PLCs), which have largely replaced these older systems The success of PLCs can be attributed to their high reliability, backed by semiconductor circuits that meet industrial standards, and their ease of programming, making them a preferred choice in contemporary control applications.
The programming language used in PLCs resembles ladder diagrams found in logic control systems, enhancing usability PLC control devices provide increased power, speed, and flexibility to industrial systems By substituting electromechanical components with PLCs, the control process becomes faster, more cost-effective, and significantly more efficient Additionally, PLCs offer several advantages over traditional relay systems, making them a superior choice for modern automation needs.
- Space Efficiency: A PLC requires less space than a control cabinet using relays to perform the same function
- Energy Saving: PLCs consume very low energy, even less than conventional computers
- Adaptability to Industrial Environments: PLC enclosures are made from durable materials that can withstand dust, grease, moisture, vibrations, and interference Standard computers do not have this capability
- High Flexibility: The control program of a PLC can be quickly and easily changed by reloading a new control program into the PLC using a programmer, memory card, or network transmission.
Project Objectives To The Topic
As science and technology evolve, production is shifting from manual to automated processes, necessitating that automated systems fulfill key technical requirements, including independent operation, high accuracy, safety, efficiency, and user-friendliness While various automatic operating systems like electronic circuit boards and microcontrollers are available, Programmable Logic Controllers (PLCs) continue to be a trusted and prevalent choice among engineers for control applications.
Automating boiler operations is crucial for ensuring safety, efficiency, economic optimization, and longevity in industrial systems The use of PLCs allows for independent boiler operation, simplifies maintenance, and enhances troubleshooting capabilities By tightly controlling critical parameters like temperature, water, smoke, and steam levels, the system minimizes malfunctions, promotes stable operation, and improves energy efficiency, ultimately reducing operational costs.
To keep pace with societal development and improve system quality, the project titled
"Design and Manufacture of Control and Monitoring Cabinets for Boilers Using PLC S7-1200 and Computer Integration" has been selected for research.
Research Objectives
In this graduation project, our team aims to automate boiler operations by implementing water level measurement devices, pressure sensors, and temperature sensors for enhanced protection We will focus on evaluating, detecting, and diagnosing boiler malfunctions while ensuring the safety of the pump Additionally, we will integrate the system for simulation purposes at the UTE thermal workshop.
Automation Operation Using PLC S7-1200: For the automated operation, we will use version v15 of the PLC S7-1200 to develop a reasonable operation plan based on
3 theoretical foundations, ensuring that the system operates fully according to procedures, technical requirements, and safety standards
To ensure the safe and efficient operation of a boiler system, it is essential to implement protective measures that monitor critical parameters such as boiler temperature, pressure, water level, and exhaust gas temperature These factors are vital for maintaining user safety and optimizing system performance.
Temperature and Pressure: Continuous monitoring and control to maintain safe operating conditions
Water levels will be monitored with three electrodes indicating low, medium, and high levels It is essential that the water level remains above the medium threshold, ideally fluctuating between the medium and high levels for optimal performance.
To ensure the safe and efficient operation of a boiler, several key factors require regular attention, including the proper functioning of safety valves, drain valves, and pumps, as well as the monitoring of fuel levels, water supply pipes, and water quality control.
Research Subjects
This study focuses on the boiler and its operational methods, exploring the principles of PLC, sensors, trapezoidal programming language (LAD), and data transmission The objective is to develop a program for controlling the refrigeration system utilizing Siemens PLC version 15.
Research Content
Today, boiler operation depends on many factors including technology, scale, safety requirements as well as environmental protection
Aiming for the common development of the country, as developed countries have applied PLC to optimally control and operate refrigeration systems
To ensure the safe and efficient operation of a boiler system, it is essential to monitor various parameters, including temperature, pressure, water level, and smoke Managing this data can be complex, which is why the implementation of a Programmable Logic Controller (PLC) is necessary to streamline operations and enhance control.
Monitoring temperature and pressure parameters allows operators to gain insight into system performance and stability This awareness enables the identification of potential issues, leading to the implementation of solutions that ensure optimal boiler operation.
Implementing a Programmable Logic Controller (PLC) in a system allows users to easily specify operational and protective requirements, a flexibility not available in conventional systems The stability offered by PLCs enables users to modify operating methods without significant hardware changes, as processing occurs in the central processor Additionally, PLCs facilitate adjustments in control requirements, enhancing system reliability and performance With the capability to manage complex algorithms efficiently, the system consistently operates under optimal conditions, ensuring high performance while optimizing energy use and maintaining economic viability.
Introduction to PLC S7–1200 control and connection
Overview of hardware and light status
Basic structure of the S7-1200 controller
1 Power Supply Connection Point: This is where the power supply is connected to the PLC
2 Memory Card Slot: Slot for inserting the memory card
3 Input/Output Signal Connection Point: This is where the input (I) and output (Q) signals are connected
4 Status Indicator Lights for Input/Output Signals: These lights indicate the status of the input and output signals
5 Ethernet Port: Used for program loading, PLC-to-PLC connection, and PLC- to-HMI connection
Additionally, there are three status indicator lights for the CPU:
▪ RUN/STOP: Indicates whether the CPU is running or stopped (Yellow/Green light)
▪ ERROR: Indicates an error (Red light)
▪ MAINT: Indicates maintenance is required, such as hardware maintenance or replacement (Yellow light)
Table 1 : PLC S7 1200 device indicator status table
Indicator light status panel Function
OFF OFF OFF Recheck the power connection to the CPU
OFF Red Flash OFF CPU error is occurring
Green Light OFF OFF Currently in Run mode
Green Light Red Flash OFF Pending
Green Light OFF Yellow Light Maintained requirements Green Light OFF Yellow Flash Take out the memory card
Green Light OFF Yellow Flash Firmware updated successfully
Green Light OFF OFF Stop mode
OFF OFF Run-stop mode
Red Flash OFF -The CPU is starting up
There are two additional TX and RX warning lights showing the connection for the ethernet port
Table 2 : TX and RX warning lights
OFF There is no ethernet connection between the CPU and the HMI or between the rest of the devices
Green light There are problems connecting to ethernet
Yellow Light Transmitting and receiving signals through the ethernet connection port
Outstanding features of S7 - 1200
Flexible hardware design: Expand input/output ports easily Input/output signal by expansion signal board (signal board)
Each CPU can connect up to 8 input/output signal expansion modules Analog 8-10V input is integrated on the CPU
To enhance communication capabilities, three communication modules, such as RS232 or RS485, can be connected to the CPU The SIMATIC memory card is essential for increasing CPU memory, copying application programs, or updating firmware Additionally, it allows for online and offline error diagnostics.
Used to connect to computers, HMI screens, PLCs with PLCs supporting 16 additional Ethernet ports Transmission speed 10/100 Mbit/s
- Measurement, position and process control features:
Includes 6 high speed counters for counting and measurement applications, including
3 100kHz counters and 3 30kHz counters
Two 100kHz PTO outputs for speed and position control of stepper motors or servo drives (Servo drives)
PWM pulse output, motor speed control, valve position, or temperature control Sixteen PID controllers with auto-tune functionality
Expansion modules
The PLC S7-1200 supports a wide range of expansion modules, allowing users to enhance their system by adding additional input, output, analog signals, or communication ports There are three distinct forms of expansion modules available for the PLC S7-1200.
2 communication module (CM) – transmission port expansion module
3 signal board (SB) - signal board
4 signboards (SM) - input and output signal expansion module (pressure, temperature, water volume signals, )
SB signal boards enable users to enhance their PLC systems by adding input/output (I/O) capabilities These boards facilitate the expansion of both digital and analog signals, ensuring greater flexibility in automation processes Conveniently, the SB signal board is mounted at the bottom of the CPU, streamlining installation and integration.
Figure 2 3 : Expanded signal panel in S7-1200
SB signal expansion code table
Table 3 : Board module expansion signals SB
Digital signal input expansion board 5V/24VCD – 4mA, 4 digital input
Digital signal output expansion board 5V/24VCD – 35mA, 4 digital output MOSFET
Digital signal input/output expansion board
5V/24VCD – 35mA, 2 digital input SOURCE, 2 digital output MOSFET
Digital signal input/output expansion board
5V/24VCD – 35mA, 2 digital input Sink, 2 ngõrasốdạng
SB 1231 AI1 Input expansion board reads voltage- current analog signals
Current/voltage analog signal output expansion board
Input/output signal expansion module (SM)
Users can enhance the CPU's input/output capabilities through the expansion module (SM), which facilitates the addition of digital or analog signals This module is conveniently installed on the right side of the CPU, similar to the signal board (SB).
Figure 2 4 : S7 1200 CPU (1) and I/O expansion module (SM) (2)
Table 4 : Specification of S7 1200 CPU and I/O expansion module (SM)
SM 1221 Digital signal input expansion module
SM 1222 DC or Relay output expansion module
SM 1223 Input and output expansion module (8 in/out or 16 in/out)
SM 1231 Expansion module reads Analog signals
SM1232 Expansion module outputs analog signals
2 OUT, 13 bit hoặc 14 bit – 10V/0-20mA
SM 1234 Expansion module reads and outputs
The communication module (CM) is located on the left side of the CPU and facilitates the addition of communication ports like RS-232 and RS-485 Each S7-1200 CPU supports the expansion of up to three communication modules.
Figure 2 5 : S7 1200 CPU and communication expansion module
Expand the table encryption module CM
Table 5 :Expand the table encryption module CM
CB 241 RS485 communication connection board
CM 1241 RS485 RS485 communication connection module
CM 1241 RS232 RS232 communication connection module
CM 1242 Profibus Slave connection module
CM 1243 Profibus Master connection module
Power connection
Power connection for PLC S7-1200 has two types: 24VDC (DC) source and 220V (AC) source
This type of power supply to the CPU can range from 220V-240V
Connect the power source for the CPU to operate at 24VDC
Connect the input
Figure 2 8 : Siemens S7-1200 AC/DC/xx PLC input connection
DC input connects in two forms: Sink form and Source form
When a user interacts with the push button, current from an external source flows into the input button This type of input, known as a sink type, absorbs current from the outside source.
The opposite of the Sink input connection is the Source input connection Current will flow from the Input output Go to push button and enter power
Output connection
PLC S7-1200 has two forms: Relay (AC) or Transistor (DC)
The CPU utilizes relays on the output side to facilitate control over peripheral devices To establish this connection, a power source of either 24VDC or 220VAC is required, as illustrated below.
For this output type, PLC can only output DC-24V 1-way power signal The connection diagram is shown below (Out comes positive)
Overview of SIMATIC S7 – 1200 PLC
Programming language
-Programming language is a system of rules and syntax used to write computer programs It includes a set of commands and concepts for defining and implementing algorithms
PLC programming language LAD (Ladder Diagram):
Ladder Logic, also referred to as ladder diagram (LD) or LAD, is a graphical programming language used for programming Programmable Logic Controllers (PLCs) This language visually represents logic operations through symbolic notation, structured in logical rungs that resemble a ladder, which is the origin of its name.
LAD with a ladder structure is easy to arrange, organize and monitor
-Disadvantages: some functional programming is not available, especially difficulty in programming motion or threading
FBD (Function Block Diagram) PLC programming language:
-FBD is the abbreviation of “Function Block Diagram” which roughly translates as
Function Block Diagram (FBD) is a popular and user-friendly programming language for PLCs, enabling users to easily program various functions within a PLC system Its simplicity and versatility make FBD an ideal choice for both beginners and experienced programmers in industrial automation.
Works well with motion control functions
More intuitive and easier for some users
Multiple programming lines can be combined into one block or several function blocks
-Disadvantage: it can become disorganized when using this language because you can place these functional blocks anywhere on the page This also makes troubleshooting more difficult
PLC Programming Language ST/STL (Structured Text)
- Structured Text (ST/STL) is a PLC programming language that meets the IEC
61131-3 standard ST is a text-based language, whereas LAD (Ladder Diagram) and FBD (Function Block Diagram) are graphical-based languages ST is a high-level language similar to Basic, Pascal, and C
- Highly organized with the capability to perform complex mathematical calculations
- Allows programming of certain functions that are not available in other languages (such as LAD)
- Difficult to master the syntax
- Troubleshooting errors can be challenging
- Very difficult to edit online
If you're familiar with flowcharts, you'll find that PLC SFC programming is quite similar SFC, which stands for "Sequential Function Charts," utilizes steps and transitions to effectively reach your desired outcome.
- Processes can be broken down into main steps, which helps in quicker and easier troubleshooting
- Direct access to the logic allows you to pinpoint the location of a faulty device
- It can speed up the design and programming process by reusing individual logic components
- This language is not always suitable for all applications
PLC Programming Language IL (Instruction List)
Instruction List (IL) is a text-based programming language that was among the first used for PLC programming, alongside Ladder Diagram (LD) While IL is one of the five languages defined in the original IEC 61131-3 standard, its usage has diminished significantly since the third publication, leading to a decline in support from future PLC manufacturers Designed for programming PLC controllers, IL operates at a low level, akin to Assembly language, requiring users to work with specific codes and components such as LD (Load), AND, and OR.
- Suitable for applications that prioritize simplicity and speed
- More difficult to handle errors compared to other languages
- C/C++: In the current era, computer science is increasingly advancing and penetrating various active fields, including industrial automation C/C++ is a high- level programming language that programmers need to know and apply
C++ is an advanced version of the C programming language, developed by Danish computer scientist Bjarne Stroustrup at AT&T Bell Labs in 1979 The language was officially recognized by ISO in 1998, followed by updates in 2003 (C++03), and later revisions in C++11, C++14, and C++17.
Regulation of memory areas and symbols in PLC S7 - 1200
A CPU features various memory locations and specializations, including I inputs, Q outputs, and M bit memory Each memory location is assigned a unique address, enabling users to efficiently retrieve information from memory The symbols used to denote these memory areas are clearly defined.
Table 6 : Regulation of memory areas and symbols in PLC S7 - 1200
I Copied from the physical inputs at the start of the scan cycle
I_:P Instant reading of input contacts on CPU, SB, and SM
Q Copied from the physical outputs at the start of the scan cycle
Q_:P Instant reading of input contacts on CPU, SB, and SM
M Memory bit set NO YES
L temporary memory for a block, a part of that block
DB Data block NO YES
procedure to access and retrieve a memory area
Accessing and outputting memory areas is specified as follows:
Figure 3 1 : Accessing and exporting a memory area
For example, if a memory area has address I 2.3, I is the CPU input, number 2 represents the address of the byte, number 3 represents the address of the bit located in that byte
Users can access data in various memory areas, such as I, Q, M, DB, and L, using the "byte address" format To retrieve Byte, Word, or Double Word data, it is essential to determine the address similarly to how one would for a bit.
PLC specifies the input signal as I Users can declare to read input signals in bits, bytes, words or Double Words
Bit I[byte address].[bit address] I0.1
I[size].[starting byte address] B4, IW5 and ID12
By appending ":P" to an address, users can instantly read the CPU, SB, or SM's digital or analog inputs The key distinction between using I_:P and I access is that data is directly counted from the accessed addresses rather than from the input process image This method, known as "immediate read" access, allows for real-time data retrieval directly from the source, bypassing any copies made during the last input process image update.
Physical input points are read-only, meaning that I_:P accesses cannot be written to, unlike I accesses which allow both reading and writing These accesses are limited to the size supported by a single CPU, SB, or SM, rounded to the nearest byte For instance, if a 2 DI/2 DQ SB is configured to start at I4.0, the accessible input points are I4.0:P and I4.1:P, or IB4:P While accesses to I4.2:P through I4.7:P are not denied, they are unrecognized as those points are unused Additionally, accesses to IW4:P and ID4:P are prohibited as they exceed the byte shifter capacity of the SB.
I[size].[starting byte address] IB4:P,IW5:P and ID12:P
Siemens PLC defines the output signal as Q Users can declare to read the output signal in bits, bytes, words or Double Words
Bit Q[byte address].[bit address] Q0.1
Word, Double Word Q[size].[starting byte address] QB5,QW10, QD40
By appending ":P" to an address, users can instantly access the digital or analog inputs of the CPU, SB, or SM Unlike standard Q_ access, which retrieves data from the output process image, Q_:P access allows for immediate reading of data directly from the accessed addresses This "immediate read" access ensures that the destination receives data without waiting for the next update from the output process image.
Access to physical output points is restricted to write-only operations (Q_:P), unlike read/write operations (Q accesses) The access is limited to the output size supported by a single CPU, SB, or SM, rounded to the nearest byte For instance, if a 2 DI/2 DQ SB starts at Q4.0, valid output addresses include Q4.0:P and Q4.1:P, or QB4:P However, addresses Q4.2:P through Q4.7:P are not denied but unrecognized due to their unused status Additionally, accesses to QW4:P and QD4:P are prohibited as they exceed the byte shifter capacity of the SB.
Bit Q[byte address].[bit address] Q0.1
Q[size].[starting byte address] QB4:P,QW5:P and
Users can use bit memory (M memory) for both control and data relays to store the instantaneous state of an operation or other control information We can access
22 memory by bit, byte, word or Double Word memory Both read and write access are allowed with M memory
Bit M[byte address].[bit address] M26.7
Word, Double Word M[size].[starting byte address] MD20, MW30, MD50
Setting up special bit
Each brand of PLC features unique symbols for special memory cells, known as bits, each serving a distinct function Unlike the S7-200, where special memory cells are pre-defined, the Siemens S7-1200 PLC requires users to configure these bits manually The process for setting these special bits is outlined in the following steps.
Step 1: In Device Configuration section → Double click on the selected PLC
Figure 3 3 : The Properties window appears and is at the General
Step 2: Go to System and clock memory section
To set special bits (always ON, always OFF bits, ) the user must check Enable the use of system memory bytes
- First cycle: Bit turns ON during the first scan cycle
- Diagnostic status changed: Change to level one after completing a scan cycle
- Always 1 (high): Always turn ON (high level)
- Always 0 (low): Always turn OFF (low level)
To know the bits that create clock pulses (bits that switch at frequencies of 1Hz, 0.5Hz, ), the user must check Enable the use of system memory bytes
If in section (MBx) the user selects 0, it means the special memory cells will automatically start from bits M0.0 to M0.3 Similarly, if you select byte 1 (M1.0 to M1.3), byte 2, etc
Data types are essential for determining the size and processing method of data elements Each command parameter is associated with at least one data type, while some parameters can accommodate multiple data types.
The data types in PLC S7-1200 are as follows:
Table 7 : The data types in PLC S7-1200
Datatypes Data size (Bit) Limit Note
Byte 8 0 to 255 8 bits of data
Int 16 16-bit positive and negative integers
SInt 16 -128 to 127 Negative and positive integers
Dint 32 32-bit positive and negative integers
Real 32 Real numbers specify up to 6 digits lREAL 32 Real numbers specify up to 15 digits String Change Characters are 0 to 254 bytes in size
Overview Of PORTAL TIA V15 Programming Software
Introduction about TIA PORTAL V15 software
TIA Portal, or Totally Integrated Automation Portal, is an advanced software suite designed for comprehensive automation management and electrical system operations It uniquely integrates multiple operating software into a single platform, making it the first of its kind to offer a cohesive environment for executing tasks and controlling automation systems efficiently.
Developed by Siemens engineers in 1996, TIA Portal enables users to swiftly create and manage customized software on a unified platform, significantly reducing the time required to integrate disparate applications for streamlined system development.
TIA Portal serves as the foundational software for all subsequent software developments, facilitating programming and device configuration integration across its product range By enabling software to share a unified database, TIA Portal ensures consistency and integrity in the management and operation of application systems It also provides a user-friendly environment for programming tasks, featuring an intuitive interface for easy information retrieval and support for multiple languages, alongside comprehensive management capabilities for user, code, and project permissions.
+Perform go online and Diagnostic for all devices in the project to identify diseases and system errors
+Easy to configure and link between Siemens devices
TIA Portal software is available in multiple versions, including TIA Portal V14, V15, V16, and the latest release, TIA Portal V17 Users can select and install the version that best meets their specific needs.
TIA PORTAL V15 software and computer requirements
Tia Portal V15 offers enhanced features compared to its predecessor, Tia Portal V14, while also optimizing software capacity and requiring less powerful computer configurations This version is specifically designed for computers with lower processing power, making it an ideal choice for users with less robust hardware.
TIA V15 is a powerful tool for developing control systems for automation devices, particularly the latest S7-1200 PLC series A notable example is the 6ES7214-1AG40-0XB0 model, which is highly compatible with software and widely utilized in Vietnam.
-Configure the computer to install and use TIA PORTAL V15
Windows 7 Ram from 8GB or more
Hard drive (SSD or HDD) with at least 50GB of free space
Windows 10 Ram from 8GB or more
Hard drive (SSD or HDD) with at least 50GB of free space
Windows Server Ram from 8GB or more
Chip core i5 or higher Hard drive (SSD or HDD) with at least 50GB of free space
-Two main versions of Tia Portal V15:
+ For Tia Portal V15, Siemens divides it into 2 versions: Advance and Professional depending on your needs
For newcomers to TIA Portal v15, selecting the Advanced version is recommended due to its lightweight installation and comprehensive inclusion of essential project functions.
• Possess the basic functions of an object
• Has VB Script, warning graphs, movements, Triggers but not as many as the Professional version
• Advantages: lightweight software, runs smoothly
• Includes all functions of the Advance version
• Can configure multiple Server / Client machines
• Disadvantages: powerful machine configuration, large investment costs
4.3 Introducing the TIA PORTAL V15 interface
- When using TIA PORTAL, the software is divided into 2 different display frames
This is the initial interface when the user starts the software In this display frame we will see 3 main parts:
② Create a new project, open an existing project and install the device
③ Initial information selection and configuration
④ Turn on the project display frame
When selecting the Project View item in the Portal View display frame (4), we will be taken to a more in-depth display of equipment and programming:
② Scroll bar for tags, devices and Project fine-tuning configuration
⑥ Return to the original display – Portal View
Figure 4 2 :Project View in Tia portal V15
Write a program and enable program simulation
Step 1:Right click on the icon Tia Portal in Desktop ->Run as adminstrator
Step 2: Tia portal interface has popped up -> Chose Create New project → To
Name Project name)→ Choose where to save (Path) → then press Create
Figure 4 4 :Create a new project in Tia portal V15
Step 3: Before writing a program, users need to configure the device, by clicking
Configure a device → Then select Add new device
Figure 4 5 : Chose device in Tia portal V15
Figure 4 6 : Function window in Tia portal V15
Step 4: At Controllers → Select SIMATIC S7-1200 → Select the CPU type and
To ensure compatibility with the actual CPU type, select version parameters accordingly You can verify your selection by double-clicking on the chosen version or by clicking the Add button.
Figure 4 7 : device selection table in Tia portal V15
Step 5: Write the program Go to CPU section → select Program block → Main section [OB1] to write the program Select PLC tags → Go to Default tag table to set the address for the device
Figure 4 8 : Program of PLC in Tia portal V15
After completing, click Compile to check the program for errors, then click Save
Project to save the written program
Step 6: In New, users select the PLC line (here S7-1200) → then name the article, choosewhere to save and click Create.
Figure 4 9 : Siemens interface in Tia portal V15
Step 7: Go Online → go to Download to Device to load the written program Or click the Download to Device icon on the toolbar.
Figure 4 10 : Connection interface in Tia portal V15
Step 8: Perform simulation Go to Online → Go to Monitor to simulate Reopen the
PLCSIM program → Click on SIM table_1 → Go to Name to name the addresses that need to be monitored → Click on/off to simulate the status of physical devices
Figure 4 11 : Device status model in Tia portal V15
Load the program S7-1200
-After successfully opening the program, writing and checking errors (From steps 1 to 5 above) To load into the CPU, perform the following additional steps:
Step 1: Connect the S7-1200 PLC to the computer via the Ethernet port and turn on the PLC power
Step 2: Check the IP address of the CPU and computer: ❖ IP address of PLC S7-
1200: Go to Device Configuration → Double click on the CPU icon → Properties window appears
Figure 4 12 : Check the CPU's ip address in Tia portal V15
Select PROFINET INTERFACE → Select Ethernet Addresses → At IP Address and Subnet Mask is the IP address of the CPU
To find your computer's IP address, right-click on the network icon in the bottom right corner of the screen, select "Open Network and Sharing Center," click on "Ethernet," navigate to "Properties," and then select "Internet Protocol Version 4 (TCP/IP V4)."
Figure 4 13 : Check the computer's IP address
Note: The IP address of the PLC and the computer IP must be different in the last number
Step 3: Load the program into the CPU
Go to Online → Go to Download to Device to load the written program Or click the Download to Device icon on the toolbar
In the PG/PC Interface section, select the Driver Card code according to the computer
→ Then click the Start Search button
Figure 4 14 : Connection interface in Tia portal V15
• The PLC icon displays in orange Then click Load
• Select Stop All and continue pressing Load
• Then click Finish to complete loading the program.
Function blocks and how to set up function blocks
❖ OB organization function block (Organization Block)
- Is the interface between system operations and user programs An OB can have pre- set state and functionality, but we can also create OBs with arbitrary functionality
The OB block serves as the primary location for calling the FB, FC, and DB within a user program that may include one or more organizational blocks (OBs) and optional starts The OB function block executes once while the PLC is in RUN mode, subsequently continuing to execute the next operations as required.
An OB (Organization Block) can create a continuous loop and may be linked to an interrupt event, which can either be a standard interrupt or an error event It executes in response to the occurrence of the corresponding standard or error event.
-In the OB block, you can get available events as shown in the table below:
Figure 4 15 : Block OB in Tia portal V15
-To perform user OBs, go to Program block → Click Add new block
Figure 4 16 : Function blocks in Tia portal V15
❖ Function block FB (Function Block), FC (Function)
Function blocks (FB) in programming require a dedicated memory area for each invocation When an FB is called, it is assigned a Data Block (DB) that serves as the Instance DB, allowing access to the FB's variables If the function block is called multiple times, each invocation is allocated a separate memory area, ensuring distinct data management for each instance.
Function blocks (FC) are code segments that operate without the need for memory, meaning that any temporary variable data is discarded once the FC has been executed To retain FC data, global data blocks can be utilized effectively.
*The Function block can be used for the following purposes:
− Returns the value to the called function
− Implement functional technology, e.g separate control of binary operations
FC can be invoked multiple times throughout a program, enabling sophisticated iterative functional programming Unlike FB, which is directly associated with a data block (DB) for parameter forwarding and temporary value storage, FC operates independently of any specific DB.
❖ Data Block BD (Data Block) BD usually provides memory for data variables
There are two types of Data Block (DB) structures in programming: Global DBs, which allow all Organizational Blocks (OBs), Function Blocks (FBs), and Function Calls (FCs) to read from and write data to the DB, and DB Instances, which are specifically assigned to individual Function Blocks (FBs).
In user programs, data blocks (DB) are created to store data for code blocks, allowing all program blocks to access a global DB However, a sample DB is designed to store data exclusively for a specific function block (FB) Additionally, it is possible to define a DB as read-only, enhancing data security and integrity.
*The data stored in a DB will not be deleted when the execution of the relevant code block ends There are two types of DB:
• The global DB stores data for code blocks in the program Any OB, FB or FC can access data in a global DB
The Sample Database (DB) is designed to store data for a typical Function Block (FB), capturing essential parameters such as IN, OUT, and IN_OUT, along with the static data associated with the FB It's important to note that the temporary memory for the FB is not included in the Sample DB.
Timer
The Timer feature enables users to customize device operating times according to their preferences With various settings available, the PLC designed by the manufacturer simplifies this process, allowing users to easily name and set their desired installation time In TIA Portal, the meanings and symbols associated with Timer pins are clearly defined, streamlining user interaction and programming efficiency.
Table 8 : Types and functions of timers used in Tia Portal
IN Bool Receives an input signal that allows the Timer to operate
R Bool Reset the Timer to 0
PT(Present Time) Bool Timer's desired value setting pin
ET(Ekapased Time) Bool Timer's elapsed time value
Considered a pulse generator with the width of the pulse depending on the setting time The operating principle of the TP timer is shown as shown below:
Figure 4 17 : Timer TP in Block
-When receiving an impact signal from the IN input, the Q output will increase to level 1 until equal to the PT setting time, then the Q output returns to 0
-Output ON according to preset time
-The operating principle of the TON timer is shown as shown:
Figure 4 18 : Timer TON in Block
-When the timer's IN input is maintained, the ET time begins to count when it reaches the initial setting value PT, the Q output will increase to level 1
-If the IN input loses signal, the Q output will return to 0
-The output will be OFF according to the preset time
-The operating principle of the TOF timer is shown as shown
Figure 4 19 : Timer TOF in Main Block
-When the timer's IN input remains active, the Q output becomes 1
When the IN input transitions to level 0, the ET timer starts counting down until it reaches the preset PT value, at which point the Q output will revert to level 0.
-The operating principle of the TONR timer is shown as shown:
Figure 4 20 : TONER timer in Main Block
The Q output of the TONR timer rises to level 1 when the ET time meets the initial PT pin setting Unlike the standard TON timer, the TONR timer retains the active time value during IN signal interruptions and resumes timing once the IN signal is reactivated.
-For the timer's ET time to return to 0, a signal must be applied to the R pin.
Real-time settings for PLC S7-1200
-To set up real time for PLC, users do the following:
Step 1: Go to Program Block → Select Add New Block
Figure 4 21 : Add program block In Tia Portal
Step 2: Select DB block and name the block.
Figure 4 22 : Add real time in Block
Step 3: Double click on the selected block, in the data type section select DTL (Date
Figure 4 23 : Date and time data Block
Bước 4: Vào mục Extened instructions → Chọn Date and time – of – day → Chọn khối RD_LOC_T
Counter
-We use counters for times, sequences, processes, etc Implemented inside the PLC and output the results
- Each counter uses a structure stored in a data block to maintain count data We assign the data block value when the count command is placed in the editor These
Software counters have a maximum counting rate determined by the execution rate of the associated OB To effectively detect all transitions of CU or CD inputs, the OB must be executed frequently enough.
Table 9 : Meaning of pins in Counter
CU Bool Count by increasing value
CD Bool Count by decreasing value
R Bool Set count value to 0 (CTU and
PV Sint, Int, Dint, USInt, Uint,
Q,QU Bool Execute when CV>=PV
QD Bool Executed when CV