An Object-Oriented Approach for the Recursive Numeration and Visualization of the Key Strata of Coal Mines

The exploitation and utilization of coal resources have caused serious ecological and environmental problems that are closely related to the movement and destruction of the overlying strata, especially the activities of the overlying key strata (KS). The existing KS calculation methods are characterized by low efficiency and high costs. This study proposes an object-oriented improved recursive algorithm (OORA) model to achieve efficient calculations for KS. An application program was developed and tested with the KS of the Xiadian coal mine, Shanxi, China. The calculation results were basically consistent with field observations, and the calculation depth was increased by 146.05 m. In addition, five typical KS calculation cases were selected for in-depth testing. The calculation time ranged from 0.175–0.225 s, and the calculation time was shortened by approximately three times compared to that with traditional methods. Therefore, it is feasible to apply the model algorithm for KS calculations, and the model provides benefits such as high efficiency and low costs.


INTRODUCTION
The mining industry, which is driven by human demand for mineral resources, is one of the main causes of current environmental pollution problems and poses a serious threat to the ecological environment system (Gu, 2018). The pollution of groundwater and air in mining areas is closely related to the development of the mining industry (Silva and Lizardi-Jimenez, 2020). Problems, such as the movement and destruction of strata and surface subsidence caused by high-intensity mining, have seriously affected the deterioration of the ecological environment and the destruction of water resources (Lin et al., 2020a;Santana et al., 2020;Zhang et al., 2020;Zhu et al., 2020). During the mining process, the movement and destruction of the overlying rock strata directly reflect the damage done to the environment by mining. With the advancement of the mining face and the gradual expansion of the mining scope, the overlying rock is seriously damaged (Bai et al., 2018;Bai et al., 2019a;Bai et al., 2019b). The breaking of the strata directly destroys the conditions for the occurrence of groundwater, causes the loss and pollution of groundwater, severely damages water resources, and leads to the deterioration of the ecological environment, which will bring extremely adverse effects to sustainable development; furthermore, this will cause mine water inrush accidents, causing serious casualties and economic and property losses (Li et al., 2015;Liang et al., 2015;Zhang et al., 2017).
A series of environmental problems induced by coal mining are essentially caused by the movement and destruction of the overburden, and the location and damage of the key strata are closely related to the movement and destruction of the overburden (Ma et al., 2012;Shi and Zhang, 2013;Chen et al., 2015;Jiang et al., 2015;Ma et al., 2018). In coal mines, the overlying strata are composed of strata with different lithologies, thicknesses, strengths, and other characteristics. Therefore, during the mining process, the impact of mining on the strata is different, and the sensitivity and response of strata with different characteristics to the impact of mining are also different (Wu et al., 2009;Zhang et al., 2019;Sun et al., 2020;Wang et al., 2020).
Hard strata may have a greater bearing capacity and weaker sensitivity and may control and support relatively weak strata. Based on the differences in these characteristics, the key strata theory is proposed and successfully applied to field production, which highlights an important direction for the study of mining overburden control (Qian et al., 1996). According to the key strata theory, strata that are hard and thick and have major control over overburden activity are named key strata; the immediate roof (IR) and weak strata (WS) have little effect. As shown in Figure 1, the top key stratum (KS) is named the primary KS (PKS) as it plays a major role in controlling the movement and destruction of the overlying strata. Correspondingly, the following KS that controls the partial influence of some overlying strata activities are named the sub-key strata (SKS). On the assumption that the load on the strata is evenly distributed and the dip angle is horizontal, the criteria for determining the stiffness and strength are proposed. Assuming that the range of strata controlled by the first stratum includes n strata, the load formed by the n strata on the first stratum is (q n ) 1 (Xu and Qian, 2000;Xu and Ju, 2011).
where E is the modulus of the elasticity, γ is the bulk density, h is the thickness, i is the number of strata, and q is the load. These variables correspond to the corresponding rock strata. If the strata of no. n are still controlled by the first stratum, their load acts on the first stratum. This action should obey inequality (q n ) 1 > (q n-1 ) 1 ; otherwise, it appears that the strata of no. n are not controlled by the first, and the strata of no. n can be considered hard strata. After analyzing each stratum, all hard strata can be searched. Then we regard the strata as a beam model and analyze the advancing distance of the working face that caused the strata to break. The breaking distance (L i ) of each hard rock strata can be calculated by Eq. 2.
where σ is the tensile strength, q is the load, and h is the thickness. The breaking distance of all hard rock strata can be obtained by Frontiers in Earth Science | www.frontiersin.org November 2021 | Volume 9 | Article 717177 calculation, and then the key strata can be determined by analyzing the relationship between the breaking distances. The breaking distance of the key strata should satisfy the inequality L i > L i-1 . Otherwise, the load of the previous strata needs to be added to the next strata and recalculated. After a series of calculations and analyses, the key strata can be searched. The identification methods of the key strata mainly includes lithology calculations, ground drilling, and laboratory simulations (Xie and Xu, 2017;Zhu et al., 2017;. Key strata recognition software was developed and successfully used in field practice, and the fast calculation efficiency of the software soon showed a huge advantage . Inspired by key strata theory, research on mine disaster management, mining safety, water-preserving mining, and green mining has achieved decent practical results, effectively guiding field practice (Cheng et al., 2018;Liang et al., 2019;Gong et al., 2020). Furthermore, a large number of valuable research results on strata control and surface subsidence prediction based on the KS have been obtained, which provides new ideas for solving environmental problems caused by mining (Cheng et al., 2017a;Cheng et al., 2017b;Cheng et al., 2018;Cheng et al., 2020). However, in practical applications, using lithology calculations, laboratory simulations, magnetotelluric (MT) detection methods, etc. to identify the location of the key strata consume considerable resources and time. There is no doubt that using a program for lithology calculation is one of the most efficient and economical methods, but a development of the program requires a computational foundation and certain programming skills, and the actual development process is cumbersome and complicated.
It is necessary to find a high-efficiency, low-cost, easy-tounderstand, and implementable method to realize do-it-yourself KS program calculations to meet the increasing amount of research relying on key strata theory.
With the rapid development and popularization of computer technology, the application of computers has gradually penetrated various industries. Emerging technologies such as artificial intelligence, data mining, machine learning, and big data have had huge impacts on many traditional industries. Many traditional industries have made full use of the research results from the development of computer technology to provide new research ideas and solutions for the research of some professional problems (Lin et al., 2018;Ahmed et al., 2020;Lin et al., 2020b;Brykov et al., 2020;Ge et al., 2020;Leng et al., 2020). Under the background of the rapid popularization of computer technology in various areas, basic programming abilities, which makes it possible to write programs by oneself, have become basic skills of universities, research institutions, and even field staff. Designing programs and writing codes through do-it-yourself (DIY) are conducive to a deep understanding of the physical meaning behind the theoretical principles and the way of thinking of previous scholars. Researchers can use black box software and rely on their own abilities to connect theory with practice. Through DIY, humans improve their comprehensive ability to research and analyze problems and maintain an active thinking mode; more importantly, DIY improves the practical abilities (Sarpong et al., 2020;Yoon et al., 2020).
Object-oriented technology connects the objective world with the computer world in a way that is easier for humans to understand. It has the advantages of abstraction, encapsulation, inheritance, and polymorphism, and the design logic is similar to the way of human thinking. Therefore, the logic is simple and easy-to-understand and does not require a solid professional computer background and basic knowledge. Objectoriented technology has become one of the main methods of modern programming Lopes et al., 2020;Lv et al., 2020;Prajapati and Chhabra, 2020;Van Hien et al., 2020). Recursion is an algorithm widely used in program design. Its characteristic is that it can transform a large and complex problem into a smaller problem similar to the original problem to solve. Recursion provides a structured, readable, and easily debuggable way of designing algorithms to solve complex problems (Hamouda et al., 2020;Rakic et al., 2020).
According to the above analysis, the key strata have an important influence on mining rock strata control and disaster management. In the current research, the use of programs for lithology calculation still occupies an important position, but there are still some problems in their actual application and promotion.
First, mathematical formulas and related judgment conditions are used for programming. The lack of an overall abstract process of mathematical formulas makes it difficult to fully utilize the advantages of algorithms.
Second, the traditional process-oriented programming method has a complicated logic and is difficult to program. It is difficult to meet the needs of mining staff to develop programs by themselves, which invisibly increases the development costs and application difficulty.
It is necessary to find a high-efficiency, low-cost, easy-tounderstand, and implementable method to realize do-it-yourself KS program calculations to meet the increasing research relying on key strata theory. In response to the above problems, we introduced an approach using object-oriented programming techniques and improved recursive algorithm strategies to achieve high-efficiency, low-cost, easy-to-understand, and practical methods to conduct key strata calculation.
First, traditional KS theory is abstractly analyzed, and a flexible and robust algorithm model is established to improve the convenience, efficiency, and accuracy of KS calculations.
Second, object-oriented technology is used to encapsulate the KS algorithm and corresponding functional modules to establish a technical framework with high cohesion and low coupling, which improves the flexibility and maintainability of the system and decreases the difficulty of independent development.

