“Programming Instruments and Control Systems for a Factory with

0 downloads 0 Views 14MB Size Report
factory and added new features that were not used in existing similar factories to ...... mixing truck will only depend on the dropping action of the mixer blade (Ferraris, .... To replace the existing dc motors in the system the usage of ac motors has been ...... cat.Create(Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Data.
“Programming Instruments and Control Systems for a Factory with Customizable SCADA system”

by Zaid Samer Al Shattle

An Honours report submitted for the Degree of:

BEng in Electrical and Electronic Engineering

Synopsis

Synopsis Nowadays there has been a significant push towards automation, which is highlighted by the constant growth of technological advancements that are palpable by the increased efficiency and safety of all new factories. Nevertheless, the speed of growth has also caused a contrary effect on the application of technology. Many factories suffer to keep up with new technologies due to the high and frequent cost of buying new equipment, which has driven people to another outlet, factory renovations. The project discussed in this paper is concerned with the modification, renovation, and programming of a Wet Mix Plant in Jabal Ali (Wade Adams Contracting). The factory is a 30 years old factory with manual controls. The factory has been renovated and equipped with a custom control system which has improved the specifications of the factory and added new features that were not used in existing similar factories to improve the accuracy and factory efficiency. Finally, it was undertaken to abide by recent governmental requirements which have specified very explicit requirements for the accuracy and safety of the factory. This project was undertaken with the goal of deepening the understanding of control systems, applying theoretical knowledge in a real-life situation and applying creative thinking to solve and improve existing problems and systems. The renovation has been considered instead of the modelling a new factory as renovation is much cheaper and more efficient for most companies making it an ideal topic to be discussed. The project was tackled in four steps. The first step was studying the existing factory system and understanding it. Next was the study of the specifications and formatting a plan of action. The third was the implementation stage of the renovation and the control system. Last was the interfacing and control where the interfacing control was added, and the factory was put under trial run. After the modifications and implementation of the control system, it was found out that the accuracy has been improved significantly. Moreover, as of 14th of March, the factory is officially operating.

ii

ii

Synopsis

Several challenges in this topic were faced especially in adapting to the technologies used in factories. For factories, even the standard instruments such as motors will need a significant number of supporting components to work correctly. Similarly, creating systems for large-scale measurements and control is a massive challenge as some hardware variables were interfering with the readings which were later studied and considered which led to other improvements to solve these issues later.

iii

iii

Acknowledgements

Acknowledgements First of all, I would like to offer my deepest gratitude to Dr M. Senthil Arumugam for the continued support and guidance throughout this academic year which has helped me push further to advance my knowledge and improve this project. Next, I would like to sincerely thank all my colleagues who have helped me with various tasks such as proofreading and giving me advice on various topics throughout this year. I would like to also thank Wade Adams Contracting for the chance that was offered for the collaboration on this project which has been a unique chance for me. Their support has pushed me towards a better understanding and advancement of my knowledge and a chance to apply that knowledge practically. Finally, I would like to acknowledge all the help and support from my family throughout this year which has helped to make this dissertation of mine possible

Zaid Samer Al Shattle

iv

iv

Statement of Authorship

Statement of Authorship I, Zaid Samer Al Shattle Hereby state that this project has been my work and has been expressed using my own words and that any help used, and references consulted in any way, shape or form have been probably mentioned and referenced. Moreover, a list of all references is included at the end of this dissertation.

Zaid Al Shattle

v

v

List of Figures

List of Figures

1.1

Schematic of a Wet Mix Plant

2

1.2

Wiring of an old factory's DC motor control

4

2.1

Difference in the application of dry mix and wet mix

8

2.2

Comparison between batch and continuous manufacturing

9

2.3

Design of the old feeder

13

2.4

Design of the old main conveyer belt

14

2.5

VFD to be used for the renovation

17

2.6

Load cell controller used for renovation

18

2.7

Motor contactors for the renovation

19

2.8

PLC used for the renovation

21

2.9

Typical PLC system

23

2.10

Typical DCS system

26

2.11

Scada system example

28

2.12

Inner system of Modbus

32

2.13

PROFINET network

33

3.1

Standard load cell mounting system

36

3.2

Improved Load cell mounting

37

4.1

Layout of a Wet Mix Plant

45

4.2

Stages for the Wet Mix Plant

47

4.3

Flowchart for component activation

49

4.4

Control System Diagram for feeders compensation

51

4.5

PLC Specification

52 vi

vi

List of Figures

4.6

Symbols commonly used for Ladder Logic

53

5.1

Component menu for choosing the component to be added

64

5.2

Main interface of SCADA

66

5.3

Calibration interface of SCADA

66

vii

vii

Publications

Publications A total of 2 publications were accepted for publications with one of being published and available at the moment of writing. With two other publications that are sent for peer review. All publications discussed an aspect of improvement and research. All publications were done in well known and reputable journals and conferences. 1- On the Comparison of various Wind-turbine Load Control Systems for Maximum power tracking using PLC – SCADA. International Conference on Intelligent Sustainable Systems 2017. (ICISS). Published by the IEEE. Accepted for publication. ISBN: 978-1-5386-1959-9 2- Design and improvement of a control system for a wet mix plant with IoT control International Journal of Current Engineering and Scientific Research 2018 Volume 5, Issue 3, Pages 52-57. DOI:10.21276/ijcesr http://troindia.in/journal/ijcesr/vol5iss3part4/52-57.pdf ISSN (PRINT): 2393-8374, (ONLINE): 2394-0697 3- Design and Implementation of a Maximum Power Point Tracking Algorithm for Wind Turbines using PLC-SCADA International Conference on Smart Grid and Clean Energy Technologies 2018 Published by the IEEE. Submitted for publication. 4- On the renovation and automation of a Concrete Wet Mix Plant using SCADA controlled system International Journal of Engineering and Advanced Technology Volume 7, Issue 4, Sent for publication. ISSN:2249-8958(Online)

viii

viii

Publications

Index Synopsis ....................................................................................................................... ii Acknowledgements ................................................................................................... iv Statement of Authorship ........................................................................................... v List of Figures ............................................................................................................ vi Publications ............................................................................................................. viii Index ........................................................................................................................... ix Chapter 1: Introduction ............................................................................................ 1 1.1

Aims and objectives ...................................................................................... 5

1.2

Project description ......................................................................................... 5

Chapter 2: Background Theory ............................................................................... 7 2.1

Cement Stabilizing plant ............................................................................... 7

2.1.1

Types of Cement Stabilizing plants ....................................................... 7

2.1.1.1 Dry / Wet mix plants ............................................................................. 7 2.1.1.2 Continuous / Batching plant .................................................................. 8 2.1.1.3 Stationary / Portable plants ................................................................. 10 2.1.1.3.1 Pros of portable plants .................................................................. 10 2.1.1.3.2 Pros of stationary plants ............................................................... 11 2.1.2 Operation of a Continuous Stationary Wet Mix Plant ............................... 11 2.1.2.1 Control System of the Wet Mix Plant ................................................. 11 2.1.2.2 Hardware design of the Wet Mix Plant............................................... 12 2.1.2.2.1 Feeder stage .................................................................................. 13 2.1.2.2.2 Main conveyer belt stage .............................................................. 14 2.1.2.2.3 Water/Cement stage ..................................................................... 15 2.1.2.2.4 Mixer stage ................................................................................... 15 2.1.2.3 Monitoring and control ....................................................................... 15 ix

ix

Publications

2.1.3

2.2

System Components............................................................................. 16

2.1.3.1

AC motors & Variable speed drives ............................................. 16

2.1.3.2

Load cells & Load cell display controllers ................................... 17

2.1.3.3

Contactors & Solid-State Relays & Overload Relays .................. 18

2.1.3.4

Pumps and flow meters................................................................. 20

2.1.3.5

Trip-systems and Emergency systems .......................................... 20

2.1.3.6

PLC system ................................................................................... 20

Industrial Control System ............................................................................ 21

2.2.1 Discrete Controllers ................................................................................... 22 2.2.1.1 Advantages of Discrete Controllers .................................................... 22 2.2.1.2 Disadvantages of Discrete Controllers ................................................ 23 2.2.2 Programmable Logic Controller ................................................................ 23 2.2.2.1 Advantages of PLCs ........................................................................... 24 2.2.2.2 Disadvantages of PLCs ....................................................................... 25 2.2.3 Distributed control systems ....................................................................... 25 2.2.3.1 Advantages of DCS ............................................................................. 26 2.2.3.2 Disadvantages of DCS ........................................................................ 27 2.2.4 Supervisor Control and Data Acquisition System ..................................... 27 2.2.4.1 SCADA architecture development...................................................... 29 2.2.4.1.1 1st Generation Scada: Monolithic ................................................. 29 2.2.4.1.2 2nd generation SCADA: Distributed ............................................. 29 2.2.4.1.3 3rd generation SCADA: Networked ............................................. 30 2.2.4.1.4 4th Generation SCADA: Internet of things ................................... 30 2.2.4.2 SCADA communication protocols ..................................................... 31 2.2.4.2.1 Modbus ......................................................................................... 31 2.2.4.2.2 PROFINET ................................................................................... 33

x

x

Publications

2.2.4.2.3 OPC .............................................................................................. 34 Chapter 3: Design improvements ........................................................................... 36 3.1 Hardware Improvements .................................................................................. 36 3.1.1 Load cells placement and optimization ..................................................... 36 3.1.2 Addition of safety trip system ................................................................... 39 3.1.3 Replacement to Variable Speed Motors .................................................... 40 3.2 Control System Improvements ......................................................................... 41 3.2.1 Increasing the accuracy of the system ....................................................... 41 3.2.2 Implementation of emergency control & monitoring systems. ................. 42 3.2.3 IoT Scada Integration ................................................................................ 43 Chapter 4: Design of PLC Control System............................................................ 45 4.1 Existing System ................................................................................................ 45 4.2 Design Methodology ........................................................................................ 46 4.2.1 Startup phase.............................................................................................. 47 4.2.2 Calibration mode ....................................................................................... 48 4.2.3 Manual mode ............................................................................................. 48 4.2.4 Automatic mode ........................................................................................ 50 4.2.4.1 Feeder control design .......................................................................... 51 4.3 Factory software design ................................................................................... 52 4.3.1 PLC Choice................................................................................................ 52 4.3.2 PLC programming ..................................................................................... 53 4.3.2.1 Ladder Logic Application ................................................................... 53 4.3.2.2 BASIC programming .......................................................................... 56 4.3.2.3 IOs Layout .......................................................................................... 58 Chapter 5: SCADA System ..................................................................................... 60 5.1 Description of the System ................................................................................ 60

xi

xi

Publications

5.2 Advantages and Disadvantages of the System ................................................. 61 5.2.1 Advantages of the custom SCADA system ............................................... 61 5.2.2 Disadvantages of the system ...................................................................... 62 5.2.3 Overall comparison.................................................................................... 63 5.3 Operation and Design ....................................................................................... 63 5.4 System interface ............................................................................................... 65 Chapter 6: Conclusion ............................................................................................. 68 6.1 Results and discussions .................................................................................... 68 6.2 Issues faced ...................................................................................................... 69 6.3 Future work ...................................................................................................... 70 6.4 Lessons learned ................................................................................................ 70 References ................................................................................................................. 72 Appendix I: Minutes of the meetings ..................................................................... 77 Appendix II: TL7 programming reference ........................................................... 97 Appendix III: I/O Table of the system ................................................................. 128 Appendix IV: Ladder Logic of PLC ..................................................................... 130 Appendix V: Custom BASIC functions for PLC ................................................ 142 Appendix VI: SCADA Code ................................................................................. 151 VI.I Main Program Code ...................................................................................... 151 VI.II Communication Class.................................................................................. 170 VI.III Component Class ....................................................................................... 173 VI.IV Database Classes ........................................................................................ 178

xii

xii

Chapter 1: Introduction

Chapter 1: Introduction

Nowadays the whole world is concerned with making the next new things, Researchers all around the world are working on improving and finding the best smart systems ranging from simple IoT networks to robotics. All those systems share the fact that they are built on control and automation. Those smart systems are commonly used to maximise efficiency by expanding the time when productive action occurs, ensuring no issues occur, and most importantly eliminating (or massively reducing) human error from the system to ensure that the system is working in the intended track even if deviations were to occur. However, one part that many people tend to forget is that the most significant field for automation applications is in the industrial field. With factories requiring precise controls to achieve the best results and the pressure for factories to run around the clock, there is a vast need to eliminate the human aspect as much as possible to improve the efficiency significantly. Those systems of automation have been the driving force behind many of the innovations and research recently. The industry has been moving away from manual control and moving towards fully automating factories since the 1940s. (IEEE Control Systems Society, 2018) Nevertheless, while the technical advancements are rapidly increasing, an issue is widely faced with keeping up with those technological advancements. (Yu, 2017)Technology can sometimes move much faster than anyone can keep up with. Due to that most of the industries are usually very late to integrating new technologies. One other limitation is the cost and downtime. Having to restructure and buy a new factory for each new technological advancement does not make sense economically as the factories have a high startup cost and long lifetimes. Usually, for those factories, they are designed to work for more than 20 years, thus replacing them before that period cannot (Al Shattle & Muthukumaraswamy, On the renovation and automating of a Concrete Wet Mix Plant using SCADA controlled system, 2018) be done as it will cause very major losses. 1

1

Chapter 1: Introduction

A solution does exist however which lies in the field of renovation. A renovation, in general, will lower the upgrade cost significantly, with hardware-based renovations costing less than 30% of a new factory’s price (Yu, 2017). However, 30% of a factory is not a small amount as factories are very expensive. Thus, the other solution is to focus on the control aspect of the factory. Those changes involving the control system and minor modifications will only cost 5-10% of the total cost of the factory which makes them much more economical (Al Shattle & Muthukumaraswamy, On the renovation and automating of a Concrete Wet Mix Plant using SCADA controlled system, 2018). Considering old factories, many of them use simple manual control. Implementing a control there with proper feedback will increase the factories stability and accuracy significantly (Liu, et al., 2015). A more proper solution can improve those values more. So new improvements and systems will be looked at to improve the factory. For those reasons many types of research are considering topics related to improving factory efficiency, and many breakthroughs were found in that field. That is also one of the reasons considered for undertaking this project, Programming Instruments and Control Systems for a Factory with Customizable SCADA system. The factory we are concerned about is well-known as Cement Stabilizing Plant or Wet Mix Plant. That factory is a plant that is specialised in creating cement mixes by controlling several feeders while controlling cement and water to get the required mix.

Figure 1.1 Schematic of a Wet Mix Plant (Deligiannis & Manesis, 2007)

2

2

Chapter 1: Introduction

Figure 1.1 shows a typical schematic diagram of a Wet Mix Plant showcasing the primary stages of the plant (Deligiannis & Manesis, 2007). This dissertation will be concerned about three main topics: Hardware renovations, Control System Design & Implementation and SCADA design and integration. One of the main difficulties of creating a control system for industrial equipment Is the massive scale of the equipment. Because of the high-power requirements for things like the inductions motors and the load cells, and other industrial components, it is challenging (or sometimes intolerable) to connect such devices directly. Instead, they are used with layers of protection such as overload relays and contactors. Those complications add to the difficulty of hardware configuration, programming, and setup of the factory. Another difficulty is the complexity of the system connections as there will be a need multiple numbers of controls to achieve a simple task. For example, a simple belt movement might need multiple blocks of control to control the motor and be able to switch the motor controls from star to delta, control the speed and other aspects. This should be done by continually monitoring every change while making sure that all operations are happening in sequence and at the correct timing. Lastly, The process must be applied to every part of the factory while connecting all the components together. Thus the sheer complexity of the control system starts to rise as more parts are interconnected requiring the design of subsystems which will later be interconnected as well. After the control system is done, another side to be considered is the interfacing side, as a vast number of controls required need a considerable number of wires, controls and display components. A few factory visits to older factories showed how the excess amount of wires and unneeded hardware controls could cause the maintenance to become way too difficult and sometimes impossible to manage and is one of the top causes for issues to pop up.

3

3

Chapter 1: Introduction

Figure 1.2 Wiring of an old factory's DC motor control

Figure 1.1 shows an old factory using DC motor control. Excessive wiring used makes troubleshooting and maintenance very difficult. Some of the connections were replaced and renovated which has reduced the wiring for the right section of the control panel. Thus, moving to a move digital interfacing using SCADA connected to the IoT helps not only make the control more accessible but also helps with reducing additional controls. Leaving only the bare minimum hardware controls for emergencies. Another topic discussed is the improvement of the existing system. A study was made to compare existing systems, and a few new vital modifications were found which were of great success to improve the system. Those modifications were discussed in two publications related to this project, one in a conference by the Instituate of Electrical and Electronics Engineers (IEEE) for the hardware improvements and a journal in the international Journal of Current Engineering and Scientific Research (IJCESR). Both publications discussed the control system modifications and

4

4

Chapter 1: Introduction

improvements. All improvements discussed were researched and tested on the system and are currently fully operational.

1.1 Aims and objectives This project was assumed with several aims and objectives for the success of the project which are: -

To design and practically implement a control system that is stable and will work on the actual factory.

-

Studying and understanding the industrial equipment standards while conferring to the safety standards.

-

Researching how the current factory works and how similar systems operate while trying to find improvements to improve safety and accuracy of the factory.

-

To connect the control system of the factory with an interfacing system that is connected to the IoT.

-

Development of a new custom SCADA program that’s easy to use for users and has support for multiple PLC architectures.

-

Getting the factory accepted for the governmental standards by making sure that all the requirements are met.

These goals were the central point of the development of this project. This project will have a focus on both theoretical and practical aspects of the project. The factory will be designed and then modified at implementation accordingly to be used for actual production.

1.2 Project description This project will be concerned with the renovation of a factory in Jabal Ali, With the collaboration of Wade Adams Contracting the system will be developed and applied to the factory and then accordingly tested. The factory considered is a 30 years old continuous Wet Mix Plant (Also known as a Cement Stabilizing plant). It is a plant that uses hardware calibration, which means 5

5

Chapter 1: Introduction

that calibration can only be done manually by adjusting the mechanical structure, the factory uses manual control and has no feedback elements what so ever. For the hardware renovations research has been done and tested for different systems and adjustments, the focus has been on minimum hardware changes to reduce the costs. Those solutions have been researched and published and finally tested (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018). The solutions include more proper load cell placement, replacing of hardware calibration with speed-control calibration and adding safety trip systems to the factory. Next is the control system design. The system has been modelled and designed, then implemented using a PLC controller to the system. The control system was designed to: -

Allow the factory to be automated.

-

Enable manual control to the system if required.

-

Implement safety procedure by adding an alarm system before the operation to avoid accidents for the personnel on site.

-

Use a feedback loop to minimise error and increase the accuracy.

-

Add an emergency system to stop the factory operation correctly in cases of emergency.

Lastly, a SCADA system will be developed for the factory, the program used will be a unique customizable system which is aimed for simplicity of design to allow smaller companies and projects to be implemented much more straightforwardly. This system has been developed and used for several applications and publications related to this project (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018) (Al Shattle & Muthukumaraswamy, On the renovation and automating of a Concrete Wet Mix Plant using SCADA controlled system, 2018) (Al Shattle & Muthukumaraswamy, On the Comparision of various Wind-turbine Load Control Systems for Maximum power tracking using PLC - SCADA, 2017).

6

6

Chapter 2: Background Theory

Chapter 2: Background Theory

2.1 Cement Stabilizing plant A Cement Stabilizing plant (also known as a Mix plant or a Concrete plant) is a factory that mixes several different aggregates. Those materials will be mixed with cement to create a mix (Such as concrete) that can be used for roads or construction (Wade Adams Contracting, 2017) (Iowa DNR Government, 2018). Nowadays concrete is the most used material in the world. The material, which fell out of use until the 18th century, is now the base of most modern construction. It has some useful properties such as being very durable (with up to 100 years of service time). Other features such as being resistant to erosion and weathering, being very energy efficient with up to 20% total saving of lifetime operation or up to 29% when combined with active heating and cooling systems increase its popularity and usage. Lastly, it is safe and well known to engineers and designers alike (Chemistry World, 2008). The Concrete plant is used to create concrete mixes as per the requirements, which are then used for buildings, driveways, basements, and roads (Country Materials Corporation, 2016).

2.1.1

Types of Cement Stabilizing plants

Cement plants can be classified in many ways depending on the classification criteria, and can be thus be classified depending on: -

Type of Mix (Wet Mix / Dry Mix)

-

Type of Operation (Continuous Mix/ Batching Plant)

-

Type of location (Stationary/ Portable)

2.1.1.1 Dry / Wet mix plants There are two major types of mixes, Wet mix, and Dry mix. The difference between them is the stage where water is added to the mix. A wet mix plant will have water

7

7

Chapter 2: Background Theory

added during the mixing process. This process causes the mix to be high quality and will be easy to use. Similarly, a dry mix is also used to create concrete. However, it does not add water during the process but instead will have the dry mix transported in a mixer truck to be moved to the location where concrete is required (Zayed & Halpin, 2001) (Ferraris, 2001). Figure 2.1 shows the difference in how Wet-Mix and Dry-Mix are used after productions. Wet-Mix can be used directly, while Dry-Mix must be used by adding water before applying.

Figure 2.1 Difference in the application of dry mix and wet mix

Some of the issues of a dry mix are the limitation of the quality of the mix, since mixing trucks are used they are not able to mix as thoroughly as the ordinary mixer as the mixing truck will only depend on the dropping action of the mixer blade (Ferraris, 2001). Using a dry mix is sometimes required when concrete is needed at a location where no production is possible. For most situations, however, it is both cheaper and more efficient to use a wet mix plant near the site.

2.1.1.2 Continuous / Batching plant When discussing the methodology of working there are two main types of concrete plants, continuous and batching plants.

8

8

Chapter 2: Background Theory

Batching plants operate by having the production work in “batches” where all material will be calibrated and produced. Meanwhile, a continuous plant will work on having a constant production line during the entire operation period.

Figure 2.2 Comparison between batch and continuous manufacturing (Process Systems and Design Blog, 2017)

Figure 2.2 showcases the difference between continuous and batch manufacturing and their applications. When discussing the advantages and disadvantages of such system, the main differences are the quantity and the quality of the mix. Continuous plants will be able to output much more materials of around 300 to 500 Tons per hour (Ton/h) while batching plants would only output 150 to 300 Ton/h (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018). This increased output will come at a lower cost for the production because of the simplified system design as continuous plants have a much more straightforward factory layout (Misajet) (Ferraris, 2001). However, some of the issues of the continuous patching plant are the quality control, because of the constant production system it is very prone to errors as it is not as tightly controlled like a typical batching plant (Marini Fayat Group, 2003). Another issue is that because of the constant design there is a lack of a pollution control unit which

9

9

Chapter 2: Background Theory

means that pollution and dust will accumulate on the plant because of the falling materials (Wade Adams Contracting, 2017) (Ferraris, 2001) (Marini Fayat Group, 2003). Finally, because of the design of the system, a more intricate control system is required to operate the system correctly as an accurate measurement system is required especially at the beginning of the operation to prevent significant errors to the mix (Marini Fayat Group, 2003). Overall continuous plants are more used for smaller deliveries which can usually be close to the production site where there is a more significant focus on the quantity. Likewise, batching plants are used for larger projects with an emphasis on the quality of the mix and the flexibility of the final mix (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018) (Ferraris, 2001).

2.1.1.3 Stationary / Portable plants Portability wise there are two main types of plants, Stationary and portable plants. Portable plants are very easy to move and install where needed. However, there are both pros and cons for both systems:

2.1.1.3.1 Pros of portable plants Compact and complete structure: having a complete structure that includes all processes from storing, weighing, transporting, mixing and controlling. Convenient to move: Having a structure with a pulling type movement is very easy to move to the location required Quick Installation: The process of installation for a portable plant is very quick which means it is possible to get quick production going at a very high speed. Reduced transportation costs: Having a portable plant means that the plant will be at the same location as the construction itself which will reduce costs of moving both concrete and the materials required for the mix (Haomei Batch Plant, 2018).

10

10

Chapter 2: Background Theory

2.1.1.3.2 Pros of stationary plants Environmental protection: All the processes work in a more controlled and closed situation which makes it much easier to control the byproducts of the process. Better Mixing Performance: Due to the use of a twin horizontal mixer shaft it has a higher mixing capability. Easy Operation and Maintenance: Due to the structure and design of a stationary plant it is both easier to control, and it is also easy to maintain as platforms, and service ladders are installed at all points of interest. More accurate measurement systems: For the system using the fixed structure it is usually constructed with higher quality measurement equipment which improves the accuracy of the final mix (Haomei Batch Plant, 2018).

2.1.2 Operation of a Continuous Stationary Wet Mix Plant In general, for a continuous stationary wet mix plant three primary sides of the operation will be discussed: -

Control system operation

-

Hardware operation

-

Monitoring and control operation

2.1.2.1 Control System of the Wet Mix Plant For a wet mix plant, in general, there will be four feeders which will feed materials into the main mix. Later on, they are mixed with both cement and water to create the final mix as required. Those materials will be fed to the conveyer belt which will deliver them into the throw belt, which later on takes materials to the mixer for those materials to be unloaded onto the truck.

11

11

Chapter 2: Background Theory

A control system needs to be implemented which will be able to -

Include an automatic control mode to run the factory independently

-

Include a manual control mode for manual operation & troubleshooting

-

Installation of an alarm system for the safety of workers during startup

-

Include a feedback loop for the feeding system to decrease the error percentage

-

Implement an emergency stop function for health and safety enquiries.

A simple control system is already existing in the factory that uses manual mode of operation. However, the system will be entirely replaced (Wade Adams Contracting, 2017). During the shutdown, the system must shut down in the reverse order and not immediately (Iowa DNR Government, 2018). That will help the residue materials be cleared and will allow the current mix to be as least affected as possible by decreasing the chance of unwanted materials affecting the current mix (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018) (Wade Adams Contracting, 2017). For emergencies, however, the system will stop the point of emergency while keeping all the next points running for the same reasons (Al Shattle & Muthukumaraswamy, DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL , 2018). The existing system was lacking feedback control elements throughout the factory causing the system to have a very high error percentage and to be lacking in safety configurations (Wade Adams Contracting, 2017).

2.1.2.2 Hardware design of the Wet Mix Plant Overall for the plant, there are four main stages to be discussed, the first stage is the feeder stage. During this stage, the materials will be fed from the hoppers while being measured they will be fed towards the second stage which is the belt stage where materials will

12

12

Chapter 2: Background Theory

be moved accordingly, the third stage is the cement stage where concrete will be added to the mix. Finally, the last stage is the mixer stage where the mix is thoroughly mixed with water added then unloaded to a truck for usage accordingly.

2.1.2.2.1 Feeder stage In the primary structure of the old factory, there are four main feeders which are used to feed materials into the main belt. In the original system, constant speed with a manual gate calibration is used to control the amount of each material’s flow. The gate of the feeders’ opening is calibrated by partially opening it enough for a certain amount of materials to be allowed to flow. There is no feedback or speed control in the existing factory which creates an issue which makes detecting errors reasonably tricky unless very major. Figure 2.3 shows the previous design of the feeder, alongside the motor used.

Figure 2.3 Design of the old feeder

That will affect the mix quality since there is no way to detect any small issues in the mix which can be a massive factor for concrete mixes as it can decrease both the strength and durability with a huge factor (The constructor, 2018). Also due to the need for manual calibration, it will need a full factory shutdown for health and safety reasons which is a very time-inefficient and costly procedure.

13

13

Chapter 2: Background Theory

Lastly, due to operating at high speed the materials loading and unloading at the belt as well as the materials being hit by the gate will cause a tremendous amount of friction on the belt. That friction causes the lifetime of said belt to be much shorter as it will tear much more easily (Harrison, 1984) and will also increase maintenances downtime and costs.

2.1.2.2.2 Main conveyer belt stage After the feeder stage, the materials are loaded into the main belt. The belt will collect the materials from all the mixers while driving them up to the throw belt. Figure 2.4 shows the design of the existing conveyer belt.

Figure 2.4 Design of the old main conveyer belt

The main issue of the current design of the main belt is lacking any method of validating the complete mix state, as the feeder might not be unloading all materials into the belt if there are any issues in the previous stage such as incorrect loading to the belt or if the belt is damaged. The other issue is that large rocks can cause significant damage to the belt if they get stuck and cut end up completely cutting the belt (Aldrich & Zhang, 2014) (Komander, Hardygóra, Bajda, Komander, & Lewandowicz, 2014) which would create a huge loss for both the replacement and the downtime caused.

14

14

Chapter 2: Background Theory

2.1.2.2.3 Water/Cement stage After the belt has taken the materials from all the feeders cement will be added to the system, there is no way to get the status of cement or water without manually checking (Wade Adams Contracting, 2017). Rotary Valves are adjusted to control the flow of cement, the cement will then be unloaded to a weighing belt for measurement. A water pump will also exist near the mixer to add water to the mix. A valve will control the amount of water going to the mix. There are no systems for detecting any leakages especially if it is a partial leakage as that will severely affect the quality of concrete (The constructor, 2018).

2.1.2.2.4 Mixer stage After the materials are loaded to the belt, they will move towards the main mixer. The main mixer will proceed to mix the materials and dump them into a loading truck. Initially there are no controls to detect if the truck is full or close the gate of the mixer. Instead, the system depends on a total stop of the entire cycle to halt the loading procedure and said process must be done by manually adjusting the gate of the mixer as it is a continuous plant which means that process does not stop unless manually stopped or there are no longer enough materials.

2.1.2.3 Monitoring and control For the old factory, most of the control is done directly by hardware switches and interfacing. Older factories using older technology will suffer from issues especially for panel wiring as the lack of a central control unit will make wiring very difficult and messy and will thus increase the costs of both installation and maintenance of the system.

15

15

Chapter 2: Background Theory

The monitoring would usually be limited to having basic gauges that might display data such as water pressure which is usually not sufficient to detect minor impurities but necessary to find significant faults during operations. Control wise the factory is very dependent on the operator as there is no automatic function mode and all controls are done by timing the system correctly which for a skilled operator can improve the quality of the mix significantly (Cazacliu & Ventura, 2010).

2.1.3

System Components

There are several components which will be used during the renovation of the system which will be discussed in detail below:

2.1.3.1 AC motors & Variable speed drives To replace the existing dc motors in the system the usage of ac motors has been proposed to add speed control to the system, the component which provides most of the control is the Variable Speed Drive (VSD). ATV212HU40N4 from Schneider will be used, which is a 4kW - 5hp - 480V VSD.

16

16

Chapter 2: Background Theory

Figure 2.5 VFD to be used for the renovation

Figure 2.5 shows the VFD to be used during the renovation to control the speed of the motors. The biggest advantage of the VSD is the ability to change speeds freely without the need for steps, unlike the DC motors where a control circuit must be developed and set up for a specific range of inputs. AC motors are much easier to find and are overall cheaper currently while being much easier to control which makes them a good choice to be replaced.

2.1.3.2 Load cells & Load cell display controllers Loadcells will be used to measure the weights and values of the mix during operation. To take the values from the load cells and use them we need a loadcell display. A load cell display is used to calibrate the load cells in the system and display their data; they also include ADCs which will convert the value of the load cell and transfer it to the PLC.

17

17

Chapter 2: Background Theory

Figure 2.6 Load cell controller used for renovation

NT2-L-ANI-0-0-R-AC-CAP by London electronics will be used as the loadcell display for the system which can calibrate by either voltage or current. Figure 2.6 shows the load cell display controller used. It can take samples and display all statistics such as the peak/median and other data for the values. As well as transfer data from and to the PLC.

2.1.3.3 Contactors & Solid-State Relays & Overload Relays Contactors will be used in the system for a few reasons; the main reason is the connection of various components such as the power sources, motors, and their controls. One of the other reasons is to allow the use of Star-Delta starters which will massively reduce the current at startup to a third since the current in star-configuration is a third of the current in delta-configuration (Parmar, 2012).

18

18

Chapter 2: Background Theory

Figure 2.7 Motor contactors for the renovation

LC1D18 displayed in Figure 2.7 by Schneider Electric will be used in most of the factory unless specified otherwise. Solid state relays will be used to switch on and off for the components of the system. Since the PLC is unable to handle the voltages and currents used by the equipment of the factory the SSRs are used as an interfacing unit between the controller and the components of the factory. They are also used for protection shutdown of the system (Verma, Gupta, & Mahapatra, 2015). REL-MR- 24DC/21 – 2961105 by Phoenix contacts will be used as the SSR for the system. Finally, overload relays are used to protect the motor in cases of overload or phase failure. The circuit will use GV2 ME by Schneider for the protection circuits.

19

19

Chapter 2: Background Theory

2.1.3.4 Pumps and flow meters The system will be using pumps for water and cement; the flow will be controlled and monitored using a flow meter. Due to the importance of very accurate measurement of both water and cement extra attention has been put towards the choice of equipment for both those fields, the pump used is a 4kW pump

2.1.3.5 Trip-systems and Emergency systems A limit-switch trip system is installed to detect the rocks. The systems are installed and are connected directly to the PLC. Any faults found through either the trip system or the emergency system will not be automatically cleared until the engineer in charge of the area manually checks and clears the fault

2.1.3.6 PLC system A PLC is connected to the system and will be used to both control and monitor the system. The PLC will be connected to a SCADA interface throughout the Modbus protocol. Details about the PLC-SCADA integration will be discussed later in this report.

20

20

Chapter 2: Background Theory

Figure 2.8 PLC used for the renovation

The PLC provides an easy way to control and connect all the components and will reduce the wiring significantly. The PLC chosen for this project is Fx1616-BA. That PLC is a special edition of the PLC that is focused on automation (Fx1616-build automation) having 32 standard IOs (which were expanded to 256 IOs) with eight analogue inputs and four analogue outputs. Figure 2.8 shows the PLC (left) alongside the extension module (right). The system is programmed using Ladder+Basic which mixes the ladder logic of the program with BASIC programming.

2.2 Industrial Control System For industrial applications, there are a few control system architectures to use. As each architecture has its structure, pros, and cons. Most modern systems are usually a mixture of some of those types (Stouffer, Pillitteri, Lightman, & Marshall Abrams, 2015).

21

21

Chapter 2: Background Theory

Those types are: -

Discrete Controllers

-

Distributed Control System

-

Programmable Logic Controllers

-

SCADA systems

2.2.1 Discrete Controllers Discrete controllers are the most basic building unit of industrial controllers. Basic Discrete controllers will have one loop (Beek & Rooda, 1997). Discrete Controllers provide direct control for instruments, an example of that is temperature controller. A discrete temperature controller will be able to adjust an external variable (air conditioning for example) depending on the temperature applied (Soto, Lozano, & Hernandez, 2014) Those systems usually are set up to be easily manually controlled if needed. However, in cases of complex systems, the number of control loops might increase massively making the system unsustainable (Soto, Lozano, & Hernandez, 2014).

2.2.1.1 Advantages of Discrete Controllers The main advantage for discrete controllers is the simplicity of the system. Many applications such as temperature control or a simple dc motor speed controller do not need very complicated controls. It is thus preferable to use pure discrete controllers in those systems as they have both a faster response, a lower price and much more straightforward circuitry (Soto, Lozano, & Hernandez, 2014). Discrete Controllers can be bought directly to do a specific job and can be used instantly without much prior configuration which makes replacing them or troubleshooting them easy for the individual components. Those controllers can have multiple systems for control such as digital, proportional and PID controllers (Supervisor & Taha, 2013).

22

22

Chapter 2: Background Theory

2.2.1.2 Disadvantages of Discrete Controllers When discussing discrete controllers, the most prominent issue is flexibility. Since most discrete controllers are designed to do a specific task an issue arises where changes of the system can be very difficult. Another critical issue is complexity. While having controllers can be cheaper for smaller applications, most massive projects will cause the overall structure to be much more complicated and will thus cause the system cost and maintenance to increase massively (Haque, Hassan, & Hossain, 2014). Finally, Discrete controllers usually lack a central system to communicate and display data with. Manual interfaces can be designed but it will be very difficult and time consuming.

2.2.2 Programmable Logic Controller Programmable Logic Controllers (PLCs) are the modern core of any industry. They are usually a system that can take in a set of inputs to create a set of outputs as required. PLCs were designed as a replacement to the old multiple relays design approach.

Figure 2.9 Typical PLC system (Control Systems USA, n.d.).

23

23

Chapter 2: Background Theory

Figure 2.9 shows a typical PLC system consisting of gas detectors (Inputs), control valves and motors (Output), SCADA system and Operating Panel as an interfacing element. PLCs are usually designed to be resistant to natural elements to work reliably. Inputs and outputs of the PLC are usually either Digital (such as limit switches, switches, and other similar components) or Analog (Temperature sensor, Light Sensor, etc.).

2.2.2.1 Advantages of PLCs The main advantage of a PLC is its flexibility, being able to modify the system at runtime reliably help fix issues that might pop up. It will also give a chance for additions to the factory with minimum (or sometimes no) modifications to the existing control system. Another advantage is that PLCs is that they are usually ruggedized. As PLCs are expected to work reliably they are designed with the resistance to basic natural elements such as dust, water and temperature. They also have many backup elements to both reduce the down-time alongside with ensuring proper shutdown measures are taking. A PLC will also be easier to implement and control. Having one central unit reduces the programming needed and makes the entire process much smoother. That will also reduce the cost of the plant (Laughton & Warne, 2003). Another advantage of PLCs compared to more complicated systems such as distributed control systems (DCS), which will be discussed later, is response speed. While having a slightly slower response than discrete controllers it is still very fast. Which is why a separate PLC controller is usually used for emergency systems at huge plants (Automation World, 2014). Finally, PLCs are relatively low cost compared to the alternatives and will make implementation both cheaper and faster for most medium-sized projects.

24

24

Chapter 2: Background Theory

2.2.2.2 Disadvantages of PLCs While PLCs have many features, which causes it to be very attractive for many projects, it is not without its own faults. One of the biggest issues is scalability. PLCs in general can handle a few thousand inputs/outputs (IOs). However, for many larger projects the size and complexity will be unachievable using a single PLC. For those systems it can be very difficult to troubleshoot issues reliably. Another issue is that while PLCs are cheaper they have some severe limitations especially when considering non-uniform inputs and outputs. PLCs are designed to work at a specific range of powers and settings most of the time. For larger projects trying to adapt solutions for multiple inputs might arise the cost of the solution significantly. Finally, a PLC is a central-control scheme. What that means is that a PLC has a central unit that will do all the processing. Any issues with that unit will cause the entire system to go down for a long down-time. Making some faults difficult to solve in a short duration.

2.2.3 Distributed control systems Distributed control systems (DCS) were designed as an answer to an issue for huge industrial systems. For applications requiring complex systems while also needing to retain a level of safety while minimizing the costs, none of the existing systems were able to fit that criteria. DCS work by splitting the processing into several levels (generally from zero to four) and assigning a part of the process to each level. Level zero will be the field equipment such as temperature sensors and direct controllers. Level one includes the IO modules and their controllers. Level two is the individual control devices that will control the operation of each subsection. Levels three and four are concerned with supervision and process control respectively.

25

25

Chapter 2: Background Theory

Figure 2.10 Typical DCS system (Pugliesi, 2014)

Figure 2.10 shows the different levels of a DCS and what they usually present. Unlike PLCs which depend on having a central unit of control a DCS usually has separate subsections that are directed by the main unit, but not directly controlled. In other words, it can split the system for easier maintenance and troubleshooting.

2.2.3.1 Advantages of DCS DCS’ advantages lay in the scalability of the system. DCSs are designed with huge plants with tens of thousands of IOs in mind. Having a separate controller for each subsection means that implementation can be done more conveniently with a lower overall cost (Automation World, 2014). Another of the major advantages of DCSs is the fact it does not rely on a single central device. In Central Control Systems (CCS) such as PLCs any issue in the central unit will cause the entire plant to go down. DCSs are designed with the intent that each sub-section can work independently if needed even if other parts are affected. The subsections structure can thus make maintenance and troubleshooting much easier. Due to having less field wiring at each specific location and having issues only shut down a certain subsection that helps narrow down the locations of faults significantly (Control Global, 2003) (Shekhawat, 2014).

26

26

Chapter 2: Background Theory

Finally, DCSs are very cost efficient on the long run due to all the previous advantages lowing downtime significantly (Shekhawat, 2014).

2.2.3.2 Disadvantages of DCS While DCSs are usually cost effective, it is only more cost effective than PLCs for large systems above a few thousand IOs. Due to having many layers and interfacing sections in the middle it can slow down the overall process significantly. That is especially true for smaller systems where the interfacing delay can be much larger than the delay of the equipment of the factory itself (Automation World, 2014) (Shekhawat, 2014) Another disadvantage is that having more layers of processes mean that there will be a much higher software development cost in order to design and construct all individual points while connecting them at the same time (when they might have different system architectures) Finally having many layers for communication to go through might cause some issues where some information might be corrupted or stolen. However modern technology has been catching up on making communication much more secure and reliable (Instrumentation and Controllers, 2011).

2.2.4 Supervisor Control and Data Acquisition System A Supervisory Control and Data Acquisition System (Also known as SCADA system) is an architecture that is more concerned with the interfacing and monitoring aspect of the control. Unlike the previous systems it is not a standalone system that is built to run the factory as a basis but instead is an additional architecture that can be used with a PLC or a Discrete Controller for example. SCADA systems use Graphical interfaces (GUIs) to display the current data of the factory. It then offers high-level processes control and supervision. In other words, it will allow for control of the expected end results (such as the level of production or the speed of the production) instead of the fine details (how each sub-process is used). The system then will automatically adapt the changes to the user requirements. 27

27

Chapter 2: Background Theory

The monitoring and issuing of commands is usually controlled by the SCADA computer while the actual changes in the system are calculated and performed by the controller itself (Boys, 2009).

Figure 2.11 Scada system example (Industive Automation, 2018)

SCADA systems can be connected with many networking protocols to allow for remote access over a variety of devices as needed which makes it very accessible usage-wise. Figure 2.11 shows an example of how the system can connect sensors and inputs to the interfacing unit at either the plant or a workstation. Those properties mean that the SCADA system is one of the most common interfacing control system in use nowadays. That feature however does cause some concerns towards the safety and security of said systems due to dangers of online malware and viruses (Boys, 2009) (Kirti, 2014).

28

28

Chapter 2: Background Theory

2.2.4.1 SCADA architecture development Overall when talking about the development of SCADA systems there are four main generations that are considered (Russel, 2015): -

Monolithic

-

Distributed

-

Networked

-

Internet of Things

2.2.4.1.1 1st Generation Scada: Monolithic The first generation of SCADA was mostly designed to use minicomputer. At that time there was no network protocol standards which meant that each company had their own custom networking protocol. During the time of the 1st generation the protocols were much more strict and interconnecting systems was almost impossible bar exceptions. SCADA backups during that generation were using a complete mainframe which is connected to the remote terminal units (RTUs) of the system. During that time SCADA in general had a higher cost and very limited connectivity. Only serving for limiting hardware options with no way of intercommunication.

2.2.4.1.2 2nd generation SCADA: Distributed During the 2nd generation of SCADA an important improvement was considering. That improvement was the distribution of the SCADA control and RTUs over multiple stations which are connected in a Local Area Network (LAN). During that time information was connected almost instantly. Even though there was an advancement of the connection methods, no protocol standards were in place yet. Security in general was not considered at this stage. Since

29

29

Chapter 2: Background Theory

all network protocols were proprietary only the developers and very limited amount of people would be knowledgeable about the workings or security of said systems. The methods of distribution caused a drop in the cost of the system which made the application of SCADA more accessible.

2.2.4.1.3 3rd generation SCADA: Networked After the 2nd generation of SCADA the importance of networking was being noticed which caused the first standard protocols to be created. During this period complex SCADA systems were able to be broken down to their basic components and be interconnected through multiple network. That process is known as Process Control Network (PCN). Said network architectures can consist of several SCADA systems running in parallel with a supervisor unit. Those processes allowed for a much more economical solution especially for much larger solutions. Which started pushing SCADA systems to be mainstream.

2.2.4.1.4 4th Generation SCADA: Internet of things With SCADA systems getting more commercially available the push to the Internet of things (IoT) adaptation was increasing. However, it was only with the availably of the cloud computing’s increase did it start the push for the 4 th generation of SCADA. The 4th generation of SCADA depended on open protocols for communications. Those protocols not only made the networking of peripherals easier, but also made the connection more secure. The concept of the IoT pushed SCADA towards decentralizing the data of the system. That process caused a major change of how the system behaves as IOs are not directly mapped one to one, but instead other methods are used accordingly.

30

30

Chapter 2: Background Theory

2.2.4.2 SCADA communication protocols Right now, there are many SCADA communication protocols which are used. However, for the sake of this discussion a few major protocols are considered which are: -

Modbus

-

Process Field Net (PROFINET)

-

Open Platform Communications (OPC)

There are many other protocols which are specific to a specific application (for example, BACnet for home automation) but they are less commonly used than the general protocols listed above (Optomux, 2012).

2.2.4.2.1 Modbus Modbus is one of the earliest communication protocols for PLCs/SCADA systems. Nowadays Modbus is the most common communication protocol for connecting industrial applications. Modbus uses serial communications over either universal serial port (USB) or by using TCP/IP with small differences in the format as the TCP/IP method does not require checks for the data (Modbus-IDA, 2006). Reasons for the preference for Modbus are: -

Modbus was designed with industrial applications in mind

-

Modbus is an open protocol that is royalty free which makes applying it much easier

-

Modbus is very easy to deploy and use

-

Modbus doesn’t have many restrictions on the vendors

However, there are a few minor issues with Modbus which are: -

It is limited to data types supporting at the time of creation (1970s) which means that many modern data types might face issues such as large binary values.

31

31

Chapter 2: Background Theory

-

Modbus has a hard-limitation of 254 devices connected at the same time due to how the signal is coded.

-

Modbus doesn’t feature any security features for the data sent and received (Palmer & Shenoi, 2009).

-

Modbus communication is through serial which causes its speed to be relatively lower. (Up to 100 ms)

Figure 2.12 Inner system of Modbus (Pimzos, 2018)

Figure 2.12 shows how Modbus systems work using TCP master servers as well as RTU slave terminals.

32

32

Chapter 2: Background Theory

Overall Modbus is the most common protocol for its simplicity and its reliability, but it fails on some of the more complicated and modern applications. For most projects which do not need those features or the very quick response however Modbus offers a very great choice. 2.2.4.2.2 PROFINET PROFINET is one of the more modern communication protocols. PROFINET was designed with the goal of being efficient every in very tight time constraints. In general, there are 3 main layers in PROFINET communication methods: -

TCP/IP which is for general communication with the plant which are not time critical. With an expected response time of 100ms

-

Real Time (RT) protocol for IOs, with an expected response of 10ms

-

Isochronous Real Time (IRT) for drive systems and emergency systems, with a response of 1ms.

Overall for all methods ethernet communication is used. PROFINET design allows easier access for larger applications as the complete system is distributed in an easier way to access compared to Modbus with no limitation on the number of connected devices.

Figure 2.13 PROFINET network

33

33

Chapter 2: Background Theory

Figure 2.13 shows how a typical PROFINET network would be constructed. Advantages of PROFINET are: -

Standard IOs and diagnosis for issues

-

Much more robust

-

Safe and cheap installation

-

Able to communicate with field instruments through the bus (Ethernet)

-

Can achieve very low response times (up to 1 ms)

Disadvantages however are: -

Harder to implement than Modbus.

-

It is not open-source

-

A bit more complicated than Modbus

Overall PROFINET is a great choice for most industrial applications. However, for smaller applications where access to a lower number of devices is concerned where speed is not critical it might be cheaper and easier to implement Modbus.

2.2.4.2.3 OPC OPC

is

a

group

of

communication

standards

designed

for

industrial

telecommunications. Unlike PROFINET or Modbus, OPC was not designed with automation as the only goal. Instead OPC was designed to be a general protocol which can be networked with any other standard (OPC UA, 2018). OPC can interface with .Net framework, XML, or even Java. It is designed for communication with some peripherals which might not be used normally with the same protocol for automation (UA, 2002). The advantages of OPC are: -

Provides a common bridge between control hardware and computer systems

-

Provides support for modern data types

-

Uses modern communication methods for multi-user connections without impacting the user.

34

34

Chapter 2: Background Theory

-

Can be used to interface industrial appliances with non-industrial components.

However, the disadvantages are: -

Relatively slower than both Modbus and PROFINET.

-

Is a very young technology that was not tested as much as the previous technologies.

Overall OPC is a young technology that shows promise for larger applications and projects where interconnection with normal appliances might be needed such as home automation. However, it will need time to be tested and tried for more in-depth feel for issues, etc.

35

35

Chapter 3: Design improvements

Chapter 3: Design improvements

3.1 Hardware Improvements In the plant there are both hardware and software improvements which were applied. Those improvements are divided into hardware and software improvements. The hardware improvements are: -

Addition & Optimization of Load cells for measurement

-

Addition of a safety trip-wise system

-

Replacement of motors with a controllable speed motors

3.1.1 Load cells placement and optimization According to very recent upcoming GCC laws all factories for Cement mixes must have an accurate measurement system to show the data and report a mix’s quality. For those reasons a load cell measurement system was added. However, it was designed with several improvements in mind. In standard systems loadcells are placed on the feeder itself, however that presents a major issue where having a shorter belt with high load on the belt due to the feeder’s weight causes the results to be relatively inaccurate as the belt is not lying directly on the load cell.

Figure 3.1 Standard load cell mounting system

36

36

Chapter 3: Design improvements

That change is not linear which makes a compensation system hard to implement with very complex modifications to the system (Hidden, 1973). Figure 3.1 shows how the tension will be created at the system from the weight and the belt length. Much of that error is because of the belt length and weight on the belt (Donis, Rachkovskii, & Sin). Thus, to solve that issue changes in the placement of the belt were recommended (Al Shattle & Muthukumaraswamy, On the renovation and automating of a Concrete Wet Mix Plant using SCADA controlled system, 2018). The solution includes movement of the load cells from the standard placement at the feeder to the main belt. That change in placement causes the tension on the belt to be up to 90% less as the belt is much longer and the weight applied will be much less. The main belt is 14 meters long with only the weight of each component of the mix of around 20 to 30 kg applied which will result in less tension error (Donis, Rachkovskii, & Sin). Unlike the feeder belt which is 2 meters long with the entire hopper’s contents weight of 15 tons on parts of it. In the end of the design the accuracy has been increased from ± 1kg to ± 0.5kg.

Figure 3.2 Improved Load cell mounting

Figure 3.2 shows how the proposed system is to be installed and its benefits.

37

37

Chapter 3: Design improvements

This change also allowed to find faults in the load process such as materials not falling onto the belt as the measurement shows the result rather than a point in the middle. Due to the uncommon placement of the load cells a different weighing system was needed to calculate the weight at each point. Assuming 4 points where the weight will be taken in a continuous system it is not possible to take readings at each point and use them directly, instead a system compromising of two modifications is needed: -

Continuous measurement

-

Subtraction per stage

In Continuous measurement the speed of the main belt is both known and controllable. Thus, to find the overall production at a certain point this equation will be used 𝑁

𝑣 ∑ 𝑊𝑛1 − 𝑊𝑛2 𝑃 (𝑓𝑒𝑒𝑑𝑒𝑟) = 𝛼𝑁

(1)

1

Where for equation 1, v is the speed of the belt, N is the number of samples taken, W n1 and Wn2 are the values taken per sample within a delay and α is the calibration factor To find alpha calibration of the factory is needed. The system is designed to automatically calculate the value of α during calibration. For Subtraction per stage to find values of Wn1 and Wn2 values from previous stages is needed to get those values 𝑁−1

𝑊𝑛1 = 𝑊𝐿𝐶 − ∑ 𝑊𝑛1

(2)

1

Where for equation 2, WLC is the current reading of the load cell. By adding both equation together we get the final equation which is used for the system 𝑃 (𝑁) = 𝛼𝑊𝑁 − ∑ 𝑃𝑁−1 + ∑ 𝑃𝑀

(3)

Where PN-1 are all the previous readings at that point and PM are all the readings at the other sampling point. And WN is the sampled point.

38

38

Chapter 3: Design improvements

The calibration process is done by using this equation: 𝛼=

𝛽𝑊𝑒 𝑊𝑚

(4)

Where We is the correct weight, Wm being the raw reading from the load cell and β being the hardware error coefficient of the equipment. During calibration, two values of α are found, the zero-α which represents the weight of the belt when there are no materials on the belt. And the full- α which represents the max weight value. Each separate load cell will be calibrated separately to find the values of both α and β. Load cells will be placed 1 meter from the material drop-off point and between two rollers, 60 cm away from both rollers.

3.1.2 Addition of safety trip system When considering the factory there are many issues that can happen during the operation. While many of the issues are harder to avoid some issues can be easily fixed by adding an additional layer of safety into the factory. When considering the hoppers’ materials one of the issues that can pop is having rocks inside the materials of the mix. If rocks or any large materials are in the mix one of the following issues might occur: -

The mix will be nonhomogeneous. That means that the quality of the mix will drop significantly and might be unusable.

-

Movement of the rocks on the belts especially when moving from a stage to another stage might cause the belt to be cut at any pressure.

-

Large rocks can also damage the mixer as it is not designed to handle them.

Due to those discussed issues a tripwire system was introduced. After the 4 feeders there will be a small fork-like object which is loosely fitted on the system and connected with a microswitch. Any movements of said component will cause the plant process to stop. Only keeping the future processes running in order to clean off the current mix as much as possible. 39

39

Chapter 3: Design improvements

Attempting to stop the rock instead of stopping the belt will almost always cause the entire belt to be cut. The process of replacing the belt will not only have a high maintenance cost but will also create a very long downtime which is very costly.

3.1.3 Replacement to Variable Speed Motors In the original design to control the mix specifications manual gate adjustments were used. That process worked by using constant speed motors with a limited gate opening to only allow a certain amount of materials to flow. There are several issues with that method of calibration. The first and biggest issue is that calibration is much more difficult. Since an entire plant shutdown is required for calibration it is very difficult as those changes will cause the factory to be down for a period. Another issue is that manual calibration is less reliable as it is depending on mechanical limitations for the system. That also means that the system can’t detect if there are any issues in the mix as it is hardware calibrated. Another issue that is discussed as a reason for this change is the belt lifetime. Due to the high-speed nature of the existing motors materials falling at high speed will cause some grinding for the belt massively reducing its lifetime and causing the belt to be more easily damaged. As previously discussed damage to the belt is a major issue as it will cause a very expensive downtime which also having a high replacement cost. When discussing the addition to speed control there were two main options considered: -

Variable Frequency Drives (VFD) for AC motors

-

DC motor with speed control.

Originally DC motors are used when variable speed control was needed. However nowadays they have been getting replaced with VFDs for AC motors.

40

40

Chapter 3: Design improvements

While DC motors work very well to achieve the correct speed it still suffers from issues such as cost and the difficulty to maintain. DC motors in general have more moving parts which makes repairing them sometimes more expensive than replacing the entire motor. AC motors with a VFD presents a much cheaper and more reliable solution. And has been one of the most common installation choices nowadays [46]. Finally, AC motors overall have much higher life expectancy and the connections of the system are usually much simpler.

3.2 Control System Improvements Considering the Control system some improvements were applied: -

Increasing the Accuracy of the system

-

Implementation of emergency control & monitoring systems

-

IoT SCADA integration

-

Increase the stability & production of the factory

3.2.1 Increasing the accuracy of the system When discussing accuracy, it is one of the most important points for a wet mix plant. However, it is also one of the issues that continuous mix plants suffer from. To increase the production, amount some quality and accuracy is sacrificed. It is, however, possible to ensure that a better mix quality is achieved by doing a few modifications to the system with the addition of an improved control system. The biggest issue usually is not being able to know if there are any issues with the mix, and the fact that its very difficult to fix a mix after it is finished. The solution to this issue uses the measurement methods previously discussed to measure the total amount of mix that reaches the final stage at the belt. If the error is less than the allowed margin (which will be specified in the SCADA interface) then

41

41

Chapter 3: Design improvements

the system will automatically try to compensate by increasing the input of the missing material or reduce the amount of the excess material. If the error in the mix exceeds a certain limit or is sustained for a time that is longer than the pre-set timeout then the factory will gradually shutdown and an engineer will need to check the factory to re-enable it. A linear controller system will be used for the compensation. The equation of the system is: 𝑂=

𝐼𝐺𝑆 1 + 𝐼𝐺𝑆𝐻𝑅

(5)

Where O is the actual output, I is the signal from the PLC specifying the output, G is the controller factor, S being the speed of the motor. Then R is the load cell reading and H being the error factor which will correct the system until the needed output is achieved. The mix between improved load cell placement, Compensation system and general safety features will somewhat improve the accuracy of the system despite using continuous mix plant system.

3.2.2 Implementation of emergency control & monitoring systems. Modifications were done to the system to implement several emergency conditions if any issues were to pop ups. Some of those conditions are: -

Collecting belt emergency

-

Throw belt emergency

-

Mixer emergency

-

Trip Signals

-

Incorrect mix signal

In case of activation for any emergency the section will stop alongside all previous systems. And an engineer will need to check and fix the issue before the plant can continue to operate.

42

42

Chapter 3: Design improvements

In general, outside of the main emergency signals there are trip signals that occur if there is any issue in any component of the factory or if there are inaccuracies in the mix contents. Due to having a more in-depth emergency and trip system it allows for a better monitoring system for the factory which allows easier troubleshooting in case any issues happen. A manual mode to test individual components also allows to find the exact fault in each part to make maintenance even easier.

3.2.3 IoT Scada Integration IoT integration is one of the most critical aspects of automation nowadays. By allowing the system to be integrated to the IoT we gain many features. For example, IoT systems will not only give us greater connectivity so it is possible to monitor multiple systems regardless of location. But it will also improve on aspects such as preventive maintenance as data analysis is used. The main goals of an IoT SCADA integration systems are: -

Monitor individual feeder’s output in real time

-

Control the mix percentages and details

-

Control the entire plant process

-

Calibrate the factory

-

Display any issues and/or recommended action to be taken

As previously discussed there are several network architectures that can be used. However, for a small plant the usage of Modbus TCP/IP proves to be more useful as the limitations are not met while reducing the costs significantly. The system will use a custom SCADA system that can run on both computer and mobile devices. This system will allow greater connectivity with only the knowledge of the IP address of the plant needing to be known.

43

43

Chapter 3: Design improvements

Security features will be manually added to encode the messages sent and received from the system to ensure that it is not possible to break through and control the system unless allowed to.

44

44

Chapter 4: Design of PLC Control System

Chapter 4: Design of PLC Control System 4.1 Existing System The system discussed is a Wet Mix Plant (Cement Stabilizing Plant) has 4 feeders, those feeders will feed materials such as line, coal ash, sand, and soil to create the mix needed. Later, those materials will be driven through the main belt towards the throw belt. The throw belt will take the materials and drop them into the mixer. From there-on they will be dropped into the truck which will handle the delivery of the materials. Figure 4.1 shows the general layout of the plant with its main stages.

Figure 4.1 Layout of a Wet Mix Plant (Atlas World, n.d.)

The project was using an old PLC which had a very basic program with no SCADA control or any feedback elements. The existing design had the following issues that were needed to be amended in the new renovation:

45

45

Chapter 4: Design of PLC Control System

-

Absence of feedback from the feeders in the system which caused error detection and compensation for the mix impossible.

-

No detection methods for any issues that might arise while dropping materials from the feeders to the main belt

-

Purely manual controls for startup and stopping.

-

High dependence on the skill of the operator for the creation of a proper mix.

-

Lack of any data logging or reporting in the system

-

No way to control and monitor the system remotely

The design of the system will be concerned with amending and improving on those aspects when possible.

4.2 Design Methodology The design methodology will be concerned with the design of three aspects: -

Design of a general process for the control of the factory

-

Programming of the PLC to implement the process

-

Programming & Configuration of various instruments.

The following processes must be independently programmed and configured: -

Configuration and programming of VFDs for the 3-phase squirrel cage motors

-

Configuration, Calibration and programming of Load cells and their controllers.

-

Programming for the Flowmeters

-

Design and programming of the Contactors and Relays of the system (such as the Overload relay)

-

The safety alarm system (including instruments such as the warning horn)

-

Emergency trip-wire system

For the overall process of the factory there will be a very simple flowchart of the process as follows,

46

46

Chapter 4: Design of PLC Control System

Figure 4.2 Stages for the Wet Mix Plant

Figure 4.2 shows the main steps that the factory control system will try to apply for operation. During startup a horn will sound which will alarm the personnel near the site about the startup of the factory. After a few seconds delay the process of startup will begin. That process will work by: -

The mixer will start to clear off the residues of the last operation (if any)

-

The rising belt will start to drive any leftover materials to the mixer

-

The main belt will also start operating to clear

-

The feeders will run for a few seconds to clear off any rubble at the belt and to allow for more accurate material drop during operation

-

After a few seconds when the loading truck is ready the feeders will start outputting materials at the needed amounts.

-

The Water and Concrete pumps will add to the mix as needed

-

The process will continue until stopped or safety tripped.

4.2.1 Startup phase For startup, In the beginning the factory will load all the data that was configured for calibration. That data is then used for the configuration of each load cell and flow meter. They will be using equation 3 discussed prior. After loading the data various safety functions will be enabled in order to shut down the system if there are any issues. It will also check if any previous trips are still on, and in that case stop the factory from starting to avoid running the system when there

47

47

Chapter 4: Design of PLC Control System

are issues unfixed. In that case an engineer can reset the factory errors to allow it to continue with the startup. Next it will reset all signals to prepare for the interfacing signals which will be sent to the PC. Those of those signals are such as automatic mode and manual mode signals, and other signals that will show status of individual components. Finally, it will load the current materials quantity from the SCADA system and start the process to calculate the remaining materials in each container.

4.2.2 Calibration mode If during startup the switch was put to calibration mode then it will not start the process, instead it will be connected with the SCADA interface in the calibration page. There are two calibrations that are done: Zero calibration and full calibration During Calibration the user will put the needed weight per speed in the load cell for either calibrations (Zero or full). Then will specify the same amount in the SCADA interface then press the button to calibrate the correct type. The system will use the value of β obtained in the original hardware testing with the needed weight in equation 4 to get the value of α. The process is repeated for both Zero and Full load calibration. The zero calibration is needed for correct display of the values while full calibration will allow for the correct compensation for the system. There is also a hardware calibration for several set values, but they are only there in case of emergency issues in the system.

4.2.3 Manual mode In the system the manual mode is usually used for either operation of the system for unique mixes or for testing and troubleshooting for issues. The manual system will be able to activate:

48

48

Chapter 4: Design of PLC Control System

-

Each individual feeder

-

The Water Pump

-

The Cement Pump

-

The Main Belt

-

The Rising Belt

-

The Mixer

Figure 4.3 Flowchart for component activation

49

49

Chapter 4: Design of PLC Control System

Figure 4.3 showcases the system for each component’s activation. In the beginning a signal will be sent from either a hardware switch or the SCADA system. The system will then check if the main contactor is on. If it is not on, then it will not start the process as the system is not in running state. If the main contactor is on, then it will check for the manual mode. The system will refuse to operate any part of the project to prevent any issues from running any components during either automatic or calibration modes. If no issues arise then an alarm will sound for 5s to notify anyone of any issues that might arise, then sends a signal to start the component. At all times it will keep checking if any emergency trip is happening, automatic mode being enabled, or that the stop button is pressed for the system. If any of those issues occur, then it will stop the process and go back to the original state. The manual mode provides an additional layer of reliability to the plant in case some error in the overall process occurs and workarounds are needed or if there is a specific mix requirement of either increased accuracy, different material mix or any other change. 4.2.4 Automatic mode The main difference between automatic mode and the manual mode is the fact that the automatic mode will activate the correct instruments on its own while compensating for the system. The automatic mode will start by activating the beginning process to prepare for production. Then it will use the values previously calibrated to create the mix. It will keep detecting the changes and try to compensate the system to get the correct mix details. When the system is shutdown during automatic mode, it will not immediately stop. Instead it will follow a gradual process reverse of the startup process. The goal of the process is to again reduce the residual materials in the system and to make sure that as little materials as possible are wasted or left in the system which might damage it.

50

50

Chapter 4: Design of PLC Control System

4.2.4.1 Feeder control design To create proper correction for the system a CLCS was implemented. This system improves on the accuracy which is the main issue of the continuous model of the system. Figure 4.4 showcases the system suggested and applied.

Figure 4.4 Control System Diagram for feeders compensation

The control system uses the equation 5 discussed previously. The system was designed with simplicity in mind. By using very simple control processes it is possible to both asses the condition more straightforwardly and keep the control algorithm simpler which allows for a better experience when troubleshooting any issues. If the Error Factor (H) is lower than 10% then the process will run as per the equation. However, if it exceeds that value for more than a minute then the process will stop to be checked by an engineer. The system is implemented in the PLC to adjust the speed (v) to achieve the maximum accuracy of the system. And the system has an accuracy of up to ±0.5kg/s

51

51

Chapter 4: Design of PLC Control System

4.3 Factory software design 4.3.1 PLC Choice The factory was designed with a Fx1616-BA PLC by Triangle Research International. The PLC supports 32 digital IOs, 8 analog Inputs and 4 analog outputs. It also has 4 PWM/AC control outputs which are used to control the motors. Finally, there are 3 high-speed encoders, 6 input pulse frequency counters and an infrared remote-control interface. This model is built with automation and IoT integration in mind as it supports many features which are critical to the system. The PLC hosts two servers (one for Modbus and one for the PLC itself) for connections to the SCADA system. It also uses ethernet (RJ45) port for communication, but it also supports RS232 and RS485 ports as well for MODBUS RTU or ASCII connections. Table 1 shows the specifications of the PLC Table 4.1 PLC specification - Digital Input:

16 (24V AC, 24VDC)

- Digital Output (peak current):

16 (4x 8A NPN, 12x 5A Relay)

- Digital I/O Expansion:

Up to 128 DI, 128 DO

- Analog I/O:

12

A.I. Interface

8 (0 to 10V, 12-bit)

A.O. Interface

4 (0 to 10V, 12-bit)

- PWM (current):

4 (4A)

- Stepper Motor Controller:

2 (10,000 pps)

- Stepper Motor Drivers:

1 (unipolar)

- High Speed Counter:

3 (4 KHz)

- RS232 ports:

1

- RS485 port (2-wire):

2

- 14-pin LCD port:

1

- Ethernet Port:

1

- IR Remote Control:

1

- Light Dimmer control:

4

- Program Flash Memory:

23.5K words

- Non-volatie FRAM:

6K words built-in

- Dimension (L x W x H):

7.05” x 4.45” x 1.0”

- Operating Temperature:

0-70 ℃

52

52

Chapter 4: Design of PLC Control System

4.3.2 PLC programming Fx1616-BA works using a unique programming system called i-TRiLOGI “Ladder+Basic”. How that system works is that it mixes the standard ladder system that many PLCs use and adds a layer of BASIC programming to the system. The BASIC system for this PLC support floating-point math and variables which makes using it for purposes such as calibrations and equations much easier. It also has preset functions which help with connection to other controllers and/or other peripherals such as HVAC sensors or meters. The References of the Programming Language of the System will be included in the appendix 2.

4.3.2.1 Ladder Logic Application Ladder logic works by creating a ladder of instructions, each instruction will simulate a set of relays. The Ladder logic was first designed as a system to make the replacement of existing relay systems easier. Figure 4.5 shows different symbols in Ladder Logic

Figure 4.5 Symbols commonly used for Ladder Logic

53

53

Chapter 4: Design of PLC Control System

The system will work in descending order each “scan”. The PLC will keep repeating the instructions and will operate accordingly. The code for the PLC will have several sections as follows: -

Safety Function Activation: This will activate the safety at startup. It will also include the setting to reset any issues if an engineer checks and solves the issue.

-

Start Vibrator for three seconds: During startup a vibrator will activate as a safety setting to help awaken or notify any operators on the site. It is an addition to the sound horn to help people who might have hearing problems.

-

Start/Stop Cement: This will start the process of starting the cement pump as discussed previously. It will also check for any issues.

-

Start/Stop Feeder 1/2/3/4: This will start the feeders if the conditions for activation are met.

-

Start/Stop Pump: This will start the pump and begin the process of checking for issues

-

Start/Stop TBELT: This will start the rising belt if the conditions are met

-

Start/Stop Mixer: This will start the mixer process and will track issues in the mixer. It will also activate the warning for the truck to get in the placement and will start the measurement process if the system is in automatic mode.

-

Start/Stop Horn: This will control the emergency horn which will sound at any time where a new action is taken. This is an emergency feature to avoid

54

54

Chapter 4: Design of PLC Control System

injury from operating the plant when a person might be doing maintenance or unaware.

-

Main Contactor Start/Stop: This will start or stop the main contactor. The main contactor controls the activation of the entire plant overall. If there are any major trip errors or emergencies the main contactor will be off to prevent any instruments from functioning.

-

Download Data: This will load the startup data for the calibration to the system for use during operation

-

Manual Control: This will include both the start/stop function for the process. It will also include the manual startup for each individual component. That process includes starting up the horn, taking a delay and checking for issues constantly.

-

Output Signal to computer: This will send the correct signal to the SCADA system to show the current state of the factory (manual/automatic/etc.).

-

Set Feeders / Cement Speed / Weighing Value: This will be used for control of the speed and measurement system of each control. The data will then be used for both displaying action and for compensation purposes.

-

Weighing Calibration: This section will process the calibration cycle and do the calculation required to get the correct weight and production of the system. It will also do the calibration for the flow meter for the water pump.

55

55

Chapter 4: Design of PLC Control System

-

Clear Data Message: This will be used to reset the system in case that the issues are solved, and the process needs to be restarted.

-

Material Consumption Calculation: This will be used to calculate how much materials are left for each container.

-

Emergency Output Indication: This will check for trip and emergency signals and display them accordingly

4.3.2.2 BASIC programming As well as the ladder system, BASIC is used for any process that needs a more complex process that includes data or processes. BASIC is an old high-level programming language that is still widely in use nowadays which gives the system an advantage for programming and troubleshooting since it is using a very common and easy to learn programming language. Some of the functions that were developed in BASIC section of the PLC are:

-

PWM: A PWM signal is generated and then accordingly used for the movement of the main belt and the throw belt.

-

FREQ1: A setup setting is used for the reading of the data for the Digital Analog Converter (DAC)

-

Feeder1 Speed: This will take the values of the load cells and apply equations 1 to 3 discussed previously to get the correct values of calibration and store them. It will then proceed to calculate the needed speed for the feeder to optimize the system using equation 4. It will handle aspects such as sampling, calculation and estimation for the system.

56

56

Chapter 4: Design of PLC Control System

-

Feeder2/3/4 Speed: Those will make use of the calculations done to feeder 1 with their own values to achieve the correct speed as well. Focus was on avoiding needless complexity and repetition for the system while designing those functions.

-

Cement Speed: This will calculate how much speed is needed for the cement control.

-

Load Data: This will load the data of the system including calibrated values and mix details at startup.

-

Total: This will calculate and show the current state of the mix

-

Read AV: This will do the calculations to display and use the values for each individual feeder.

-

Water Count: This function will be used with a rising edge to calculate the amount of water flowing through the flowmeter.

-

W_Cal: This function will be used to save the calibration data of the water Pump.

-

Water Read: This will display the value of the water reading and multiply it by the calibration factor.

-

F/CX_Y_DM_Z_: Those functions will move the data for each feeder X for the Calibration Y (Zero/Max) into the register valued Z.

57

57

Chapter 4: Design of PLC Control System

-

FX_Cal: This will be used to calibrate the feeder number X and save its data to the Electrically Erasable Programmable Memory (EEP)

-

Cement_Cal: This will calibrate the cement meter to the correct values and save the values to the EEP.

4.3.2.3 IOs Layout For the system there are 75 input signals, 36 output signals, and 30 registers used which includes 10 floating-point registers. A list of the IO table is included in appendix 3. However, some of the more prominent IOs used are: -

Trip Signals: Inputs from 9 to 23 were used to input a trip signal to the PLC. Those trip signals include Speed Control trips, Gear Motor trips and pump/mix trips.

-

Emergency Signals: Inputs 24,25 and 26 were used for Collecting belt emergency, Throw belt safety and Mixer Emergency respectively

-

Control Signals: Inputs 27,29,30, and 31 were used for controlling the operation

of

the

plant.

Those

controls

include

the

switch

for

Automatic/Manual, Horn activation button, Calibration Mode Switch, and the cement level switch.

-

Running Signals: Those are the outputs from 8 to 29 which will show the state of each individual component.

-

ON/OFF/READY indicators: Those indicators are used for the process indicators for the factory. They can indicate if the factory is running or not.

58

58

Chapter 4: Design of PLC Control System

They can also show if the factory is ready for production. Those are the outputs 31 to 34 and 63/64

-

Internal Control Signals: Those signals will be inside the process to turn on/off most of the components and the modes. They are meant to be accessed from the SCADA interface during the manual mode for example or through the Automatic mode’s process. The Inputs used are 33 to 60

-

Calibration Signals: Those IOs will be used for calibration, they include Analog Signals, Digital display Signals and the controls for setting up the calibration activation and values. They are the Inputs from 65 to 75 and the Registers 11 to 52.

-

Internal Relays: There are 50 internal relays used for the programming of the process

-

Timers: 6 main timers were used for the system. Which includes the timer for the mixer operation, Cement control timers, Vibrator timer, and the Horn alarm timers.

59

59

Chapter 5: SCADA System

Chapter 5: SCADA System During the design of the factory control system a completely custom SCADA system was considered and designed. The design was done using C#. The system can use both Modbus and OPC. However, for the sake of this report only Modbus will be discussed. SCADA systems are one of the corner stones for any modern factory system. Those systems will deal with monitoring, analysis and control of the plant. Overall SCADA systems are one of the very important aspects to take in mind as a proper SCADA system can allow the plant’s efficiency and maintenance to improve at a minimum cost.

5.1 Description of the System The system is a SCADA system that uses Modbus TCP/IP for communication. It is a unique system that was built for this project to achieve a number of goals: -

Add a security measure to the SCADA system.

-

Allow for the system to be customized on the fly.

-

Create a simple system that is easier to use for most people

-

Construct the SCADA to be ideal for small and medium projects

The SCADA system can create controls such as: -

Labels

-

Digital IO indicators

-

Buttons

-

Analog Read/Write

-

Gauges

-

Vertical and Horizontal Bars

-

Graphs of different kinds

Using those basic controls with the configuration options it is possible to create complex systems for most factories that are small/medium. The system also supports features such as Tabs with different IPs in order to connect to multiple PLCs at the same time. That feature helps in projects where a single 60

60

Chapter 5: SCADA System

engineer can be in charge with monitoring and solving issues in more than one factory. So, he can check all systems at the same time to take the correct decisions. Finally, the system is designed with a scan time between 1 seconds and 4 seconds for non-emergency functions for displaying and showing data. Another critical aspect of the system is that different users will have different visible interfaces and settings possible for them to view and control. For example: -

Operators can view and monitor the system at real time while having the ability to control the startup and operation of the plant.

-

Managers will be able to view the overall status of the factory

-

Engineers will be able to view and control all the functions, and to control the system to trouble shoot any issues.

Overall the separation system adds an extra layer of features to the system as each user can only use the features that they need. Finally, the system will be able to record and keep track of all changes. And it includes a very smart modification to lower the work-load of the system for both viewing speed and recording purposes.

5.2 Advantages and Disadvantages of the System For this custom system there are several pros and cons for the usage of this system compared to other existing systems. For the sake of comparison this system will be compared to the main systems for SCADA design of both PC Worx by Phoenix Contacts and Wonderware by Schneider.

5.2.1 Advantages of the custom SCADA system There are a few advantages for the system discussed which includes but are not limited to: -

Usage of a customized system allows the usage of unique calculations and methods that might not be available by default in other systems

61

61

Chapter 5: SCADA System

-

Having the system be customizable at run-time will allow for a much more flexible control

-

Simplifying the SCADA design process allows for Junior Engineers to design the SCADA system instead of the Control Engineers if they have the table of the registers and IOs. That is due to the program automatically dealing with the programming of the system.

-

Having one interface will allow for the ease of use. Each user can have an unlimited number of tabs showcasing the projects they need with the controls they require.

-

Using our unique system. We can track and notice if any changes happen to the data of the SCADA data and to only use the data if changes occur. That system allows for much lower load on the system and allows for increased speed. Especially for much larger plants

5.2.2 Disadvantages of the system While the system has numerous advantages it still has a number of disadvantages that prevent it from wider use. Some of those are: -

The system is a custom made SCADA program. Which means there is less trust compared to programs such as Wonderware which have been part of the industry for a while

-

While having a custom SCADA allows for additional features that are not usually there in existing SCADA development programs. It is still more lacking in overall features compared to those systems.

-

Having a smaller team working on the Custom SCADA project (one person) compared to larger company-based programs means a much slower development cycle and bug fixing and troubleshooting

-

Having a younger system means that there are more bugs that might occur in the system

-

Due to not having enough test sample it was not possible to test and adapt the system to more than 3 types of PLCs including Phoenix Contacts, Schnieder

62

62

Chapter 5: SCADA System

and TriPLC. While programs such as PC Worx or Wonderware have a much wider compatibility range.

5.2.3 Overall comparison After discussing the advantages and disadvantages of the system. An overall comparison will be used: -

For smaller plants it is much more useful to use the custom SCADA. There will usually be no requirements that are not available in the software

-

For bigger plants it is better to use the existing systems that can have more features to use.

-

For more critical applications very specific software that are used which focus purely on reliability.

-

This system has a huge advantage for educational purposes. It will allow for very easy application and usage

5.3 Operation and Design The program operation has two main phases, Design phase and Operation phase. In the beginning before any systems will work it will attempt to connect to the IP and port of the system to check for a connection. If any issues occur, then the system will notify the user so they can fix them. During operation phase the program will be showing all the data of the system. It will also simultaneously check for any updated data. If it confirms data is not changed then it will not take the data from the system or try to save it to avoid overloading the system needlessly. It will then proceed to save all the data as specified in the design. The data will be saved both in a local database and in an excel file. That data can be used to plot graphs, Generate reports and for general analysis of the system. The source code of the system will be supplied in the appendix 6.

63

63

Chapter 5: SCADA System

In this custom edition of the SCADA a more in-depth reporting service was provided in order to create an exact form to display the summary of the day. That was done to satisfy the reporting requirements for the project. In the Design phase however, the user is prompted to input a password to access the system. The user will then be allowed access if the password is correct. The user can then proceed to: -

Add or remove tabs to the system

-

Rename Tabs and change their properties

-

Change the IP/Port of the system

-

Change the background imagery of each Tab

-

Add. Remove or edit components in the system

-

Control how reports are generated

-

Change options such as the sampling rate of the system, enable or disable extra features such as the setting that checks for changes for in system before updating the information and other features

Figure 5.1 shows the menu for choosing components and their details

Figure 5.1 Component menu for choosing the component to be added

64

64

Chapter 5: SCADA System

When adding components, a number of options will show depending on the component, some of those are: -

Text: This option will show the text of the control. It is available for controls such as labels, Digital IOs and Gauges and Graphs.

-

Size: You can specify both the control size and the text size of the control added.

-

Assign: This is the option to choose which register or IO is assigned for use. It is only available for controls which will handle data.

-

Fore color/Back color: Specify the color scheme of the control.

-

Lower/Higher Limit: Specify what the maximum and minimum points are. Only for Analog Write, Gauges and Vertical/Horizontal Progress Bars

-

Divide: Choose the divider for Analog Write, Gauges and Vertical/Horizontal Bars.

-

X/Y Axis: Will be used to specify which register or variable will be included in the X or Y axis of the graph

-

Save: Used to check if the data should be saved in the system.

5.4 System interface The system used will use the interface shown in figure 5.2 during normal operation. The figure shows options for: -

Viewing how much each container is outputting. (On top of container)

-

Adjusting needed amount for mix

-

Start the factory in automatic or manual mode.

-

During manual mode, control each individual component

-

View the flow of water and the final amount for the mix.

-

Display any error messages or trip errors

65

65

Chapter 5: SCADA System

Figure 5.2 Main interface of SCADA

As well as the main interface, another interface exists and is used which is the calibration interface. Figure 5.3 shows the calibration interface.

Figure 5.3 Calibration interface of SCADA

66

66

Chapter 5: SCADA System

The Calibration mode allows the usage of both zero reading and max reading calibration. The max value will be inputted into the fields for calibration. After calibration it can be quickly tested as each field will show its current value being read.

67

67

Chapter 6: Conclusion

Chapter 6: Conclusion 6.1 Results and discussions In the end of the application of the project the following was achieved: -

Increased the accuracy of the system and reduced the error of standard systems from +- 1kg to +- 0.5kg

-

Increased the life time of the belt by reducing the load with lowering the speed and providing safety features for things such as rocks

-

Added a CLCS to compensate for the mix if any issues occur. And added a safety system to stop the plant if error was above a certain percentage.

-

Applied SCADA system with IoT to control and monitor the system while adding analysis tools

-

Achieved the required governmental requirements for the factory.

-

Improved the overall efficiency of the factory.

-

Improved the error factor of the system overall

-

Implemented and programmed a new custom SCADA system that can be used for smaller applications easily.

All improvements and systems were tested and applied and are currently used in the factory in Jabal Ali for production since early March. The total cost of the renovation including the hardware was around 5 thousand dollars. That cost includes: -

Buying the PLC

-

Buying new motors for the system

-

Getting Components such as contactors, VFDs and other necessary components.

-

Addition and installation of the load cells.

-

Installation and design of the trip-wire system

-

Replacement of some components which were rusty/not in a good condition

The system had minimum mechanical changes to the system which reduced the cost significantly compared to having a hardware renovation or getting a new factory which can cost up to 30% of the cost of the factory.

68

68

Chapter 6: Conclusion

Due to the increase in production and the added efficiency, with addition to the ease of applying the systems and the price of modifications it was concluded that the renovation was a successful investment and is recommended to be applied to other factories owned by Wade Adams in the future as the reduction in downtime will end up saving more than the total cost of the renovation after a period.

6.2 Issues faced During the operation of this project a number of issues were faced. Some of those issues include: -

The complexity of configuration for a bigger project using industrial components. As the design of simple actions was very complicated due to the nature of how those systems are designed and used.

-

The need to study and apply different industrial standards and protocols. As changes to many parts of the factory are not possible if the proper protocols are used.

-

Learning and applying the “LADDER+BASIC” system as it is a new concept that had to be studied.

-

Solving issues where the factory was not operating correctly during initial programming. Troubleshooting was very difficult due to not being able to know if the issues were hardware or software based.

-

Finding information on the communication protocols for SCADA for the development of a new SCADA system

-

Solving numerous bugs in the SCADA system as the system evolved. And trying to make the system industrial-read by making it as resistant to issues as possible

-

Finding research regarding the needed plants and trying to extrapolate new methods to improve those systems by both research and trial and error.

-

Insufficient man power for the programming has slowed down the process significantly at many points.

69

69

Chapter 6: Conclusion

Overall most of the issues were solved or dealt with in one way or another. However, if some of the issues are solved and more time is available the system can be improved even further.

6.3 Future work During the time of this project research has been done to many sides of the operation of the Wet Mix plant. However, there are many aspects where improvement was possible but both time and experience limitations prevented the application and further research of. Some of those systems were discussed and mentioned in the background theory section. And with further research many of those can be used to improve the efficiency of the system even further. Another aspect of improvement is the custom SCADA system. While the system has been designed and constructed until it was deemed stable enough for usage on the plant. There are still many improvements and features that can be added but were not due to time constraints. Further research and development in planned to improve the custom SCADA system and try to test it for more systems. A simple control system was designed for compensation which is working sufficiently. However proper improvement of the system by using methods such as Root-Locus or the design of a PID compensator specifically for the system might be able to increase the efficiency and speed of the compensation system. However, it was not used as it was outside the scope of this project time-wise.

6.4 Lessons learned Overall after taking this project and applying it, many fields were studied further and improved upon the learned academic concepts. Those fields are: -

Design and Implementation of Control Systems

-

Industrial Communication protocols

70

70

Chapter 6: Conclusion

-

Structure and workings of different industrial plants

-

Improvement of Object Oriented Programming (OOP) in C# for hardware development and networking.

-

Field experience in troubleshooting and constructing industrial power systems.

-

Usage of different instruments such as relays, contactors and other components.

-

Control and usage of VFDs and Load cell controllers.

71

71

References

References Al Shattle, Z. S., & Muthukumaraswamy, S. (2017). On the Comparision of various Wind-turbine Load Control Systems for Maximum power tracking using PLC SCADA. International Conference on Intelligent Sustainable Systems. Palladam: IEEE. Al Shattle, Z. S., & Muthukumaraswamy, S. (2018). DESIGN AND IMPROVEMENT OF A CONTROL SYSTEM FOR A WET MIX PLANT WITH IOT CONTROL . International Journal of Current Engineering and Scientific Research, 52-57. Al Shattle, Z. S., & Muthukumaraswamy, S. (2018). On the renovation and automating of a Concrete Wet Mix Plant using SCADA controlled system. Submitted for publication. Aldrich, J., & Zhang, Y. (2014). MINIMIZING BELT WEAR AND DAMAGE FROM OPTIMIZED CHUTE DESIGN. SME Annual Meeting Conference. Salt Lake City: SME. Atlas World. (n.d.). Wet Mix Plant. Retrieved from Atlas World. Automation World. (2014). PLC vs. DCS: Which is Right for Your Operation? Retrieved from Automation World: https://www.automationworld.com/article/technologies/dcs/plc-vs-dcs-which-rightyour-operation Beek, D. A., & Rooda, J. (1997). DESIGN OF DISCRETE CONTROLLERS FOR CONTINUOUS SYSTEMS USING HYBRID CHI. 7th Symposium on Computer Aided Control. IFAC. Boys, W. (Director). (2009). "Back to Basics: SCADA". Automation TV: Control Global - [Motion Picture]. Cazacliu, B., & Ventura, A. (2010). Technical and environmental effects of concrete production : dry batch versus central mixed plant. Journal of Cleaner Production, 1320-1327.

72

72

References

Chemistry World. (2008). The concrete conundrum. Retrieved from Chemistry World: http://www.rsc.org/images/Construction_tcm18-114530.pdf Control Global. (2003). Centralized vs. Distributed: Is Bigger Better? Retrieved from Control Global: https://www.controlglobal.com/articles/2003/389/ Control Systems USA. (n.d.). PLC & SCADA SERVICES. Retrieved from Control Systems USA: http://controlsystemsusa.com/plcscada/About.asp Country Materials Corporation. (2016, March 4). Concrete Uses. Retrieved from Country Materials Corporation: https://www.countymaterials.com/en/news/item/concrete-uses Deligiannis, V., & Manesis, S. (2007). Concrete batching and mixing plants: A new modeling and control approach based on global automata. Automation in Construction, 368-376. Donis, V., Rachkovskii, A., & Sin, V. (n.d.). How the Conveyor Belt Length Affects Belt Weigher Accuracy. Ferraris, C. F. (2001). Concrete Mixing Methods and Concrete Mixers: State of the Art. Journal of Research of the National Institute of Standards and Technology, 391399. Haomei Batch Plant. (2018). YHZS25 Mobile Batching Plant. Retrieved from Haomei Batch Plant: http://www.haomeibatchplant.com/mobilebatchingplant/YHZS25-mobile-batchingplant.html Haque, S. H., Hassan, H. M., & Hossain, S. M. (2014). Comparison of Control System Using PLC & PID. ASEE . Bridgpeort: University of Bridgeport. Harrison, A. (1984). CRITERIA FOR MINIMISING TRANSIENT STRESS IN CONVEYOR BELTS. National conference publication. Australia: Institution of Engineers. Hidden, A. (1973). Errors in Conveyor Belt Weigher Systems. Measurement and Control.

73

73

References

IEEE Control Systems Society. (2018). CONTROL & CONTROL HISTORY. Retrieved from IEEE Control Systems Society: http://www.ieeecss.org/publications/tac/control-control-history Industive Automation. (2018). Retrieved from Industive Automation. Instrumentation and Controllers. (2011). Distributed control system. Retrieved from Instrumentation and Controllers: http://instrumentationandcontrollers.blogspot.ae/2011/09/distributed-controlsystem.html Iowa DNR Government. (2018). Concrete Batch Plant Modeling Guide. Retrieved from Iowa DNR Government: http://www.iowadnr.gov/portals/idnr/uploads/air/dispmodel/concrete_batch_plants.p df Kirti. (2014). SCADA: SUPERVISORY CONTROL AND DATA ACQUISITION. International Journal Of Engineering And Computer Science, 3743-3751. Komander, H., Hardygóra, M., Bajda, M., Komander, G., & Lewandowicz, P. (2014). Assessment methods of conveyor belts impact resistance. Maintenance and Reliability Volume 16 , 579-584. Laughton, M. A., & Warne, D. J. (2003). Electrical Engineer's Reference book 16th Edition. Liu, Y., Li, M., Yang, D., Zhang, X., Wu, A., Yao, S., . . . Yue, Y. (2015). ClosedLoop Control Better than Open-Loop Control of Profofol TCI Guided by BIS: A Randomized, Controlled, Multicenter Clinical Trial to Evaluate the CONCERT-CL Closed-Loop System. PLOS One. Marini Fayat Group. (2003). CONTINUOUS vs BATCH PLANTS: making the right choice! Retrieved from Marini Fayat Group: http://www.marini.fayat.com/en/asphalt-plants-continuous-vs-batch/ Misajet, E. (n.d.). Death of the batch plant. Retrieved from Asphalt Magazine: http://asphaltmagazine.com/death-of-the-batch-plant/

74

74

References

Modbus-IDA. (2006). Modbus Messaging On TCP/IP Implementation Guide. OPC UA. (2018). What is OPC? Retrieved from OPC Foundation: https://opcfoundation.org/about/what-is-opc/ Optomux. (2012). Optomux Protocol Guide. Palmer, & Shenoi, S. (2009). Critical Infrastructure Protection. Third IFIP WG 11. 10 International Conference. Parmar, J. (2012). Star-delta motor starter explained in details. Electrical Engineering Portal. Pimzos. (2018). Papouch TCP2RTU-RS232 - MODBUS TCP to MODBUS RTU Converter. Retrieved from Pimzos: https://www.pimzos.com/nl/papouch-tcp2rturs232-modbus-tcp-to-modbus-rtu-con.html Process Systems and Design Blog. (2017, Septemper 10). Batch Processing vs. Continuous Manufacturing in Pharmaceuticals. Retrieved from Process Systems and Design Blog: https://blog.processsystemsdesign.com/2017/09/batch-processing-vscontinuous.html Pugliesi, D. (2014). Functional levels of a manufacturing control operation. Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Distributed_control_system#/media/File:Functional_le vels_of_a_Distributed_Control_System.svg Russel, J. (2015). A Brief History of SCADA/EMS. Shekhawat, J. S. (2014). PLC, DCS and PLC vs DCS . Soto, H. A., Lozano, E. R., & Hernandez, O. B. (2014). Design and simulation of a discrete time controller for regulating temperature in a scale greenhouse. 2014 III International Congress of Engineering Mechatronics and Automation (CIIMA). Colombia: IEEE. Stouffer, K., Pillitteri, V., Lightman, S., & Marshall Abrams. (2015). Guide to Industrial Control Systems (ICS) Security. NIST Special Publication 800-82 Revision 2.

75

75

References

Supervisor, M. E., & Taha, W. I. (2013). PID and fuzzy logic in temperature control system. Retrieved 3 30, 2018, from http://ieeexplore.ieee.org/document/6633927 The constructor. (2018). Effect of Water Impurities on Concrete Strength, Durability and Other Properties. Retrieved from The constructor: https://theconstructor.org/concrete/effect-water-impurities-concrete-properties/17123 UA, O. (2002). Alarms and Events. Retrieved from OPC Foundation: https://opcfoundation.org/developer-tools/specifications-classic/alarms-and-events Verma, N., Gupta, K., & Mahapatra, S. (2015). Implementation Of Solid State Relays For Power System Protection. INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VOLUME 4, 65-70. Wade Adams Contracting. (2017). Wet Mix Plant Specifications. Yu, S.-Q. (2017). Exploration on factors of old industrial building renovation and design practice. IOP Conference Series: Earth and Environmental Science Volume 81. IOPScience. Zayed, T. M., & Halpin, D. (2001). Simulation of Concrete Batch Plant Production. Journal of Construction Engineering and Management Volume 127.

76

76

Appendix I: Minutes of the meetings

Appendix I: Minutes of the meetings

77

77

Appendix I: Minutes of the meetings

78

78

Appendix I: Minutes of the meetings

79

79

Appendix I: Minutes of the meetings

80

80

Appendix I: Minutes of the meetings

81

81

Appendix I: Minutes of the meetings

82

82

Appendix I: Minutes of the meetings

83

83

Appendix I: Minutes of the meetings

84

84

Appendix I: Minutes of the meetings

85

85

Appendix I: Minutes of the meetings

86

86

Appendix I: Minutes of the meetings

87

87

Appendix I: Minutes of the meetings

88

88

Appendix I: Minutes of the meetings

89

89

Appendix I: Minutes of the meetings

90

90

Appendix I: Minutes of the meetings

91

91

Appendix I: Minutes of the meetings

92

92

Appendix I: Minutes of the meetings

93

93

Appendix I: Minutes of the meetings

94

94

Appendix I: Minutes of the meetings

95

95

Appendix I: Minutes of the meetings

96

96

Appendix I: Minutes of the meetings

Appendix II: TL7 programming reference

97

97

Appendix I: Minutes of the meetings

98

98

Appendix I: Minutes of the meetings

99

99

Appendix I: Minutes of the meetings

100

100

Appendix I: Minutes of the meetings

101

101

Appendix I: Minutes of the meetings

102

102

Appendix I: Minutes of the meetings

103

103

Appendix I: Minutes of the meetings

104

104

Appendix I: Minutes of the meetings

105

105

Appendix I: Minutes of the meetings

106

106

Appendix I: Minutes of the meetings

107

107

Appendix I: Minutes of the meetings

108

108

Appendix I: Minutes of the meetings

109

109

Appendix I: Minutes of the meetings

110

110

Appendix I: Minutes of the meetings

111

111

Appendix I: Minutes of the meetings

112

112

Appendix I: Minutes of the meetings

113

113

Appendix I: Minutes of the meetings

114

114

Appendix I: Minutes of the meetings

115

115

Appendix I: Minutes of the meetings

116

116

Appendix I: Minutes of the meetings

117

117

Appendix I: Minutes of the meetings

118

118

Appendix I: Minutes of the meetings

119

119

Appendix I: Minutes of the meetings

120

120

Appendix I: Minutes of the meetings

121

121

Appendix I: Minutes of the meetings

122

122

Appendix I: Minutes of the meetings

123

123

Appendix I: Minutes of the meetings

124

124

Appendix I: Minutes of the meetings

125

125

Appendix I: Minutes of the meetings

126

126

Appendix I: Minutes of the meetings

127

127

Appendix I: Minutes of the meetings

Appendix III: I/O Table of the system

128

128

Appendix I: Minutes of the meetings

129

129

Appendix IV: Ladder Logic of PLC

Appendix IV: Ladder Logic of PLC

130

130

Appendix IV: Ladder Logic of PLC

131

131

Appendix IV: Ladder Logic of PLC

132

132

Appendix IV: Ladder Logic of PLC

133

133

Appendix IV: Ladder Logic of PLC

134

134

Appendix IV: Ladder Logic of PLC

135

135

Appendix IV: Ladder Logic of PLC

136

136

Appendix IV: Ladder Logic of PLC

137

137

Appendix IV: Ladder Logic of PLC

138

138

Appendix IV: Ladder Logic of PLC

139

139

Appendix IV: Ladder Logic of PLC

140

140

Appendix IV: Ladder Logic of PLC

141

141

Appendix V: Custom BASIC functions for PLC

Appendix V: Custom BASIC functions for PLC

142

142

Appendix V: Custom BASIC functions for PLC

143

143

Appendix V: Custom BASIC functions for PLC

144

144

Appendix V: Custom BASIC functions for PLC

145

145

Appendix V: Custom BASIC functions for PLC

146

146

Appendix V: Custom BASIC functions for PLC

147

147

Appendix V: Custom BASIC functions for PLC

148

148

Appendix V: Custom BASIC functions for PLC

149

149

Appendix V: Custom BASIC functions for PLC

150

150

Appendix VI: SCADA Code

Appendix VI: SCADA Code VI.I Main Program Code Public Class Control ' SELECTED SCREEN Public CON1 As Int16 ' SAVE REGISTER DATA Dim SAVED(12) As Integer ' COMPONENETS TEMP DATA Dim mov As Integer = 5 Dim NM As String = "" Dim SZ As Int16 = 1 Dim FCLR As String = "" Dim BCLR As String = "" Dim TT As Int16 Dim ASS As Int16 = 0 Dim TYP As String Dim MX As Int16 = 100 Dim MN As Int16 = 0 Dim STP As Integer = 1 Dim XX As Int16 = 0 Dim YY As Int16 = 0 Dim COMPONANTS As String Dim II As Int16 Dim SAVECOUNT As Integer = 0 Dim XS As Int16 = 50 Dim YS As Int16 = 20 Dim TS As Int16 = 20 Dim A, I As Integer ' LOCAL VARIABLE Dim XXX As Integer 'DEFINED CLASS Dim COMPONENTS1 As New COMPONENTS Dim COMM1 As New comm Dim DBASE_COMPONENTS_1 As New DBASE_COMPONENTS Dim DBASE_SAVE1 As New DBASE_SAVE Dim VProgressBar2 As New VProgressBar 'COMPONENTS DATA Public DAT(1000, 15) As String Private Sub START() TabControl1.Size = New Point(My.Computer.Screen.Bounds.Size.Width, My.Computer.Screen.Bounds.Height) Timer1.Enabled = False TabControl1.Visible = True DBASE_COMPONENTS_1.CREATEDBASE() DBASE_COMPONENTS_1.OPENDBASE() DBASE_COMPONENTS_1.READDBASE() ' COMBOTYPE.Text = "TYPE" ' COMBOASSIGN.Text = "ASSIGN" ' COMBOFCOLOR.Text = "COLOR" ' COMBOBCOLOR.Text = "COLOR" Me.TabPage1.Controls.Clear() Me.TabPage2.Controls.Clear() Me.TabPage3.Controls.Clear()

151

151

Appendix VI: SCADA Code

Me.TabPage4.Controls.Clear() Me.TabPage5.Controls.Clear() Me.TabPage6.Controls.Clear() Try For A = 0 To DBASE_COMPONENTS_1.INT1 If DAT(A, 7) = "TEXT" Or DAT(A, 7) = "DIGITAL_I/O" Then COMPONENTS1.LBS(A) ElseIf DAT(A, 7) = "BUTTON" Then COMPONENTS1.BTT(A) ElseIf DAT(A, 7) = "ANALOG_R/W" And DAT(A, 6) = "W-" Then COMPONENTS1.NUMW(A) ' we may cancel it If Me.Text = " Comm Ok " Then COMM1.RRegister(Convert.ToInt16(DAT(A, 5))) If (COMM1.RMNV > COMPONENTS1.NUM(A).Minimum And COMM1.RMNV < COMPONENTS1.NUM(A).Maximum) Then COMPONENTS1.NUM(A).Value = COMM1.RMNV / Convert.ToInt16(DAT(A, 14)) ElseIf COMM1.RMNV / Convert.ToInt16(DAT(A, 14)) < COMPONENTS1.NUM(A).Minimum Then COMPONENTS1.NUM(A).Value = COMPONENTS1.NUM(A).Minimum MessageBox.Show("Register(" + Convert.ToString(DAT(A, 5)) + ") underflow") ElseIf COMM1.RMNV / Convert.ToInt16(DAT(A, 14)) > COMPONENTS1.NUM(A).Maximum Then COMPONENTS1.NUM(A).Value = COMPONENTS1.NUM(A).Maximum MessageBox.Show("Register(" + Convert.ToString(DAT(A, 5)) + ") overflow") End If End If ElseIf DAT(A, 7) = "GAUGE" Then COMPONENTS1.GAUGE(A) ElseIf DAT(A, 7) = "ANALOG_R/W" And DAT(A, 6) = "R-" Then COMPONENTS1.NUMR(A) ElseIf DAT(A, 7) = "LEDV" Then COMPONENTS1.LEDV(A) ElseIf DAT(A, 7) = "LEDH" Then COMPONENTS1.LEDH(A) End If Next Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub ' DELETE / ACTION COMPONENTS Public Sub ClickButton(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Dim bts As Object = sender Dim I As Integer I = bts.tag If e.Button = Windows.Forms.MouseButtons.Left Or I = 60 Then COMM1.chk() If DAT(I, 7) = "BUTTON" Then If Me.Text = " Comm Ok " Then

152

152

Appendix VI: SCADA Code

COMM1.WInPut(Convert.ToInt16(DAT(I, 5))) End If ElseIf DAT(I, 7) = "ANALOG_R/W" And DAT(I, 6) = "W-" Then If Me.Text = " Comm Ok " Then COMM1.WRegister(Convert.ToInt16(DAT(I, 5)), COMPONENTS1.NUM(I).Value * Convert.ToInt16(DAT(I, 14))) End If End If Else If XXX = 1 Then ' MessageBox.Show(bts.tag.ToString) Dim result3 As DialogResult = MessageBox.Show("1TYPE = " + DAT(I, 7) + " 2- ASSIGNED TO = " + DAT(I, 5) + " 3LEVEL = " + DAT(I, 6) + " Delete the Selected Component ? ", " - ", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) If result3 = DialogResult.Yes Then DBASE_COMPONENTS_1.DELETEDBASE(I) START() End If End If End If End Sub Private Sub Control_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Cursor = Cursors.Cross TabPage1.Text = My.Settings.NAME1 TabPage2.Text = My.Settings.NAME2 TabPage3.Text = My.Settings.NAME3 TabPage4.Text = My.Settings.NAME4 TabPage5.Text = My.Settings.NAME5 TabPage6.Text = My.Settings.NAME6 Label4.Text = "IP Address -" + My.Settings.IPA Label5.Text = "Communication Port - " + My.Settings.PRT ' DISPLAY ACTIVE PANELS If Not My.Settings.pg1 Then TabControl1.TabPages.Remove(TabPage1) CheckBox1.Checked = False Else CheckBox1.Checked = True End If If Not My.Settings.pg2 Then TabControl1.TabPages.Remove(TabPage2) CheckBox2.Checked = False Else CheckBox2.Checked = True End If If Not My.Settings.pg3 Then TabControl1.TabPages.Remove(TabPage3) CheckBox3.Checked = False Else CheckBox3.Checked = True End If

153

153

Appendix VI: SCADA Code

If Not My.Settings.pg4 Then TabControl1.TabPages.Remove(TabPage4) CheckBox4.Checked = False Else CheckBox4.Checked = True End If If Not My.Settings.pg5 Then TabControl1.TabPages.Remove(TabPage5) CheckBox5.Checked = False Else CheckBox5.Checked = True End If If Not My.Settings.pg6 Then TabControl1.TabPages.Remove(TabPage6) CheckBox6.Checked = False Else CheckBox6.Checked = True End If CHECK() 'SCREENS BACKGROUND IMAGE Try Me.TabPage1.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC1) Catch ex As Exception MessageBox.Show("Background -1 Image Missing End Try Try Me.TabPage2.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC2) Catch ex As Exception MessageBox.Show("Background -2 Image Missing End Try Try Me.TabPage3.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC3) Catch ex As Exception MessageBox.Show("Background -3 Image Missing End Try Try Me.TabPage4.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC4) Catch ex As Exception MessageBox.Show("Background -4 Image Missing End Try Try Me.TabPage5.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC5) Catch ex As Exception MessageBox.Show("Background -5 Image Missing End Try Try Me.TabPage6.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC6) Catch ex As Exception MessageBox.Show("Background -6 Image Missing End Try End Sub ' DELETE / ACTION COMPONENTS }

154

")

")

")

")

")

")

154

Appendix VI: SCADA Code

Public Sub KPRESS(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Dim ky As Object = sender Dim i As Integer i = ky.Tag If DAT(i, 7) = "ANALOG_R/W" And DAT(i, 6) = "W-" And Me.Text = " Comm Ok " Then COMM1.WRegister(Convert.ToInt16(DAT(i, 5)), COMPONENTS1.NUM(i).Value) End If End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Timer1.Enabled = False COMM1.CONNECT() ' CHECK COMMUNICATION If Me.Text = " Comm Ok " Then START() Timer2.Enabled = True Else START() Me.Text = " Comm Err " Timer2.Enabled = False End If End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Dim Z As Integer Dim R(124, 1), G(124, 1) As Integer Me.EDIT.Text = " " If Me.Text = " Comm Ok " Then If SAVECOUNT < 100 Then SAVECOUNT = SAVECOUNT + 1 Else SAVECOUNT = 0 End If COMM1.ReadIn() COMM1.ReadOutPuts() Try For I = 0 To DBASE_COMPONENTS_1.INT1 'If DAT(I, 7) = "DIGITAL_I/O" Then ' COMPONENTS1.LB(I).Visible = False 'End If If DAT(I, 7) = "DIGITAL_I/O" And DAT(I, 6) = "IH-" Then COMPONENTS1.LB(I).Visible = COMM1.IP(Convert.ToInt16(DAT(I, 5))) End If If DAT(I, 7) = "DIGITAL_I/O" And DAT(I, 6) = "IL-" Then COMPONENTS1.LB(I).Visible = Not (COMM1.IP(Convert.ToInt16(DAT(I, 5)))) End If If DAT(I, 7) = "DIGITAL_I/O" And DAT(I, 6) = "OH-" Then COMPONENTS1.LB(I).Visible = COMM1.OP(Convert.ToInt16(DAT(I, 5))) End If

155

155

Appendix VI: SCADA Code

If DAT(I, 7) = "DIGITAL_I/O" And DAT(I, 6) = "OL-" Then COMPONENTS1.LB(I).Visible = Not (COMM1.OP(Convert.ToInt16(DAT(I, 5)))) End If Next Catch ex As Exception Me.EDIT.Text = ex.Message TextBox2.Text = ex.Message End Try For I = 0 To DBASE_COMPONENTS_1.INT1 Try 'if value of set components more give error message only If DAT(I, 7) = "ANALOG_R/W" And DAT(I, 6) = "R-" And Me.Text = " Comm Ok " Then Z = Convert.ToInt16(DAT(I, 5)) If R(Z, 0) = 0 Then COMM1.RRegister(Z) R(Z, 1) = COMM1.RMNV If Z < 11 Then If SAVECOUNT = 0 Then SAVECOUNT = 1 If SAVED(1) + SAVED(2) + SAVED(3) + SAVED(4) + SAVED(5) + SAVED(6) + SAVED(7) + SAVED(8) + SAVED(9) + SAVED(10) > 100 Then DBASE_SAVE1.APPENDDBASE(SAVED(1) / 100, SAVED(2) / 100, SAVED(3) / 100, SAVED(4) / 100, SAVED(5) / 100, SAVED(6) / 100, SAVED(7) / 100, SAVED(8) / 100, SAVED(9) / 100, SAVED(10) / 100) End If SAVED(1) = 0 SAVED(2) = 0 SAVED(3) = 0 SAVED(4) = 0 SAVED(5) = 0 SAVED(6) = 0 SAVED(7) = 0 SAVED(8) = 0 SAVED(9) = 0 SAVED(10) = 0 End If SAVED(Z) = SAVED(Z) + R(Z, 1) End If End If R(Z, 0) = 1 End If Catch ex As Exception Me.EDIT.Text = ex.Message TextBox2.Text = ex.Message End Try Try 'if value of set components more give error message only If DAT(I, 7) = "GAUGE" Or DAT(I, 7) = "LEDV" Or DAT(I, 7) = "LEDH" And Me.Text = " Comm Ok " Then Z = Convert.ToInt16(DAT(I, 5)) If G(Z, 0) = 0 Then COMM1.RRegister(Z) G(Z, 1) = COMM1.RMNV End If

156

156

Appendix VI: SCADA Code

G(Z, 0) = 1 End If Catch ex As Exception Me.EDIT.Text = ex.Message TextBox2.Text = ex.Message End Try Try 'if value of set components more give error message only If DAT(I, 7) = "ANALOG_R/W" And DAT(I, 6) = "R-" And Me.Text = " Comm Ok " Then If R(Z, 1) > 0 Then COMPONENTS1.TB(I).Text = R(Z, 1) / DAT(I, 14) Else COMPONENTS1.TB(I).Text = R(Z, 1) End If ElseIf DAT(I, 7) = "GAUGE" And Me.Text = " Comm Ok " Then COMPONENTS1.gaug(I).Value = G(Z, 1) COMPONENTS1.gaug(I).DialText = "" COMPONENTS1.gaug(I).DialText = G(Z, 2) ElseIf DAT(I, 7) = "LEDV" And Me.Text = " Comm Ok " Then COMPONENTS1.LDV(I).Value = G(Z, 1) ElseIf DAT(I, 7) = "LEDH" And Me.Text = " Comm Ok " Then COMPONENTS1.LDH(I).Value = G(Z, 1) End If Catch ex As Exception Me.EDIT.Text = ex.Message TextBox2.Text = ex.Message End Try Next End If End Sub Private Sub TabPage7_Click(sender As Object, e As EventArgs) Handles EDIT.Click Try If InputBox("Please Enter Administion Password " + Label1.Text + "", "Password Entry", "") = My.Settings.PASS Then Panel2.Enabled = True MenuStrip1.Visible = True XXX = 1 Else If InputBox("Please Enter Administion New Password ", "New Password Entry", "") = Label2.Text Then Panel2.Enabled = True My.Settings.PASS = Label2.Text My.Settings.Save() MessageBox.Show("NEW PASSWORD SAVED") XXX = 1 End If End If Catch ex As Exception End Try End Sub ' PASSWORD CHECK Private Sub CHECK() Dim R, R0, R1 As Int32

157

157

Appendix VI: SCADA Code

R = TimeOfDay.Second R0 = TimeOfDay.Minute If R < 10 Then R = TimeOfDay.Second + 10 End If R1 = (R0) Label1.Text = R1.ToString Label2.Text = 4 * R0.ToString If (My.Settings.PASS = 0) Then If InputBox("Please Enter Administion Password " + Label1.Text + "", "Password Entry", "") = Label2.Text.ToString Then My.Settings.PASS = 40 My.Settings.Save() Else Close() End If End If End Sub ' SCREEN1 ON/OFF Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked Then My.Settings.pg1 = True Else My.Settings.pg1 = False End If My.Settings.Save() End Sub ' SCREEN2 ON/OFF Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged If CheckBox2.Checked Then My.Settings.pg2 = True Else My.Settings.pg2 = False End If My.Settings.Save() End Sub Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged If CheckBox3.Checked Then My.Settings.pg3 = True Else My.Settings.pg3 = False End If My.Settings.Save() End Sub Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged If CheckBox4.Checked Then My.Settings.pg4 = True Else My.Settings.pg4 = False End If My.Settings.Save() End Sub Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged If CheckBox5.Checked Then

158

158

Appendix VI: SCADA Code

My.Settings.pg5 = True Else My.Settings.pg5 = False End If My.Settings.Save() End Sub Private Sub CheckBox6_CheckedChanged(sender As EventArgs) Handles CheckBox6.CheckedChanged If CheckBox6.Checked Then My.Settings.pg6 = True Else My.Settings.pg6 = False End If My.Settings.Save() End Sub Private Sub TabPage1_Click(sender As Object, e Handles TabPage1.Click CON1 = 1 MenuStrip1.Parent = TabPage1 ProgressBar1.Parent = TabPage1 VProgressBar3.Parent = TabPage1 NumericUpDown1.Parent = TabPage1 TextBox3.Parent = TabPage1 Button1.Parent = TabPage1 COMPO.Parent = TabPage1 AquaGauge1.Parent = TabPage1 End Sub Private Sub TabPage2_Click(sender As Object, e Handles TabPage2.Click CON1 = 2 MenuStrip1.Parent = TabPage2 NumericUpDown1.Parent = TabPage2 ProgressBar1.Parent = TabPage2 VProgressBar3.Parent = TabPage2 Button1.Parent = TabPage2 COMPO.Parent = TabPage2 AquaGauge1.Parent = TabPage2 TextBox3.Parent = TabPage2 End Sub Private Sub TabPage3_Click(sender As Object, e Handles TabPage3.Click CON1 = 3 MenuStrip1.Parent = TabPage3 NumericUpDown1.Parent = TabPage3 ProgressBar1.Parent = TabPage3 VProgressBar3.Parent = TabPage3 Button1.Parent = TabPage3 COMPO.Parent = TabPage3 AquaGauge1.Parent = TabPage3 TextBox3.Parent = TabPage3 End Sub Private Sub TabPage4_Click(sender As Object, e Handles TabPage4.Click CON1 = 4 MenuStrip1.Parent = TabPage4 NumericUpDown1.Parent = TabPage4 ProgressBar1.Parent = TabPage4 VProgressBar3.Parent = TabPage4 Button1.Parent = TabPage4

159

Object, e As

As EventArgs)

As EventArgs)

As EventArgs)

As EventArgs)

159

Appendix VI: SCADA Code

COMPO.Parent = TabPage4 AquaGauge1.Parent = TabPage4 TextBox3.Parent = TabPage4 End Sub Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click CON1 = 5 ProgressBar1.Parent = TabPage5 MenuStrip1.Parent = TabPage5 VProgressBar3.Parent = TabPage5 NumericUpDown1.Parent = TabPage5 Button1.Parent = TabPage5 COMPO.Parent = TabPage5 AquaGauge1.Parent = TabPage5 TextBox3.Parent = TabPage5 End Sub Private Sub TabPage6_Click(sender As Object, e As EventArgs) Handles TabPage6.Click CON1 = 6 MenuStrip1.Parent = TabPage6 NumericUpDown1.Parent = TabPage6 ProgressBar1.Parent = TabPage6 VProgressBar3.Parent = TabPage6 Button1.Parent = TabPage6 COMPO.Parent = TabPage6 TextBox3.Parent = TabPage6 AquaGauge1.Parent = TabPage6 End Sub Private Sub EXT_Click(sender As Object, e As EventArgs) Handles EXT.Click Close() End Sub Private Sub BACKGROUND_Click(sender As Object, e As EventArgs) Handles BACKGROUND.Click Dim fd As OpenFileDialog = New OpenFileDialog() Try fd.Title = "Open File Dialog" fd.InitialDirectory = "C:\" fd.Filter = "All files (*.*)|*.jpg" fd.FilterIndex = 2 fd.RestoreDirectory = True If fd.ShowDialog() = DialogResult.OK Then If CON1 = 1 Then My.Settings.PIC1 = fd.FileName My.Settings.Save() ElseIf CON1 = 2 Then My.Settings.PIC2 = fd.FileName My.Settings.Save() ElseIf CON1 = 3 Then My.Settings.PIC3 = fd.FileName My.Settings.Save() ElseIf CON1 = 4 Then My.Settings.PIC4 = fd.FileName My.Settings.Save() ElseIf CON1 = 5 Then My.Settings.PIC5 = fd.FileName My.Settings.Save() ElseIf CON1 = 6 Then My.Settings.PIC6 = fd.FileName

160

160

Appendix VI: SCADA Code

My.Settings.Save() End If End If Catch ex As Exception End Try 'SCREENS BACKGROUND IMAGE Try Me.TabPage1.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC1) Catch ex As Exception MessageBox.Show("Background -1 Image Missing ") End Try Try Me.TabPage2.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC2) Catch ex As Exception MessageBox.Show("Background -2 Image Missing ") End Try Try Me.TabPage3.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC3) Catch ex As Exception MessageBox.Show("Background -3 Image Missing ") End Try Try Me.TabPage4.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC4) Catch ex As Exception MessageBox.Show("Background -4 Image Missing ") End Try Try Me.TabPage5.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC5) Catch ex As Exception MessageBox.Show("Background -5 Image Missing ") End Try Try Me.TabPage6.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.PIC6) Catch ex As Exception MessageBox.Show("Background -6 Image Missing ") End Try End Sub Private Sub IPATEXT_DoubleClick(sender As Object, e As EventArgs) Handles IPA_TEXT.DoubleClick Dim DRESULT As DialogResult = MessageBox.Show("IP Address ", " Save the new IP Address ?", MessageBoxButtons.YesNo) If DRESULT = DialogResult.Yes Then My.Settings.IPA = IPA_TEXT.Text My.Settings.Save() COMM1.CONNECT() End If End Sub Private Sub ComboSCAN_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboSCAN.SelectedIndexChanged Timer2.Interval = Convert.ToInt16(ComboSCAN.SelectedItem) End Sub Private Sub LABEL_Click(sender As Object, e As EventArgs) Handles LABEL.Click

161

161

Appendix VI: SCADA Code

LIMITS.Visible = False COMPO.Text = "LABEL" COMPO.Font = New Font("Sans Serif", TS, FontStyle.Regular) If NM Nothing Then COMPO.Text = NM COMPONANTS = "TEXT" NumericUpDown1.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = False Button1.Visible = False COMPO.Visible = True TextBox3.Visible = False AquaGauge1.Visible = False XSIZ.Visible = False YSIZ.Visible = False TSIZ.Visible = True TXT.Visible = True TYPE.Visible = False FCOLOR.Visible = True BCOLOR.Visible = True SAVE.Visible = True ASSIGN.Visible = True End Sub Private Sub DIGITALIO_Click(sender As Object, e As EventArgs) Handles DIGITALIO.Click LIMITS.Visible = False COMPO.Text = "DIGITAL" COMPO.Font = New Font("Sans Serif", TS, FontStyle.Regular) If NM Nothing Then COMPO.Text = NM COMPONANTS = "DIGITAL_I/O" NumericUpDown1.Visible = False AquaGauge1.Visible = False Button1.Visible = False COMPO.Visible = True ProgressBar1.Visible = False VProgressBar3.Visible = False TextBox3.Visible = False XSIZ.Visible = False YSIZ.Visible = False TSIZ.Visible = True TXT.Visible = True TYPE.Visible = True FCOLOR.Visible = True BCOLOR.Visible = True SAVE.Visible = True ASSIGN.Visible = True End Sub Private Sub BUTTON_Click(sender As Object, e As EventArgs) Handles BUTTON.Click COMPONANTS = "BUTTON" Button1.Visible = True NumericUpDown1.Visible = False LIMITS.Visible = False COMPO.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = False AquaGauge1.Visible = False XSIZ.Visible = True YSIZ.Visible = True TSIZ.Visible = True

162

162

Appendix VI: SCADA Code

TextBox3.Visible = False TXT.Visible = True TYPE.Visible = False FCOLOR.Visible = True BCOLOR.Visible = True SAVE.Visible = True ASSIGN.Visible = True LIMITS.Visible = False End Sub Private Sub ANALOGER_Click(sender As Object, e As EventArgs) Handles ANALOGER.Click NM = "000" STP = 1 TYP = "R-" COMPO.Text = "999" COMPO.Font = New Font("Sans Serif", TS, FontStyle.Regular) COMPONANTS = "ANALOG_R/W" NumericUpDown1.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = False AquaGauge1.Visible = False Button1.Visible = False COMPO.Visible = False TextBox3.Visible = True TXT.Visible = False TYPE.Visible = False LIMITS.Visible = True XSIZ.Visible = True YSIZ.Visible = False TSIZ.Visible = True End Sub Private Sub ANALOGEW_Click(sender As Object, e As EventArgs) Handles ANALOGEW.Click STP = 1 NM = "NUM" TYP = "W-" TT = 25 LIMITS.Visible = True DIVIDE.Visible = True COMPO.Text = "ANALOGE_W" COMPONANTS = "ANALOG_R/W" NumericUpDown1.Visible = True TextBox3.Visible = False Button1.Visible = False COMPO.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = False AquaGauge1.Visible = False TXT.Visible = False TYPE.Visible = False XSIZ.Visible = True YSIZ.Visible = False TSIZ.Visible = True FCOLOR.Visible = True BCOLOR.Visible = True SAVE.Visible = True ASSIGN.Visible = True End Sub

163

163

Appendix VI: SCADA Code

Private Sub GAUGE_Click(sender As Object, e As EventArgs) Handles GAUGE.Click MN = 0 COMPONANTS = "GAUGE" LIMITS.Visible = True DIVIDE.Visible = False COMPO.Visible = False Button1.Visible = False NumericUpDown1.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = False TYP = "R-" TextBox3.Visible = False TXT.Visible = True TYPE.Visible = False FCOLOR.Visible = True BCOLOR.Visible = True SAVE.Enabled = True ASSIGN.Enabled = True XSIZ.Visible = True YSIZ.Visible = False TSIZ.Visible = True AquaGauge1.Visible = True End Sub Private Sub LEDV_Click(sender As Object, e As EventArgs) Handles LEDV.Click NM = "LEDV" FCLR = "BLACK" BCLR = "WHITE" Width = 50 Height = 100 COMPONANTS = "LEDV" LIMITS.Visible = True TextBox3.Visible = False DIVIDE.Visible = False COMPO.Visible = False Button1.Visible = False NumericUpDown1.Visible = False ProgressBar1.Visible = False VProgressBar3.Visible = True AquaGauge1.Visible = False TYP = "R-" TXT.Visible = False TYPE.Visible = False FCOLOR.Visible = False BCOLOR.Visible = False SAVE.Enabled = True ASSIGN.Enabled = True XSIZ.Visible = True YSIZ.Visible = True TSIZ.Visible = False End Sub Private Sub LEDH_Click(sender As Object, e As EventArgs) Handles LEDH.Click NM = "LEDH" FCLR = "BLACK" BCLR = "WHITE" COMPONANTS = "LEDH" LIMITS.Visible = True

164

164

Appendix VI: SCADA Code

DIVIDE.Visible = False COMPO.Visible = False Button1.Visible = False NumericUpDown1.Visible = False ProgressBar1.Visible = True VProgressBar3.Visible = False AquaGauge1.Visible = False TextBox3.Visible = False TYP = "R-" TXT.Visible = False TYPE.Visible = False FCOLOR.Visible = False BCOLOR.Visible = False SAVE.Enabled = True ASSIGN.Enabled = True XSIZ.Visible = True YSIZ.Visible = True TSIZ.Visible = False End Sub Private Sub TXTBox_TextChanged(sender As Object, e As EventArgs) Handles TXTBox.TextChanged NM = TXTBox.Text COMPO.Text = NM Button1.Text = NM AquaGauge1.DialText = NM End Sub Private Sub COMBOTYPE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles COMBOTYPE.SelectedIndexChanged If COMBOTYPE.SelectedIndex = 0 Then TYP = "IH-" ElseIf COMBOTYPE.SelectedIndex = 1 Then TYP = "IL-" ElseIf COMBOTYPE.SelectedIndex = 2 Then TYP = "OH-" ElseIf COMBOTYPE.SelectedIndex = 3 Then TYP = "OL-" End If End Sub Private Sub XSIZE_TextChanged(sender As Object, e As EventArgs) Handles XSIZE.TextChanged Try Convert.ToInt16(XSIZE.Text) Catch ex As Exception XSIZE.Text = "20" End Try XS = Convert.ToInt16(XSIZE.Text) If XS < 1 Then XS = 1 If XS > 60 Then XS = 60 Button1.Width = 5 * XS NumericUpDown1.Width = 5 * XS AquaGauge1.Width = 5 * XS + 50 AquaGauge1.MaxValue = 9 AquaGauge1.MaxValue = 100 TextBox3.Width = 5 * XS ProgressBar1.Width = 5 * XS VProgressBar3.Width = 5 * XS End Sub Private Sub YSIZE_TextChanged(sender As Object, e As EventArgs) Handles YSIZE.TextChanged

165

165

Appendix VI: SCADA Code

Try Convert.ToInt16(YSIZE.Text) Catch ex As Exception YSIZE.Text = "5" End Try YS = Convert.ToInt16(YSIZE.Text) If YS < 1 Then YS = 1 If YS > 60 Then YS = 40 Button1.Height = 5 * YS ProgressBar1.Height = 5 * YS VProgressBar3.Height = 5 * YS End Sub Private Sub TSIZE_TextChanged(sender As Object, e As EventArgs) Handles TSIZE.TextChanged Try Convert.ToInt16(TSIZE.Text) Catch ex As Exception TSIZE.Text = "20" End Try TS = Convert.ToInt16(TSIZE.Text) If TS < 10 Then TS = 10 If TS > 60 Then TS = 60 COMPO.Font = New Font("Sans Serif", TS, FontStyle.Regular) COMPO.AutoSize = True Button1.Font = New Font("Sans Serif", TS, FontStyle.Regular) NumericUpDown1.Font = New Font("Sans Serif", TS, FontStyle.Regular) AquaGauge1.Font = New Font("Sans Serif", TS, FontStyle.Regular) AquaGauge1.Width = 5 * XS + 50 AquaGauge1.MaxValue = 9 AquaGauge1.MaxValue = 100 TextBox3.Font = New Font("Sans Serif", TS, FontStyle.Regular) End Sub Private Sub COMBOASSIGN_SelectedIndexChanged(sender As Object, e As EventArgs) Handles COMBOASSIGN.SelectedIndexChanged ASS = COMBOASSIGN.SelectedIndex + 1 End Sub Private Sub COMBOFCOLOR_SelectedIndexChanged(sender As Object, e As EventArgs) Handles COMBOFCOLOR.SelectedIndexChanged FCLR = COMBOFCOLOR.SelectedItem.ToString COMPO.ForeColor = Color.FromName(FCLR) VProgressBar3.ForeColor = Color.FromName(FCLR) ProgressBar1.ForeColor = Color.FromName(FCLR) Button1.ForeColor = Color.FromName(FCLR) NumericUpDown1.ForeColor = Color.FromName(FCLR) AquaGauge1.DialColor = Color.FromName(FCLR) AquaGauge1.MaxValue = 9 AquaGauge1.MaxValue = 100 TextBox3.ForeColor = Color.FromName(FCLR) End Sub Private Sub COMBOBCOLOR_SelectedIndexChanged(sender As Object, e As EventArgs) Handles COMBOBCOLOR.SelectedIndexChanged BCLR = COMBOBCOLOR.SelectedItem.ToString Try COMPO.BackColor = Color.FromName(BCLR) Button1.BackColor = Color.FromName(BCLR) AquaGauge1.BackColor = Color.FromName(BCLR)

166

166

Appendix VI: SCADA Code

AquaGauge1.MaxValue = 9 AquaGauge1.MaxValue = 100 TextBox3.BackColor = Color.FromName(BCLR) NumericUpDown1.BackColor = Color.FromName(BCLR) Catch ex As Exception End Try End Sub Private Sub SAVE_Click(sender As Object, e As EventArgs) Handles SAVE.Click Dim DRESULT As DialogResult = MessageBox.Show("UPDATE DBASE ", " Save Component ?", MessageBoxButtons.YesNo) If DRESULT = DialogResult.Yes Then If NM "" And FCLR "" And BCLR "" And ASS >= 0 And XX 0 And YY 0 Then Try DBASE_COMPONENTS_1.COMP(1) = XX.ToString DBASE_COMPONENTS_1.COMP(2) = YY.ToString DBASE_COMPONENTS_1.COMP(3) = NM DBASE_COMPONENTS_1.COMP(4) = TS DBASE_COMPONENTS_1.COMP(5) = BCLR DBASE_COMPONENTS_1.COMP(6) = ASS.ToString DBASE_COMPONENTS_1.COMP(7) = TYP DBASE_COMPONENTS_1.COMP(8) = COMPONANTS DBASE_COMPONENTS_1.COMP(9) = MX.ToString DBASE_COMPONENTS_1.COMP(10) = MN.ToString DBASE_COMPONENTS_1.COMP(11) = FCLR DBASE_COMPONENTS_1.COMP(12) = CON1.ToString DBASE_COMPONENTS_1.COMP(13) = XS DBASE_COMPONENTS_1.COMP(14) = YS DBASE_COMPONENTS_1.COMP(15) = STP DBASE_COMPONENTS_1.APPENDDBASE() TXTBox.Text = "" NM = "" BCLR = "" ASS = Nothing Me.TabPage1.Controls.Clear() START() Catch ex As Exception MessageBox.Show(ex.ToString) End Try Else MessageBox.Show("ONE OR MORE FIELD EMPTY ") End If End If End Sub Private Sub LOWERV_DoubleClick(sender As Object, e As EventArgs) Handles LOWERV.DoubleClick Try MN = Convert.ToInt16(LOWERV.Text) Catch ex As Exception LOWERV.Text = "0" MN = 0 End Try If MX

Suggest Documents