# Development of Automatic Electric Drive Drilling System for Core Drilling
## 3 Design and Development
### Software System
#### 3.2.3 Software Architecture and Security Function  
The software architecture is configured as a multithreaded system with an API based on an open platform communication unified architecture (OPC UA). Using Mapp ViewHMI technology, the system supports remote connectivity and remote event processing and receives data from the rig in real time as required.  
Mapp ViewHMI technology is a software developed by B&R for industrial machinery and equipment. The system integrates modules to enable developers to rapidly build a user management system, alarm system, and motion control sequence modules. This technology can easily manage complex algorithms, allowing programmers to focus entirely on machine processes. This technology is compatible with the PLC used in drilling systems, which is conducive for later maintenance and continuous development.  
OPC UA is a typical API implementation. The plug-and-play nature of the OPC UA protocol enables it to be used as an API in drilling systems. Therefore, the network client can implement two interaction modes: remote execution of sensor request information and issuing commands to actuators.  
The GUI was developed for this laboratory-scale drilling system using Mapp ViewHMI. This visualization GUI monitors the status of the automatic control system and the real-time drilling engineering parameters. GUI is equipped with virtual gauges and parameters that display control system settings and sensor feedback and build measurement curves based on sensor values in real time to help improve drilling engineering parameters.  
The system thoroughly considered the safety factors during device operation in this study. The safety functions include the following.  
* Triple limit Three limits are set to prevent the device from exceeding the design stroke. The first is the program limit that is triggered by encoder feedback. The entire device stopped operating when the encoder position value exceeded the limit value. The second limit is the mechanical limit, connected to the DI/DO module through a limit switch. A normally closed connection method was used. The entire device stopped operating when the limit switch was in a short circuit. The third is the physical limit, which is located at the operating limit position of the device to prevent it from rushing out of the rack track.
* Parameter limitations When the experimental device's drilling parameters, i.e., WOB, torque, ROP, and RPM, exceeded a limited range, the device was automatically stopped. This parameter is triggered by the parameter limit setting of the servo motor and the feedback value of the WOB and torque sensor to prevent the device from overloading during operation.
* Emergency Stoppages and Alarms The emergency stop switch of the experimental device is located on the right side of the console. When the emergency stop switch is pressed, the device stops running and does not receive or execute any command. In the control interface's status monitoring window, the experimental device's alarm included an alarm of the input and rotary motors. When any motor alarms, the entire device stops running, and does not receive or execute any command. When an alarm is lifted, commands are received and executed.  
In addition, a novel voting system was designed to provide early warning, shutdown, and prioritization of commands when abnormal loads, accidents, and conflicting instructions from different modules are detected in the drilling system. When the system detectsan accident, the voting system shuts down some modules to downtime and prioritizes dealing with problems that may cause equipment damage. In the voting system, the task that maximizes the ROP is given the lowest priority because it is not a critical task that needs to be dealt with immediately to meet the goal.