REQUIREMENTS ANALYSIS AND OVERALL RESEARCH FRAMEWORK ESTABLISHMENT Lithology Data
In the actual study, lithology data are generally stored in a spreadsheet such as an Excel spreadsheet, and its main Program Function Analysis 1) In order to make a program to have better applicability, in the functional analysis, the user should first design a function to read the traditional spreadsheet data to achieve an import batch data function, avoid repeated manual input, and improve the overall efficiency of the calculation process.
2) The data visualization function is an important link in the process of users checking the correctness of data and adjusting parameters. When the data are imported into memory, a certain carrier should be used to display the data, and the user can check the data by viewing it.
3) The iterative calculation function is the core of the entire program. After the data are ready, iterative calculations can be performed. The calculation process is completed in the background, and the calculation results are displayed in real time. 4) The parameter adjustment function is the core of improving the efficiency and reducing the time costs. In actual applications, the most troublesome thing is the need to repeatedly adjust the parameters. Therefore, the logic of adjusting parameters must be considered when designing functions. After the parameters are updated, the iterative calculation function is automatically triggered and the new calculation results are displayed in real time. 5) The data export and storage function is the end of the entire process. Users can export and store the calculation results, and then perform other lithology calculations or choose to end the program.

Specific Research Framework of KS Based on an Object-Oriented Recursive Algorithm Model
According to the above analysis, the research framework of the entire program can be preliminarily defined as shown in Figure 2.

