Development of Virtual Machine for mable Logic Controller (PLC) by Using STEPS ming Method Norashikin M. Thamrin, Mohd. Mukhlis Ismail Faculty of Electrical Engineering Universiti Teknologi MARA Shah Alam, Selangor, Malaysia norashikin@salam.uitm.edu.my Abstract mable Logic Controller (PLC) is widely used in manufacturing industries for automation and became one of the essential subjects in the university.learning theory in class alone is not enough to acquire the knowledge of PLC. Therefore in this paper a PLC Integrated Development Environment (IDE) tool suit is developed to assist students learning in the class. It consists of ladder diagram editor, simulator and compiler. It also provides an interactive learning in class as well as hand-on activities for laboratories. This software package is developed using Object Oriented ming (OOP) language Visual Basic 6 to create a virtual microcontroller environment in simulation process. Referring to The Fig. 1, LD is one of low level language programming for PLC as well as Boolean language and it is still widely used in many PLC applications. Hence this paper is focussing on ladder diagram as programming language for the PLC applications. Keywords-component: mable Logic Controller; simulation; design; controller; ladder diagram; microcontroller I. INTRODUCTION mable logic controllers (PLCs) have progressed rapidly since their inception in the early 1970s, and are now widely used in the manufacturing, process and utility industries.[1]plc is special-purpose industrial computers designed for use in the control of wide variety of manufacturing machine and system. PLC also can be defined as a specialized electronic device based on one or more microprocessors that are used to control industrial machinery. The term industrial on the definition implies that PLCs are computer designed to operate in harsh physical and electrical noise environment present in production plants.[2] The definition defined that PLCs are computers; hence they must be programmed using a programming language. There are five standard programming languages standardize by IEC 62232-3 that are available for programming new applications including Ladder Diagrams (LD), Function Block Diagrams (FBD), Structured Text (ST), Instruction List (IL) and Sequential Function Charts (SFC)[2],[6],[7]. In this paper, only ladder diagram will be covered. Fig. 1: Ladder diagram. Theoretical learning alone is not enough to acquire PLC knowledge until they experience themselves. In UiTM specifically for Electrical Engineering majoring in System, PLC is taught in Industrial Instrumentation course. Basically in this course, undergraduates are exposed with a fundamental of PLC by having a theoretical class. As a result, almost 65% of them having a problem in mastering PLC based on unofficial survey that conducted to undergraduates. There are several software-based PLC simulators have been developed since 20 th century. Amongst is PLC Simulator, tri PLC, SOLPICA [3], Estevez et al [4] and Whimori CDK [5]. The PLC Simulator and tri PLC is an online simulator which is available for student access. However, these online simulators are not provided with the save function as they are free software and thus, the designed project cannot be retrieved.
The [3], [4] and [5] are a complete PLC tool with a variety range of features and designed based industrial needs. Therefore, the user interface is not user friendly for students usage. Furthermore, there are too many settings and parameters must be considered during designing the ladder diagram. Those settings are very technical and require a broad knowledge about specific PLC. This paper concerns on developing an IDE to emulate the real PLC for educational purpose in technical institute, high learning institute and industrial organization. Without having to setup the high cost PLC laboratory facilities, students can design, run and simulate their system. PLC IDE is portable and can be stored in any removal media storages. PLC IDE can be run without installing the software in computer. The software can be accessed offline anywhere at any time. It is understood that user interface plays important role in real application. A friendly user interface is one of the advantages to any software developed. Hence, PLC IDE is developed using simple graphical user interface (GUI) with minimal settings of parameters. PLC IDE consists of three components namely: (1) Ladder Editor, (2) Ladder Simulator, and (3) Ladder Compiler. Ladder Editor is the area where the LD is designed by user. Components such as contact, virtual coil and relay coil can be placed on the specific rung created. Ladder simulator then simulates those ladders into an interactive input and output where the output results are in real-time mode. While the compiler convert LD to C code. II. METHODOLOGY There are two major components in this project which are software development and process design. Each component is implemented using different methodology. For software development, Software Development Life Cycle (SDLC) is used while in simulation processes; STEPS Logic Ladder process is used. A. Software Development Life Cycle (SDLC) SDLC consist of six steps namely: (1) Problem analyse, (2) design, (3) coding, (4) Testing and debuging, (5) Solution formalize and (6) maintainance.[7, 8]. The Fig. 2 shows SDLC model. In step(1), problemsare analyzed and solutions are defined. It starts by planning the user interface. User interface allows program to accepts instruction from a user and prepares the result. For this project, a Graphical User Interface (GUI) is used. Next,outputs, processes and inputs are identified the input, process and output for each functions or event triggered functions.[9] Analyse the Problems Design the Code the Test and Debug Formalize the Solution Maintain the Fig. 2: Software Development Life Cycle (SDLC) model. The detail of logic plans is developed in design stage by implementing the flowchart and pseudo code algorithm. Then it is translated into application by using Visual Basic 6 through BASIC language. After the translation process, program is tested with the debugging tool which is embedded in the program system. However, this debugging tool can be disabled when the program is correctly functioning. The code then can be reviewed and internal documentation is revised for future maintenance. This stage is also known as Beta stage where the program is tested by a group of user to identify the bugs that may occur. B. STEPS Logic Ladder Simulation Process Bugs detected Step process is the way the simulation is executed. This method is called steps because every instruction is execute step by step.[10] It is to develop the virtual microcontroller environment to imitate the real microcontroller when performing simulation. Microcontroller (µc) can be defined as a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.[11] In simulation process, the processor core is imitated by Code Executor module while memory is imitated by Data Memory and Register Structure module. Both modules are developed by using ActiveX feature in Visual Basic 6. The Fig. 3 shows the simulation process flow.
III. RESULTS AND DISCUSSION Simulation Initialization Simulation Process LD Scan Line Translate to Pseudo Code Update IO Registers A. Ladder Diagram Editor Ladder Diagram Editor is the area where the entire ladder diagram will be designed. The LD designed by selecting the element such as contact, coil, timer or counter from the toolbar on the left screen. The selected element then placed on the rung by clicking the location where the element decided to be placed. The Fig. 4 shows the Ladder Diagram Editor. Execute Pseudo Code Line by Line Fig. 3: Simulation process flow. The simulation process begins when the user press RUN button. The software will start to scan the LD from the first to the last rung. In each rung, the scanner scans throughout the columns. Each column that connected with branch will be scanned throughout the branch before continuing on the next column. LD Compiler is the key to PLC simulation. This module interpret or translate the LD to pseudo code understand by the code executor. Pseudo mean false where what is read is not an actual word means. Hence, pseudo code is not essential for human understanding. The pseudo code is used to create the algorithm which help programmer (author) to understand the process flow. After translation process is finished, the simulator will update all the input and output (IO) register. This is very important to initialize the state of inputs and outputs. Then the pseudo code is executed by Code Executor. Code Executor is the main engine in simulation process. This module will execute all the instructions line by line as microcontroller does. All the logic statement is referred to the IO register for the output result. The IO Register once again updated for next cycle. This processes continuously repeated until the HALT or STOP button is pressed. To reduce CPU usage, the process cycle is not continuously performs. It only run when there is changes in IO registers. It also cause the system to be more stable and avoiding software from stop responding. Fig. 4: Ladder Diagram Editor Basically, the design area is developed using User Control ActiveX (OCX) control object where the element placed or clicked on the control object is varies according to selected element. All properties of the elements such as state, name, type and id can be updated during program runtimes. B. Table of Elements All elements that will be placed on the rung should be registered into Table of Elements first. All the elements are classified into five types which are Input, Output, Timer, Counter and Relay. The Fig. 5(a) shows the table of elements. (a) (b) Fig. 5: (a) Table of elements and (b) Add new element from Element s Properties dialog box.
Only the registered elements can be used in the LD. To register the new element, user needs to click on the selected port and enter the name of element as shown in the Fig. 5(a). User also can register the new element by clicking the + symbol on elements properties dialog box as in the Fig. 5(b). C. Offline Simulator Simulator is the way user interact with the system designed. There are inputs and outputs peripheral divided into two sides. On the left side, the input peripheral while the right side is the output peripheral. By clicking the toggle buttons on input side, it will update the input register and execute the pseudo code before update the output register on output side. The Fig. 6 shows the Simulator in the PLC IDE. On simulation process, the expected result is achieved. It is proved that the simulation is run accordingly and smoothly without any lag. Simulation result is compared with other online simulator available on the internet in terms of average central processing unit (CPU) usage, memory used and execution time. The Table 1 shows the performance comparison between PLC IDE and other simulators. Table 1: Other online simulators performance compared to PLC IDE. Platform CPU (%) Memory (KB) Execution Time (ms) PLC Simulator Java 27 160,816 0.74 Tri-PLC Java 52 24,600 0.86 PLC IDE Windows 2 10,852 0.12 It is observed that the average CPU usage is relatively high during simulation in PLC Simulator and Tri-PLC compared to PLC IDE. In term of memory usage and execution time, the PLC IDE is the lowest and fastest among them. Fig. 6: Offline Simulator D. Simulation Results In order to verify that the system developed is fully functioned, simulation test are performed. A test file is designed to perform AND, NAND, OR and timing based operation. The design contains eight contacts and three coils (one virtual coil and two relay coils). The Fig. 7 shows the ladder diagram designed. IV. CONCLUSION In conclusion, the fundamental of PLC is very useful to the electrical engineering students before they embark into the industrial world. Interactive learning is one of the effective methods of teaching where student involved in hand-on activities besides learning theory alone. Author believed that this software is very useful to help student to get better comprehension about PLC. It is believed that the objectives of this project are achieved. V. FUTURE WORK This project is developed with simple and basic functions of PLC. It is recommended that few features such as arithmetic operation that enable user to include mathematic function in their design to be added in future. Furthermore, the simulation process can be improved by reducing the usage of memory and processors which lead to system crash or process lagging. A hardware or training kit should be developed as well as the communication protocol with the PLC IDE to provide the students with the online simulation and real application. REFERENCES Fig. 7: Basic ladder diagram with timer design. [1] J. J. Blakley and D. A. Irvine, "Teaching mable Logic Controllers Using Multimedia-based Courseware." [2] J. A. Rehg and G. J. Sartori, mable Logic Controllers: Pearson Prentice Hall, 2007. [3] V. Pinto et al,plc Controlled Industrial Process on-line Simulator, IEEE International Symposium on Industrial Electronics 2007, ISIE 2007, 4-7 June 2007, pg 2954-2957. [4] E. Estevez et al, Graphical Modelling of PLC-based Industrial Control Applications, Proceesing of the 2007 American Control Conference, New York, 11-13 July 2007, pg 220-225.
[5] S. Shin et al, Whimori CDK: A Control Development Kit, International Conference on Computing, Engineering and Information, ICC'09, 2-4 April 2009, pg 115-118. [6] J. George L. Batten, mable Controllers: Hardware, Software and Applications, 2nd Edition ed.: MacGraw-Hill, 1994. [7] T. I. E. Committee, "IEC 61131-3, mable Controllers, ming Languages," ed, 1993. [8] G. Brue and R. G. Launsby, Design For Six Sigma: McGraw- Hill Company, 2003. [9] (2011, 19 March 2011). Systems Development Life Cycle. Available: http://en.wikipedia.org/wiki/systems_development_life_cyc le [10] H. M. Deitel, et al., Visual Basic 6. How to : Prentice Hall, Inc., 1999. [11] B. ı. Zoubek, et al., "Towards Automatic Verification of Ladder Logic s," 2003. [12] S. F. Barret and D. J. Pack, Microcontrollers Fundamentals For Engineers and Scientists, 1st ed.: Morgan & Claypool Publisher, 2006.