- 1. INTRODUCTION
- 2. RELATED WORK
- 3. ANALYSIS AND MODELLING
- 3.2 Modelling and Design
- 4. IMPLEMENTATION AND TESTING
- 5. SECURITY
- 6. CONCLUSION AND SUGGESTIONS
To people who want to make the world a better place
First of all, we would like to express our deep thankfulness to our supervisor, Dr. Ali Fuat ERGENÇ for guiding us though his advices and knowledge as well as sharing his valuable experiences with us. Also, we would like to thank to our families and friends who supports us in any case. We would also like to thank Rockwell Automation for providing us with the industrial equipment we use in our lab and to Baran Mat, who opened up different horizons for us about IoT solutions.
Emir Ercan Ayar & Onurcan Akıncı
API : Application Programming Interface
IoT : Internet of Things
CPS : Cyber Physical Systems
IoS : Internet of Services
HMI : Human Machine Interface
PLC : Programmable Logic Controller
RAMI : Reference Architecture Model Industrie
IT : Information Technologies
RFID : Radio Frequency Identification
FPSO : Floating Production Storage and Offloading Unit
OEM : Original Equipment Manufacturer
CNC : Computer Numerical Control
OPC : OLE for Process Control
OLE : Object Linking & Embedding
COM : Component Object Model
OPC-DA : OLE for Process Control - Data Access
IP : Internet Protocol
MQTT : Message Queuing Telemetry Transport
M2M : Machine to Machine
TCP : Transmission Control Protocol
AWS : Amazon Web Services
CEP : Complex Event Processing
SQL : Structured Query Language
SCADA : Supervisory Control and Data Acquisition
Figure 1.1 : An example cyber physical system
Figure 2.1 : Layers of RAMI 4.0
Figure 2.2 : Connected airport security scenerio
Figure 2.3 : Integration of machine learning scenarios into industrial systems
Figure 3.1 : Structure of industrial automation and input / output interface
Figure 3.2 : Human-Machine Interface
Figure 3.3 : General infrastructure of the platform
Figure 3.4 : Detailed infrastructre of the platform
Figure 3.5 : Industrial field layer
Figure 3.6 : PLC program
Figure 3.7 : RSLinx OPC topic configuration
Figure 3.8 : Assigning the IP address to the OPC topic
Figure 3.9 : Testing OPC data with OPC Test Client Tool
Figure 3.10 : Connectivity layer
Figure 3.11 : MQTT messaging method visualization
Figure 3.12 : OPC-MQTT gateway runtime
Figure 3.13 : Cloud layer
Figure 3.14 : Lamp relay control blocks on Node-RED
Figure 3.15 : Siddhi complex event processing engine infrastructure
Figure 3.16 : Node-RED flow for Siddhi integration
Figure 3.17 : Siddhi CEP engine and stream outputs
Figure 3.18 : Platform output remote controlling interface, Sensor data monitoring interface
With the Industry 4.0, in other words the 4th Industrial Revolution, production processes are undergoing a transformation. While new software and hardware solutions for digital transformation are emerging, also existing industrial systems and solutions are being integrated to this transformation. In this project, an connected smart software platform has been developed that can meet the needs of the Industry 4.0. This platform enables both the development of new Industry 4.0 solutions and the adaptation of existing solutions to Industry 4.0 without the need for extra hardware setup. With the integration of the platform, industrial hardware has gained the ability to make decisions about complex processes by combining the data they have obtained from the hardware and the internet, by becoming internet connected without losing their existing capabilities. Introducing the data in the industrial systems to the internet network and sending back the data in the network to the industrial system makes possible to apply big data, hence machine learning and deep learning solutions on industrial systems. This platform offers the easy integration of high-end technology solutions into industrial systems.
Platform called “Application-Independent Industry 4.0 Based Connected Smart Platform”; is an integration and software solution which can operate on cloud-based, has various protocol gateways and API endpoints to communicate with industrial-grade hardware, can combine data from different data sources, process these data on complex event processing engines and lastly, can store or send the result data from its own to field devices. Platform is integrated to two geographically distinct industrial systems which is working at present, located in Turkey and China. Results of the integration and its benefits was observed on these systems. It has been noted that this integration is done with existing devices without the use of external hardware, to achieve flexible integration capabilities.
The platform obtained at the end of the work is an open source, easy-to-contribute, scalable software solution that can be used freely to provide that existing or new industry solutions act in high efficiency and competitive in compatible with the 4th industrial revolution, without any brand or infrastructure dependency.
Internet connected devices which with increasing day-by-day make internet ecosystem wider and efficient for not only humans but also devices and things. Making a device connected enables remote management, integrations, analytics and more. Like consumer electronics, also industrial systems can benefit from the phenomenon called the 4th industrial revolution wave.
On this project, an industrial local system will be connected to internet. Thus, the data which previously stays only on local will be online and benefit in many different ways like logging, real-time processing, analysis, behaviour recognition and more.
1.1 Vision and Scope
1.1.1 Industry 4.0 vision
The term Industry 4.0 comes from a combination of major innovations in the digital technology and hardware automations. A wide definition of industry 4.0 is quoted from Hermann  as:
“Industrie 4.0 is a collective term for technologies and concepts of value chain organization. Within the modular structured Smart Factories of Industrie 4.0, Cyber-Physical Systems monitor physical processes, create a virtual copy of the physical world and make decentralized decisions. Over the IoT, CPS communicate and cooperate with each other and humans in real time. Via the IoS, both internal and cross-organizational services are offered and utilized by participants of the value chain”.
While industry 4.0 is shaping manufacturing and whole production processes, on the other hand Internet of Things solutions and devices cover not only industrial field, but also the consumer product field and common services field. According to the estimations from academicians and industry leaders, there will be 50 billion connected devices or “things” by the next decade. 
The fourth industrial revolution and the other technologies it brings together focus on integrating the industrial systems in a holistic way to achieve the most efficient result possible. Basically, the objective is to make a decision of an industrial system and to produce it not only with its own data sources, but also with other devices and systems with which it connects. The systems that can provide this capability are also name as a cyber-physical systems. Cyber-physical systems are the main actors of the industry 4.0 philosophy and include software systems, communication technologies, sensors / actuators, including embedded technologies, to interact with the real world.  A cyber-physical system within an industry 4.0 scenario can be represented as in Figure 1.1. 
The point where a system that takes value from being connected to a network with each other will make a difference on the quality, flexibility and capabilities of this connectivity. In this respect, between two industrial systems which have the same physical capacity and capability as each other, the 4th industrial revolution promise greater productivity to the industrial system which able to process data better and work more integrated.
Given the unlimited integration and yield that the Industry 4.0 has created in the industry, it has been seen that software and integration platforms that will bring out the most efficient industrial system by meeting the needs of production sites are a fundamental requirement for an industry 4.0 application. 
The platform realized in this project is designed to meet Industry 4.0 requirements and compatibility of an industrial system. A newly established industrial system can be utilized by integrating this platform, or an existing system that is working can be integrated into this platform to achieve the possibilities of industry 4.0 technology. These opportunities and needs can be recovered as follows. ;
Ability to collect physical data with sensors and influence physical processes with actuators
Ability to evaluate and store the collected data both reactive and actively, to be able to process both the physical and digital media with this data
Connected via digital communication with other devices and global networks (wireless and / or wired, local and / or global)
Use globally accessible data and services
Having customized human-machine interfaces (HMI)
1.1.2. Aim & scope
The data stays only local on typical industrial solutions. Making these data online by integrating the industrial system to cloud creates a new feedback way to the local system. On cloud, first step is remote control and monitoring of the local system which is just a short-term benefit. Moreover, real-time data analysis can generate better decisions about the local process. In addition to this, long-term data analysis can be performed continuously on cloud to extract behavioral data from the system which not easy with PLC's. The connected smart manufacturing platform solution's aim can be expressed as make industrial solutions be aware of online data and provide complex decisions using combined data from cloud and devices.
Along with the integration of an industrial system into the platform of the project output, differences and advantages are gained in many points, especially the following factors.
In the industrial system only locally available information can be accessed and controlled on the internet network
Capable of making complex decisions by analyzing the data that can be processed with a wide variety of tools using the data cloud facilities that are made accessible on the platform and combining the data obtained from the analysis result
Apply decisions on industrial systems using different data sources in the cloud server
Move the industrial system to a competitive point in terms of efficiency by using the cost advantage of cloud computing compared to the resource and processing constraints of the controller units used in the industrial system
The platform that emerges from the project differs from the industry 4.0 software platforms currently used at many points, especially the following factors.
Integrate existing industrial solutions with legacy communication methods without the need for an external hardware add-on
Provide interdisciplinary experience by introducing tools that solve similar needs outside the industry in different areas of industry instead of offering customized tools for industry 4.0 solutions
2. RELATED WORK
Getting know about existing ideas and applications in the market will help understanding about the new platform's positioning among them. The platform is an Industry 4.0 solution which integrates IoT technology, cloud and existing automation systems.
2.1 Works in Literature
a. RAMI 4.0
The leading solutions in the field of Industry 4.0 are able to meet a wide range of approaches, expectations and content. But with the developments in place, the diversity of the demands makes it much more difficult to choose. At this point, RAMI, stands for Reference Architecture Model Industrie 4.0, proposed for the first time in 2015, is a recommended solution for classifying all these methods and standards on a single base. There are 3 different axes in the structure. The vertical axis is used for IT components in Industry 4.0. The left horizontal axis is used to show the lifespan of the products. Finally, the right horizontal axis shows the responsibilities and burdens that the product's business needs to carry. Thus, with these layers, industry 4.0 solutions and the sub-elements they contain can be classified and analyzed more accurately. The RAMI 4.0 structure and layers can be seen in Figure 2.1.
The IT (vertical) layers of the RAMI 4.0 standard have been taken into account in the development of the platform. The layers of the platform fully cover the IT layers of the RAMI 4.0 standard. 
b. A Connected Solution for Airport Security
Airports are sophisticated structures because of the security importance between countries. This characteristics of airports bring problems may because of communication between sections or the amount of security rules. There is an IoT solution for that in the literature used with the robots. Robots will handle the jobs which supposed to done with human power, with complex IoT network infrastructure. The paper says: “A number of robots is distributed in the environment to perform management, control, surveillance, inspection, and rescue tasks.". One group of robots will generate data, command and information, the other group will just take care with the messages between first group. The scenerio can be summarized as shown on Figure 2.2. 
c. China's Traffic Problem
The number of vehicles is increasing so fast because of the good economy in China. This effects people's life crucially. So there is an IoT solution for that situation which presented in Chinese Control and Decision Conference (CCDC). The main principle of the solution is reading the real-time datas of cars when they are running on the road on RFID. Also that technology will not effect from rain, snow or any bad weather. Minghe Yu quotes: “The system will have wide applications in traffic IoT (Internet of Things) to support traffic monitoring, traffic flow statistics, traffic scheduling, and special vehicle tracking.” 
d. Cyber-physical systems and Cloud
The concept of the cyber-physical system mentioned before is one of the basic building blocks of the industry 4.0 solutions. There are different ways to connect these systems to the internet, and in the reference work these different ways are defined as direct system extension, microcontroller extension and intelligent actuator and sensor extension. 
The method of access the platform of the project to the cloud provided with the method called “direct system extension” in this study. This method is described as the direct connection of the control unit to which all other parts of the system are connected, and thus the system can be controlled via the cloud.
2.2. Works in Industry
a. Oil and Gas industry
In the Barents Sea of Norway, world's biggest and most complicated FPSO has builded for produce oil and gas. This station brought the problems of safety and controlling the whole system. ABB solved the problems with the IoT solutions. They connected the platform to the vessels within a range of 10 km instead of usual data links and made it possible to manage and monitor from these distance. Wireless systems used for monitoring the rotating equipment on board which uses for producing. After the solutions, production efficiency increased and energy consumption decreased in the large amounts. 
b. High-end technology solutions in industrial systems
The fact that the data in the industrial systems goes into the internet network and the data in the network can be applied to the industrial system; big data and therefore machine learning and deep learning solutions can be applied in industrial systems. The platform from which this project is launched allows the aforementioned high-end technology solutions to be easily integrated into industrial systems.
Figure 2.3 shows an example of how a machine learning or deep learning model might be positioned in an industrial system.  Similar scenarios can be easily integrated into the platform to solve learning based problems on cloud.
The platform; has a close relationship with computer science and information technologies because of the communication layer over the communication protocols and standards, includes the information systems and the statistical information through data analysis and complex event processing, and the whole platform working on the cloud.
c. HIROTEC's Smart Manufacturing Solution
The Hirotec Group is well known automotive manufacturing equipment and parts supplier which worth is $1.6B. Two of the company's major problems are ensure continuous operations and minimize unplanned downtime in its manufacturing facilities. These problems puts the company at risk of being late on their timetables.“According to industry benchmarks, in North America, the cost of unplanned downtime to automobile OEMs is $1.3M per hour. That's $361 per second. If it takes a 3 minute phone call to report an issue, you can lose $70,000 just to tell someone you have a problem.” said by Justin Hester, Senior Researcher – IoT Laboratory, HIROTEC Corporation. HIROTEC found a solution partner which is PTC. With the help of PTC, they managed the complete the three pilots of the IoT platform. These pilots are capturing and analyzing the data from eight CNC machines in Detroit plant of production line also visualizing the automated inspection line with the use of robots, laser measurement devices and cameras. After that, the company has paperless report generation and real-time visibility for the whole automobile door production facility
The solution also provides to the company predict with machine learning and prevent failures in the future works with analysing the historical data and learning from that therewithal improve the imperfections. 
3. ANALYSIS AND MODELLING
3.1.1. Analysis of the problem
The problem which decided to be solved with this project is being unaware of existing industrial systems’ with online data. If industrial systems can connect to global internet, they can benefit from online data and can have an Industry 4.0 solution's advantages.
The developed application-independent Industry 4.0 platform has been tested by integration with a sample industrial system. This industrial system is the industrial controller system in Istanbul Technical University, Control and Automation Laboratory where lighting system and sensors are connected.
3.1.2. Analysis of the environment
On test laboratory (Istanbul Technical University, Power and Motion Control Laboratory) there is an existing industrial solution to control lighting system. There are 12 lamps which currently being used. Also 9 motion sensors equipped homogeneously positioned on the ceiling. But not being used on the software before.
In the test system, an Allen-Bradley Compact GuardLogix L43S model PLC with input/output interface which shown in Figure 3.1 and a human-machine interface (HMI) also shown in Figure 3.2 are installed where the illuminator can be controlled.
Sample industrial scenarios will be performed using these sensors and actuators.
3.2. Modelling and Design
The platform which the output of the project has been designed in the infrastructure shown in Figure 3.3 so that the industry 4.0 vision can be achieved with the capabilities and standards detailed in the previous chapters.
The solution of Industry 4.0 platform shows a cyber physical system in which the main elements of the infrastructure are integrated with an industrial system. Cyber physical systems come together with platform integration to form an industry ecosystem. With the integration of platform and industrial system, a structure like shown on figure 3.4 is designed.
Also, connecting and integrating a new industrial system or a device to the platform is explained on Appendix A.
Industrial layer takes place on the bottom of the platform infrastructure. This layer contains sensors and actuators connected to a PLC, a network which connects the PLC device to the server and the server which hosts the OPC models and provides the cloud gateway connectivity as shown on figure 3.5.
PLC stands for programmable logic controller and is an automation device which uses for the control of processes in factories. The article quotes: “An automated control system element, which also represents the center of the system, is a PLC controller, which, based on the received input signals from the input devices, according to a particular program, generates the output signals to manage the output devices.".  The PLC is sort of a computer but unlike normal computers it has many inputs and outputs. PLC can withstand electrical disturbances, temperature differences and mechanical bumps. These features makes PLC beneficial in a production line such as producing more and better quality products in a short time and producing with very low error rates.
In this project, industrial layer contains industrial controllers, sensors and actuators that are physically located on the site. Wherein the controller device communicates with the PLC device will provide a platform in the cloud.
In the implementation of the lighting scenario, the PLC module functions only as an smart relay module and no automation or control software is installed on it. The PLC program loaded on the PLC is shown in figure 3.6. This logic tags are also accessible on the HMI panel.
OPC is a communication standard for industrial systems. It is designed to make the connection between different units of automation systems fast and reliable. The OPC standard based on the OLE/COM standard, which is Microsoft's object oriented technology that targets integration between different applications.The OPC standard is not a protocol, but defines the properties of the processing and development of the interface between client-server and server-server. This interface provides communication between where data is stored and where data is received without the hardware and software compatibility in between.
In this project, sensor and the data of the actuators are accessed via the OPC protocol at the industrial field layer. After the OPC server has been activated in the test system, the RSLinx OPC Server Test Client program has been tested for access to the data in the PLC via the OPC protocol.
From the RSLinx Classic Professional, DDE/OPC -> Topic Configuration has to be chosen as seen on Figure 3.7.
RSLogix project of the project is chosen from left side of configuration screen and assign the right PLC's IP address as shown on
After that, OPC configurations are done and OPC tags are available on network. Test screen and OPC tags are shown in Figure 3.9.
LAMP_1-12: Lamp tags which are connected to the laboratory lambs through PLC.
TOTAL_OFF: A tag for closing all lambs at once.
The “Local” tags at the end are motion sensors which used as inputs in this solution. There are 9 analog inputs connected to the industrial test system.
3.2.2. Connectivity Layer
Connectivity layers takes place both on industrial field and cloud layer. This layer ensures the connectivity between physical or industrial devices and the cloud platform. It consists of the protocol gateways like OPC - MQTT gateway on the industrial testing system as shown on figure 3.10.
MQTT is a machine-to-machine (M2M)/“Internet of Things” connectivity protocol stands for “Message Queuing Telemetry Transport”. It was designed as an extremely lightweight publish/subscribe messaging transport and works on top of the TCP/IP protocol. Publish/subscribe method can be summarized as shown on figure 3.11. 
The publish/subscribe messaging protocol opens the door to larger entity systems and easier event driven messages.  Also, MQTT is most popular messaging protocol among IoT solution developers according to Key Trends from the IoT Developer Survey 2018. 
126.96.36.199 OPC - MQTT Gateway
In order for the OPC protocol which allows the access and control of PLC data, to transfer data to the cloud, this object-based protocol needs to be transferred to a common telemetry protocol with a gateway. The data flow in the platform has been realized with MQTT in terms of popularity, speed and resource consumption. Since the OPC-DA protocol is running on the test system, a gateway software has been developed to carry the communication between OPC-DA and MQTT. The software developed with Python2.7 connects to the MQTT server using the paho-mqtt library and to the OPC server using OpenOPC. The source code of this gateway software is given in Appendix B. The gateway software, which will run on a server computer in the position of the industrial system, will interact with the industrial system and cloud. When the gateway software is running in the example industrial system, the screen output in figure 3.12 is obtained.
3.2.3 Cloud Layer
This layer is the layer that routes data and exchanges data bidirectionally with the services. In addition, user interfaces are also designed, integrated and run in this layer. Cloud layer infrastructre can be shown on figure 3.13.
To implement these cloud elastic cloud infrastructre, AWS is selected for many reasons. Amazon Web Services, briefly AWS, is an commercial cloud platform which provides cloud services to individuals or companies. According to RightScale 2018 State of the Cloud Report, Amazon Web Services has 64% market share on cloud usage.  It offers not only working on managed services easily but also provides an elastic cloud workspace to integrate other services effortlessly. These advantages make the connected industrial solutions ecosystem easy to deploy, operate and scale on cloud. Last of all, the solution's cloud layer implementation on AWS is not a bottleneck. On the contrary, this a great advantage to benefit from numerous cloud services and perform further integrations by keeping the solution's cloud layer alive on the AWS.
188.8.131.52 Cloud Software
Node-RED is a flow based programming tool for wiring together hardware devices, APIs and online services on a single browser dashboard. Node-RED basically provides interconnections of services and modules. On Node-RED dashboard, all backend needs are satisfied flexibly by creating flow-based configurations. Every node of the project, regardless of being software or hardware element, can be represented as a node and connect to each other. In addition to back-end software, also web based user interfaces can be builded on Node-RED. Node-RED is selected as the interconnection point of the platform because of not only being flexible and capable, but also open-source and community-supported.
Relays providing outputs of the industrial system and providing illumination control are defined as flows on the Node-RED and monitoring and control of these output data is provided. For this purpose, the flow which shown in figure 3.14 is prepared. This flow can also be generated for other relay output data to control the desired number of outputs.
The source code for the Node-RED flow program required for controlling a total of 12 lighting output relays in the industrial system is given in Appendix C.
The source code for the Node-RED flow program required for monitoring analog motion sensors which are connected to industrial system is given in Appendix D.
184.108.40.206 Data Processing
In most industries, existing applications consist PLC devices which are constrained in terms of data analysis. Taking advantage of different data sources and processing them on long-term time windows requires an data processing engine. At this point, complex event processing engines solves the problem. Complex Event Processing, simply CEP, is an approach that identifies data and application traffic as events', correlates these events with predefined patterns, and reacts to them by generating actions or decisions to systems, people and devices. The primary task of CEP applications is the handling in real time a set of events from different sources (event streams) to identify significant events based on one or several event streams or to determine many events within a period. 
Siddhi Streaming & Complex Event Processing engine integrates to the platform for complex decision needs of an industrial system. Siddhi is a sophisticated event processing engine that has a SQL-like query language, allows for complex events to be easily identified and linked to each other, spans less than 2MB and is preferred by business giants for business processes.  Siddhi's infrastructure and data structure can be seen in Figure 3.15.
The flow in Figure 3.16 is defined on the Node-RED in order for the data to be processed in Siddhi and the results obtained to be transformed from Siddhi to platform. Siddhi also defines the siddhi-io-mqtt module, which enables Siddhi to listen and respond to MQTT messages. Thus, the integration of Siddhi's platform has been completed.
As an example of a complex event scenario on the industrial system, the scenario “automatic shutdown of all lights after the last person leaves the laboratory” is planned. The exit from the lab is the event that the data value of the opcgtwgeti40_2018sensor3ICh3Data sensor, which is the closest motion sensor to the door, peaked and dropped again. Determining that the person who is the last person is the event that the value of the other motion sensors is low for 120 seconds after the peak value event. After these two successive events, the complex decision rule is done if an output flow is defined as an MQTT payload output. The resulting flow data on the Siddhi engine screen and MQTT are shown in Figure 3.17.
Source code of Siddhi stream processor application is given on the Appendix E.
3.2.4 User Interface
While the industrial system data can be processed and routed on the platform, platform integrated user interfaces have been prepared in order to provide the processed data through various interfaces to the user via web or mobile and also to control industrial systems via web or mobile devices. Interfaces are defined on the Node-RED.
The interface shown in Figure 3.18 is designed for instant display and control of the lighting output relays via the interface.
The interface shown in Figure 3.19 has been prepared in the form of a color-based activity map of the motion sensor's input information and for the purpose of physically representing the laboratory.
The interfaces have been integrated to the solution and actively used throughout the entire testing process.
4. IMPLEMENTATION AND TESTING
The platform, which is the project output, has been integrated with an industrial system, realizing the advantages and possibilities of the platform. For this purpose, multiple industrial system scenarios were tested by firstly developing and integrating with an industrial system and then integrating with a second industrial system.
4.1.1. Project constraints
The purposed platform design is faced some contraints while implementing on industrial field. These constraints define platform's bottlenecks on application phase. Notable of them are listed below.
Communication latency between layers: Because of routing between many protocols and platforms, communication is going away from being realtime. Especially on OPC-DA gateway layer, because of being pull based of the data, communication performed on a specified sampling time. With the limits of TCP/IP stack and MQTT protocol, it's not possible to transmit and process data more frequent than 10Hz. An UDP based gateway can be developed if there is a requirement to process data over 10Hz.
Server uptime problems: Cases which requires central server computer to fulfill gateway function on the industrial field, like this project's testing system which uses OPC-DA, face gateway uptime problem frequently. Reasons of uptime problems could be power problems, restart requirements when configuration changes, results of different usages of one server computer. This constraint is partially solved by assigning the gateway software as a background service to Windows Server 2003.
Firstly, the lighting system in the Control Engineering Departmant's Power and Motion Control Laboratory of the Electrical and Electronics Engineering Faculty of Istanbul Technical University and the industrial controller system to which the sensors are connected are integrated. Initial development, integration and testing were done with this system.
Subsequently, an industrial system platform was integrated at Beihang University, Control and Automation Laboratory. Thus, two industrial systems were communicated on the platform, and the data of each of them was integrated. Thence, two geographically distinct industrial systems which operates in Turkey and China communicated with each other over internet, and integrated scenerios are implemented on them.
4.3 Experimental Results
The platform, which is the project output, has been integrated with an industrial system and the advantages and possibilities provided by the platform have been realized. For this purpose, the development and integration with an industrial system were first made, and then with a second industrial system, multi-industrial system scenarios were tested as can be shown on the previous section. Results obtained as expected and requirements of an Industry 4.0 adapted system are obtained successfully. The project achieved the goal which set at start. Advantages and benefits provided by platform are discussed in conclusion section in detail.
5.1 Privacy and Security Basics
To enable industrial devices to function as Industrial 4.0 devices, it is necessary to make them smart, so, they need to connect to the internet. While amount of connected devices are rising, security risks are rising with them, too. In fact, “Smart” is not just about creating more opportunities and building faster and more valuable communications, it is also about making responsible infrastructure for those gains, and building robustness into the framework. The interconnected organizational systems significantly increase the exposure to many security risks, with critical and financial impacts. 
As the security aspects of the platform are addressed, security aspects that can be implemented in each tier are researched and integrated into the platform. This section summarizes that what did applied to make the platform and the data secure. In addition, its suggested that important points which should be considered about security for production use of the platform. Also the section contains further references and things to do to make platform safer.
5.2 Application security
5.2.1 Industrial Layer Security
On industrial layer, devices are locating on the industrial field physically. First step of securing industrial layer is keeping device to device communications safe. This is not the focus of this work, but secure communication between industrial computer/PLC and the router/server is vital to work with this platform smoothly. The well-known case about this issue is “stuxnet attack” case. Stuxnet is an example of such an attack which targeted Siemens S7/WinCC products that were commonly used in the Iranian uranium enrichment infrastructure. Stuxnet infected major systems components ranging from SCADA to sensor readers, the original data flow from controllers to centrifuges was modified by the Stuxnet and these modification were not detected by safety measures in place. 
Industrial system's own software tools provide advanced configuration of the local industrial network. On the test system, Allen-Bradley's RSLinx tool provides configuration of network details like IP configuration, subnet-mask and hierarchy of assigned other devices and modules. When these configurations are completed in considering all circumstances, a robust and safe industrial network can be obtained, while sharing its own data with the internet at the same time.
5.2.2 Connectivity Layer Security
On connectivity layer, the purpose is putting local OPC data to cloud in a secure way. As explained on previous sections, MQTT protocol is used as the base of the platform's data pipeline. Several different approaches are applied to make the MQTT connection secure. First, MQTT broker is set to require username-password to access its own topics. Thus, every device has unique username and password on the MQTT server and they can access only their own topics to publish and subscribe. This approach cleary provides seperation of every device's data and ensures access to data of the devices which only permitted to. Also SSL/TLS implementation of MQTT protocol provides data security between industrial field and the cloud server. In addition to this, IP address based limitations can be set to MQTT broker's configuration after industrial devices and the infrastructure is ready to production stage.
5.2.3 Cloud Layer Security
The software layer is the layer in which the software of the platform is running, the other services are integrated into the platform and the flow of data streams is realized. To secure this layer, web application security practices will be applied. Software on this layer is an integrating platform that build from nodeJS, python, socket.io and several side components. There are lots of documentation about securing web apps on these tools and framework's community platforms. They should be considered as a first step of securing a web app.
On this platform, if the Node-RED tool is considered specially, official documentation provides several methods like securing the UI and endpoint, securing Node-RED IDE interface and role based definitions for Node-RED users. These first-step security enhancements are done while setting platform up.
5.3 Data security & privacy
Data security has been an ongoing problem and bottleneck since the beginning of computer and information systems. With these systems being closer to the physical systems in conjunction with industry 4.0 and IoT, this problem becomes even more visible. In this study, a platform solution is presented as a proof of concept. Therefore, although data security and privacy are not the focus of the work carried out in this project, it's observed that privacy and data security evaluations are required after integration with test systems and solution scenarios in even a test system.
First of all, the platform approach proposed in this project includes a central integration layer and specialized services (such as data processing services) that work on this layer. These services work as application-agnostic, returning the result of te process to the platform. Avoiding from a monolithic implementation naturally creates protection for data security on a per-services basis. When the platform itself is secured properly as explained in the previous sections, data security and privacy will be evolved to a point.
If the platform is used in production, the license agreements of all data tools and services must be rewieved and, if necessary, replaced with another. In this platform solution, all of the selected platform services and frameworks are open source, which is clearly an advantage of the platform in terms of privacy and licensing.
6. CONCLUSION AND SUGGESTIONS
The possibilities and requirements that an industry 4.0 solution should have are ensured after the platform has been integrated into industrial systems. The achievements of the platform have been tested and verified, especially the following factors.
Instant access to the data of an industrial system over the internet
Interacting with the data of an industrial system over the internet instantly
Create customizable user interfaces for monitoring and controlling the data of an industrial system
Transfer data from an industrial system to other industrial systems, devices or other platforms, and forward the data from these to the industrial system
Can store the data of an industrial system in the database, use the stored data in the industrial system again
Combine the data of industrial systems in a complex event processing engine so that they can provide data analysis possibilities and complex decision making scenarios that can not be reached on the industrial system
As a result, the platform offers new aspects and approaches to develop capable industrial solutions which can adapted to Industry 4.0 vision. The results obtained with the test scenarios presented here also demonstrate both the new approach promised by industry 4.0 and demonstrate how easy it is to achieve them with various software platforms. Choosing the platform approach when making an industrial solution Industry 4.0 compatible is advantageous in many ways like efficiency, robustness and privacy.
 M. Hermann, T. Pentek, and B. Otto, “Design Principles for Industrie 4.0 Scenarios: A Literature Review,” 2015.
 Evans, D., (2011), The Internet of Things How the Next Evolution of the Internet Is Changing Everything, Cisco IBSG, White Paper.
 M. Törngren, F. Asplund, S. Bensalem, J. McDermid, R. Passerone, H. Pfeifer, A. Sangiovanni-Vincentelli and B. Schätz, Chapter 1- Characterization, Analysis, and Recommendations for Exploiting the Opportunities of Cyber-Physical Systems, In Intelligent Data-Centric Systems, edited by Houbing Song, Danda B. Rawat, Sabina Jeschke and Christian Brecher, Academic Press, Boston, 2017, Pages 3-14, Cyber-Physical Systems, ISBN 9780128038017
 N. Jazdi, “Cyber physical systems in the context of Industry 4.0,” 2014 IEEE International Conference on Automation, Quality and Testing, Robotics, Cluj-Napoca, 2014, pp. 1-4. doi: 10.1109/AQTR.2014.6857843
 Gröger, C. Datenbank Spektrum, (2018) 18: 5. https://doi.org/10.1007/s13222-018-0273-1
 acatech (Ed.), “Cyber-Physical Systems. Driving force for innovation in mobility, health, energy and production (acatech POSITION PAPER),” Heidelb. Springer Verlag, 2011.
 Juan David Contreras, Jose Isidro Garcia, Juan David Pastrana, “Developing of Industry 4.0 Applications”, iJOE ‒ Vol. 13, No. 10, 2017 https://doi.org/10.3991/ijoe.v13i10.7331
 L.A. Grieco, A. Rizzo, S. Colucci, S. Sicari, G. Piro, D. Di Paola, G. Boggia, IoT-aided robotics applications: Technological implications, target domains and open issues, Computer Communications, Volume 54, 2014, Pages 32-47, ISSN 0140-3664.
 An RFID electronic tag based automatic vehicle identification system for traffic iot applications. 2011 Chinese Control And Decision Conference (CCDC), Control And Decision Conference (CCDC), 2011 Chinese [serial online]. 2011;:4192. Available from: IEEE Xplore Digital Library, Ipswich, MA. Accessed June 2, 2018.
 Url-1 <http://new.abb.com/control-systems/features/industrial-IoT-services-people-use-cases>, date retrieved 25 May 2018.
 Peter O'Donovan, Colm Gallagher, Ken Bruton, Dominic T.J. O'Sullivan, A fog computing industrial cyber-physical system for embedded low-latency machine learning Industry 4.0 applications, Manufacturing Letters, Volume 15, Part B, 2018, Pages 139-142, ISSN 2213-8463, https://doi.org/10.1016/j.mfglet.2018.01.005.
 Url-2 <https://www.ptc.com/-/media/Files/PDFs/Case-Studies/CS_Hirotec_smart-manufacturing-factory-enterprise_EN.pdf?la=en&hash=D7DF6581C3082C8EF47321CE8802523F9AA1D405>, date retrieved 25 May 2018.
 Application of industrial PLC for controlling intelligent traffic lights. 2017 25Th Telecommunication Forum (TELFOR), Telecommunication Forum (TELFOR), 2017 25Th[serial online]. 2017;:1. Available from: IEEE Xplore Digital Library, Ipswich, MA. Accessed June 2, 2018.
 HILLAR, GC. MQTT essentials : a lightweight IoT protocol : the preferred IoT publish-subscribe lightweight messaging protocol. Birmingham, UK : Packt Publishing, 2017., 2017. ISBN: 9781787285149.
 J. Velez, R. Trafford, M. Pierce, B. Thomson, E. Jastrzebski and B. Lau, “IEEE 1451-1-6: Providing common network services over MQTT,” 2018 IEEE Sensors Applications Symposium (SAS), Seoul, 2018, pp. 1-6. doi: 10.1109/SAS.2018.8336750
 ] Url-3 <https://blog.benjamin-cabe.com/2018/04/17/key-trends-iot-developer-survey-2018>, date retrieved 25 May 2018.
 Barbara, Santa. “2018 State of the Cloud Report: See the Latest Cloud Trends.” Cloud Computing Trends: 2018 State of the Cloud Survey, 13 Feb. 2018, www.rightscale.com/lp/2018-state-of-the-cloud-report.
 M. A. Butakova, A. V. Chernov, P. S. Shevchuk and V. D. Vereskun, “Complex event processing for network anomaly detection in digital railway communication services,” 2017 25th Telecommunication Forum (TELFOR), Belgrade, 2017, pp. 1-4. doi: 10.1109/TELFOR.2017.8249273
 Url-4 <https://github.com/wso2/siddhi/>, date retrieved 25 May 2018.
 T. Pereira, L. Barreto, A. Amaral, Network and information security challenges within Industry 4.0 paradigm, Procedia Manufacturing, Volume 13, 2017, Pages 1253-1260, ISSN 2351-9789, https://doi.org/10.1016/j.promfg.2017.09.047.
 NOURIAN, A; MADNICK, S. A Systems Theoretic Approach to the Security Threats in Cyber Physical Systems Applied to Stuxnet. IEEE Transactions on Dependable and Secure Computing. 15, 1, 2-13, Jan. 1, 2018. ISSN: 15455971.
APPENDIX A: Connecting a new industrial system or a device to the platform
APPENDIX B: OPC-MQTT gateway software source code
APPENDIX C: Node-RED flow program to push and manage industrial data on the web app
APPENDIX D: Node-RED flow program pushing industrial data to UI, to stream processor and producing heatmaps
APPENDIX E: Source code of Siddhi stream processor application
Connecting a new industrial system or a device to the platform
This tutorial aims to connect an Allen-Bradley PLC to cloud. The tutorial is shared as a blog post; check How to connect a PLC to the cloud using OPC-DA and MQTT Protocols.
OPC-MQTT gateway software source code
I've shared source codes for this appendix on my github. Check eercanayar/industry-4.0-platform/appendix-a/opcsample.py
Node-RED flow program to push and manage industrial data on the web app
Node-RED flow program pushing industrial data to UI, to stream processor and producing heatmaps
Figure D.1. Node-RED flow program to monitor motion activity on dashboard
I've shared source codes for this appendix on my github. Check eercanayar/industry-4.0-platform/appendix-d/
Source code of Siddhi stream processor application
I've shared source codes for this appendix on my github. Check eercanayar/industry-4.0-platform/appendix-e/