ABSTRACT ANALYSIS AND ALGORITHM DESIGN Abstract Analysis of Strata
The strata in the physical world have different characteristics. After the abstract analysis, the strata class is defined to describe the strata. The parameters of the strata such as the number, lithology, and bulk density are defined as attributes in the class, and the load and fracture of the strata are defined as functions.
The objects describing different strata can be obtained by instantiating the strata with different strata parameters. Through the process of abstraction, encapsulation, and instantiation, the strata of the physical world can be mapped into the computer world for expression. The data are all encapsulated inside the object, and an interface is provided for access, which is not only easy to manage but also ensures data security. Through the object-oriented analysis, strata are transformed from the physical world to the computer world, which not only simplifies the analysis process but also expresses it in a logical way similar to human thinking, which is more conducive to learning and application. Internal functions are defined to simulate the loading and breaking of rock strata and perform function calls and data exchange through message transmission.
Using the rock strata class as a space carrier to map the strata in the physical world into the computer world, the abstract expression of the strata data is related to object-oriented technology, as shown in Figure 3.

Main Class Organization Structure
According to the above analysis, the main classes in program design include strata, input and output, calculation, and parameter adjustment. The C# language was used to define the classes, their attributes, and the methods in the Visual Studio 2015 compilation environment, and the logical calling relationship and organizational structure between classes was defined, as shown in Figure 4.

1) Principle analysis
For different strata positions, the overlying rock load needs to be calculated and then compared. Taking the stratum numbered 1 as an example, the number of load calculations is n, and the load calculation is shown in Figure 5.
When you need to calculate (q n ) 1 , you need to calculate (q n-1 ) 1 first; and when you calculate (q n-1 ) 1 , you need to calculate (q n-2 ) 1 . The calculation process is shown in Figure 6.

2) Core algorithm design
The calculation of the load is a recursive calculation process because each recursion has to wait for the return of the following results. As the number of recursions increases, the time complexity and space complexity increase drastically. Therefore, a more efficient tail recursion algorithm is adopted, and the recursive iterative algorithm for the strata is designed according to the results of the above analysis. After the recursive iteration, the load of all the strata can be solved. Then all the hard rock strata in the array can be located according to the load judgment criterion.
After calculating the hard strata, the breaking condition is used to judge the key strata. According to the breaking condition, the judgment function of the key strata is designed. Then an infinite loop is used to traverse the hard rock strata and finally locate the key strata.
The class describing strata is constructed through objectoriented technology, and the strata objects are instantiated with the parameters of the real strata to map the strata in the physical world to the computer world. The recursive algorithm structure is used to decompose the complex strata data and is finally merged to realize the load calculation. Using the load and breaking distance conditions of the key strata theory, the final key strata position calculation can be realized through a simple cycle.   The logic of the entire calculation process is clear and easy-tounderstand and practice; the data are completely encapsulated and separated from the calculation, it has higher cohesion and low coupling, and it is more conducive to expansion and debugging. The implementation process is shown in Figure 7.

