Thursday, April 2, 2009

Programmable Logic Controllers (PLC)

Specialised hardened computers, referred to as programmable logic controllers (PLCs), are frequently used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events. This leads to precisely controlled actions that permit a tight control of almost any industrial process.
Human-machine interfaces (HMI) or computer human interfaces (CHI), formerly known as man-machine interfaces, are usually employed to communicate with PLCs and other computers, such as entering and monitoring temperatures or pressures for further automated control or emergency response. Service personnel who monitor and control these interfaces are often referred to as stationary engineers.
Automation is now often applied primarily to increase quality in the manufacturing process, where automation can increase quality substantially. For example, automobile and truck pistons used to be installed into engines manually. This is rapidly being transitioned to automated machine installation, because the error rate for manual installment was around 1-1.5%, but has been reduced to 0.00001% with automation. Hazardous operations, such as oil refining, the manufacturing of industrial chemicals, and all forms of metal working, were always early contenders for automation.

PLC ladder Programming
The simple programming language which is used to a program PLC is called ladder language due to its similarity in structure to a ladder. It connects the input to the outputs according to the desired control algorithm. It is very simple and graphical; in short Ladder is a very intuitive language which one can easily learn with ease.

Multiprog is a versatile ladder programming GUI / IDE used to write debug and simulate Ladder programs for various types of PLCs.
Here we consider writing a Ladder program for the ADAM 5100 series PLC.
Install Mutiprog demo provided with the CD.
Creating a new project using the Project Wizard
First we create a new, empty project named 'Demo' using the Project Wizard. After starting the Project Wizard it guides you in six steps through the project creation. Each step is performed in a separate dialog:
• Dialog 1: we enter the project name 'Demo'.
• Dialog 2: for the first POU, which is inserted automatically by the Project Wizard, we choose the programming language LD (Ladder Diagram) and enter the name 'LD_POU'.
• Dialog 3: for the configuration, which describes the characteristic of the connected PLC, we accept the default name 'Configuration' and select the configuration type 'IPC_30'.
• Dialog 4: for the resource, which describes the processor type of the connected PLC, we accept the default name 'Resource' and the resource type 'PCOS_NT'.
• Dialog 5: for the task, in which the defined POU is running, we accept the default settings.
• Dialog 6: shows a project description, which is an overview of the settings we have made in the dialogs 1 to 5.
After clicking 'Finish' in the last dialog, the project will be created and inserted in the project tree window. You can see the newly generated project with its POU 'LD_POU' in the subtree 'Logical POUs' and the configuration, resource and task in the subtree 'Physical Hardware'.
Once the project has been created we can proceed with phase 2: Developing the program code.
In the second phase we develop the program code in Ladder Diagram using the graphic editor. Since the code body worksheet of our LD_POU is already opened we can immediately start editing.
This phase shows you how to:
• Insert a first LD network into the worksheet consisting of a contact (C000) and a coil (C001).
• Insert and declare variables for the LD objects (C000 and C001) using the dialog 'Contact/Coil Properties'.
For the contact the variable 'On_Off' is inserted and declared as global variable. Since this contact is used as ON/OFF switch, which has to be "pressed" by the user, it is declared as located variable and assigned to a physical input address. This means that clicking on the related LED in the I/O simulator sets the variable and starts the timer.
For the coil the variable 'Motor' is declared. This is also a global and located variable, assigned to a physical output address. It represents the motor status, i.e. it lights up in the I/O simulator if the motor runs.
The detailed settings of these objects are listed in the table below.
• Insert the function block TON (Timer On-Delay) into the LD code worksheet using the Edit Wizard. As FB instance name we choose 'Motor Time'. The function block is inserted directly into the existing LD network. As input variable the contact 'On_Off' is used and the coil 'Motor' is connected to the FB output 'Q'.
• Insert and declare a constant and a variable, both connected to the function block TON.
The FB input 'PT' is connected to a time constant 'T#5s' (5 seconds). This input specifies the preset time interval (delay time) after which the FB output 'Q' is set to TRUE and the motor is switched on. Output 'ET' is connected to the variable 'Actual_Time' which delivers the elapsed time interval. For both the constant and the variable the data type 'TIME' is used.
Settings for the LD objects:
Object Variable name Usage Data Type I/O address Scope
Contact On_Off VAR_EXTERNAL BOOL %IX0.0 Global
Coil Motor VAR_EXTERNAL BOOL %QX0.0 Global