Accuracy Verification
In order to verify the accuracy and efficiency of the program, the Xiadian coal mine in Shanxi Province, China, was chosen as a case study, as shown in Figure 8. The key strata occurrence of the Xiadian coal mine is shown in Figure 9. The input function of the program is used to import data in batches and calculate and adjust parameters. The user interacts with the program through the visual interface, and the calculation process is completely shielded from the user. The friendly interactive experience reduces the complicated repetitive calculation work and improves the efficiency of the key strata calculation.
In the verification of the key strata of the Xiadian coal mine, the program response and the calculation process are completely consistent with the design, and the calculation results are basically consistent with the original results, as shown in Table 2.
The borehole data of the Xiadian coal mine are calculated and compared with the actual situation of the key strata on-site, as shown in Figure 10. The calculation is basically consistent with field practice. The algorithm searches out more strata that meet the iterative conditions, and the calculated search height is increased by 164.05 m, approaching 22 strata.  The reasons for the difference between the calculation results and the field results are as follows.
1) The occurrence of KS, shown in Figure 10, is a comprehensive conclusion drawn from the theoretical analysis, numerical simulation, field practice, observation, and engineering work experience. This is a further optimization and application in preliminary theoretical calculations.
2) The method provided in this study can calculate all solutions stably and quickly; however, it cannot combine the actual mining situation and the working experience of engineers for further optimization analysis.
These are the main reasons why the calculation results are not exactly consistent with the field results. However, the method proposed in this study can calculate all solutions stably and efficiently, reduce the calculation time, improve the calculation efficiency, and assist researchers in making decisions. Therefore, it has a good application value.

Efficiency Analysis
In order to analyze the calculation efficiency and stability of the program, different amounts of strata data are imported for calculation and observation. When the number of strata is less than 100, the calculation time is approximately 175 ms. As the number of strata doubled, the calculation time increased. When the number of rock layers reaches about approximately 350, the calculation time is approximately 218 ms. The results show that the calculation time of the program does not increase drastically as the calculation data capacity increases, indicating that the calculation efficiency of the program will not be significantly reduced due to the increase in the amount of data. Therefore, the do-it-yourself program can complete the calculation task within an acceptable time. The law of the calculation time change is shown in Figure 11.

Discussion
The calculation of key strata is an important topic of strata movement control in coal mining. In this section, five previous cases were selected for testing, and the calculation efficiency was compared and analyzed to provide a reference for the optimization of the program (Xu and Qian, 2000;Xu and Ju, 2011). Examples 1-5 are the calculation examples of the key strata. The comparison results in Table 3 show that the calculation results of the method proposed in this study are basically consistent with previous conclusions. The comparison results of the calculation time are shown in Figure 12. Figure 12 shows that the program designed by the method provided in this study improves the computational efficiency by approximately 5 times in terms of the maximum and average computational time, and by approximately three times in terms of the minimum computational time.

Suggestions
In recent years, problems such as environmental damage, water loss, and mining-out collapse caused by mining have gradually become prominent. On the basis of key strata theory, coal mining has achieved remarkable results in mining design, rock strata control, and post-mining goaf governance; however, there are a number of problems with the key strata calculation. The influence of mining conditions and the working experience of engineers are fuzzy and random, but they have an important influence on the calculation of key strata, which should be further studied and analyzed. The main recommendations are as follows: 1) It is necessary to construct a mining influence analysis system, comprehensively evaluate the influence of mining conditions on key strata, and establish a quantifiable influence coefficient to improve the precision of the calculation of key strata. 2) It is necessary to develop a fuzzy intelligent algorithm to analyze fuzzy concepts such as work experience, optimize the calculation conclusions of key strata, and improve the auxiliary decision-making ability.

CONCLUSION
Aiming at the problems of complex calculations, a lack of simplified algorithm models, difficult program development, low efficiency, and high costs in traditional KS judgments, this study proposes an object-oriented method combined with an improved recursive algorithm to realize the visual calculation of KS. In addition, object-oriented applications were developed and applied to the Xiadian coal mine, Shanxi, China, which proved the practicability and high efficiency of the method. The main conclusions are as follows: 1) The calculation principle of KS is abstractly analyzed, and an improved recursive algorithm structure is adopted to establish an algorithm model with a clear structure and good readability, which provides a clear and concise idea for efficient judgment of KS. 2) Object-oriented technology is used to extract and encapsulate the functional modules of KS computing and build a highcohesion and low-coupling architecture to reduce the technical and time costs of program development.
3) The application program has been developed and applied to the Xiadian coal mine. The conclusion shows that the method has the ability to solve the KS stably and efficiently. However, this method makes efficient use of algorithms and program design skills to quickly calculate all solutions. It is difficult to integrate factors such as on-site working conditions and engineers' experience. The calculation results need further evaluation and analysis. This is also a research direction that needs to be improved in the future.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/Supplementary Material; further inquiries can be directed to the corresponding author.

AUTHOR CONTRIBUTIONS
CX: investigation, data curation, methodology, writing-original draft, algorithm design, and program development. KZ: funding acquisition, supervision, and methodology. XX: conceptualization, investigation, data curation, and writing-review and editing. YL: methodology.

FUNDING
This work was supported by the National Natural Science Foundation of China (Grant No. 51774323).