After the edit process is finished we have to compile the project as shown in phase 3.
In the third phase we compile the project 'Demo' using the command 'Make'.
Compiling means translating and transforming the contents of the worksheets to special code which can be executed by your PLC or the I/O simulator.
While compiling the project, the message window shows you the compilation process. Any detected errors and warnings (e.g. syntax errors, memory or file problems) are displayed in the appropriate sheet in the message window. Accessing the code body worksheet causing an error message is simply done by double clicking on the corresponding message.
Afterwards we can proceed with phase 4 and download the project to the target.
In the fourth phase we download (i.e. send) the compiled project 'Demo' to the I/O simulator using the control dialog and the dialog 'Download'.
If the project is stored on the simulation (PLC) we can proceed with phase 5 and perform a PLC cold start.
Once the project is downloaded to the target we perform a cold start. While the PLC program is executed on the simulation, we want to verify whether the code is works correctly. For that purpose the system provides several debug tools.
This phase shows you how to
• execute a cold start of the simulation.
• Call the graphic editor in online mode to display online values in the LD worksheet.
• Use the I/O simulator to verify that the On/Off switch for starting the motor works properly.

Creating a HMI to work with the PLC
Why do we need a HMI?
Assume a situation of a heater control. What if the user needs to change the heater temperature set point?
We will have to disconnect PLC from the system and then we will have to edit our program source to reflect the new temperature and download again to the PLC.
With a complex program this will a very time consuming and error prone process. So in order to solve this problem we need a HMI. Then the user will enter the new value to the HMI GUI presented at the touch panel PC and the values of the set point of the PLC will automatically change.

How a HMI connects to the PLC

What is OPC?
OPC is open connectivity via open standards. They fill a need in automation like printer drivers did for Windows. See the summary of current and emerging OPC Specifications and OPC Certification.
OPC is open connectivity in industrial automation and the enterprise systems that support industry. Interoperability is assured through the creation and maintenance of open standards specifications. There are currently seven standards specifications completed or in development.
Based on fundamental standards and technology of the general computing market, the OPC Foundation adapts and creates specifications that fill industry-specific needs. OPC will continue to create new standards as needs arise and to adapt existing standards to utilize new technology.
OPC is a series of standards specifications. The first standard (originally called simply the OPC Specification and now called the Data Access Specification) resulted from the collaboration of a number of leading worldwide automation suppliers working in cooperation with Microsoft. Originally based on Microsoft's OLE COM (component object model) and DCOM (distributed component object model) technologies, the specification defined a standard set of objects, interfaces and methods for use in process control and manufacturing automation applications to facilitate interoperability. The COM/DCOM technologies provided the framework for software products to be developed. There are now hundreds of OPC Data Access servers and clients.
Everyone's favorite analogy for needing the original Data Access Specification is printer drivers in DOS and then in Windows. Under DOS the developer of each application had to also write a printer driver for every printer. So AutoCAD wrote the AutoCAD application and the printer drivers. And WordPerfect wrote the WordPerfect application and the printer drivers. They had to write a separate printer driver for every printer they wanted to support: one for an Epson FX-80 and one for the H-P LaserJet, and on and on. In the industrial automation world, Intellution wrote their Human Machine Interface (HMI) software and a proprietary driver to each industrial device (including every PLC brand). Rockwell wrote their HMI and a proprietary driver to each industrial device (including every PLC brand, not just their own).
Windows solved the printer driver problem by incorporating printer support into the operating system. Now one printer driver served all the applications! And these were printer drivers that the printer manufacturer wrote (not the application developer). Windows provided the infrastructure to allow the industrial device driver's solution as well. Adding the OPC specification to Microsoft's OLE technology in Windows allowed standardization. Now the industrial devices' manufacturers could write the OPC DA Servers and the software (like HMIs) could become OPC Clients.
The resulting selfish benefit to the software suppliers was the ability to reduce their expenditures for connectivity and focus them on the core features of the software. For the users, the benefit was flexibility. They could now choose software suppliers based on features instead of "Do they have the driver to my unique device?" They don't have to create a custom interface that they must bear the full cost of creating and upgrading through operating system or device vendor changes. Users were also assured of better quality connectivity as the OPC DA Specification codified the connection mechanism and compliance testing. OPC interface products are built once and reused many times; hence, they undergo continuous quality control and improvement.
The user's project cycle is shorter using standardized software components. And their cost is lower. These benefits are real and tangible. Because the OPC standards are based in turn upon computer industry standards, technical reliability is assured.
The original specification standardized the acquisition of process data. It was quickly realized that communicating other types of data could benefit from standardization. Standards for Alarms & Events, Historical Data, and Batch data were launched.

The OPC server is the intermediate layer which helps the PLC and HMI talk to each other. It acts as interpreter.
Why do we need the OPC server?
It is because there are different HMI software and Different PLCs. If the HMI is manufactured to talk with a specific PLC directly, then it won’t be able to talk with any other (different make), so in order to be able to use any PLC with any HMI, the industry has defined the OPC standard. The HMI software manufacturer should present his specific OPC server software to the clients, and by using that, the clients can connect any PLC (Which supports Modbus) to that HMI .

* DCS - Distributed Control System
* HMI - Human Machine Interface
* SCADA - Supervisory Control and Data Acquisition
* PLC - Programmable Logic Controller
* DAQ-Data Acquisition

No comments: