of Geology, Geography and Geoecology

. The work purpose is to investigate the water parameters of the Verkhno-Ivachivsk water intake, Ternopil and develop a model of water quality assessment and management. Common methods of hydroecological studies of surface water were used to determine hy - drochemical indicators. A model based on fuzzy logic and neural networks implemented in Matlab software was used to assess the water quality of the water intake. As a result of a complex hydroecological study of the water intake, which provides the drinking water majority supply in Ternopil, the content of the main pollutants (compounds of nitrogen, phosphorus, petroleum products, phenols, surface active agents) was determined (May, June, November, January 2019-2020). We compared the obtained indicator values with the ecological regulations and drinking water quality standards and we also assessed the ecological danger by the content of individual substances and the ecotoxicological situation in general. It was established that the water is slightly alkaline, which contributes to the presence of carbon dioxide in the form of a hydrogen carbonate ion, ensuring an environ - mentally acceptable gas regime of water. The reason for water alkalinity is the rotting of organic substances from the agricultural sector. The water quality according to the phosphate indicator is good even in the conditions of intensive supply of phosphates with sewage, due to their transition into insoluble forms and accumulation in sediments (silt), which is also facilitated by the low alkalinity of the water. An increased content of nitrogen compounds (ammonium, nitrates) in the water was revealed. Pollution and disruption of the nitrogen-containing compound cycle can be associated with the inflow of nitrogen compounds from surface runoff water and municipal and household washes, the organic substance decomposition in the agricultural sector and a violation of the production and destruction process ratio. The aquifer significant pollution by anthropogenic origin organic substances is reflected in the value of BOD 5 indicator, which is higher than the permissible level. The established values indicate high organic pollution and correlates with the formation of significant ammonia amounts which is a product of anaerobic and aerobic organic substance oxidation. After defuzzification of all neu - ral connections in Matlab program we obtained a model for evaluating the quality of water intake at an average level with an indicator of 1.52, which corresponds to the rating scale - an average level in the range (1.36-2.18).


Introduction
In the last years, all over the world, fresh water has become one of the main values and has the status of the scarcest resource in the 21st century. According to estimates, human activity has already affected 40% of all world permanent resources of the Earth and the annual increase in irreversible water use is about 5%. As a result, the water shortage has increased and its quality has deteriorated, so it requires additional actions and, of course, costs for both its desalination and purification (Dang et al, 2018;Minderhoud, et al. 2017;Scanlon et al, 2016;Wada et al, 2016).
Due to the global climate changes, urbanization and human activity, the water management regime in Ukraine has fundamentally been changing for a long time. All this leads to serious environmental damage, affects negatively the livelihood of the population.
Recently, special attention has been paid to the study of changes in water resources that are associated with climate change, low water levels, anthropogenic pollution, domestic and industrial water use (Korchemliuk et al, 2016). The water regime is formed as a result of the combined many factors influence, the main among them are climatic conditions (precipitation, air temperature and humidity, evaporation, wind, etc.), physical and geographical conditions (relief, soils, composition and nature of rock formations, groundwater, vegetation, wetlands, density of the river network, etc.) and human activity (engineering structures on water bodies, channel regulation, reclamation measures, deforestation, etc.) (Essenfelder et al, 2018;He et al, 2022;Li et al, 2016;Taft, L., Evers, M., 2016;Taft, Evers, 2016;Taner et al, 2019;Tian et al, 2021;Viola et al, 2021).
Natural and anthropogenic pollution are the main problems in providing the population with high-quality drinking water. A significant contamination degree of the geological environment components, first of all, the soils within the territories with a large technogenic load, creates the prerequisites for a large-scale negative impact on the adjacent components of the geological environment, including groundwater. Almost unprotected waters of the soil aquifer are subjected to the most intensive pollution (Afzal et al, 2018;Khattak et al, 2020).
Within the borders of Ukraine, where about 70% of the rural population is supplied at the expense of the first aquifer from the surface, the soil and rock contamination problem of the aeration zone, including nitrates, phosphates, synthetic surface active agents, petroleum products, becomes especially acute (Report on the management, use and reproduction of surface water resources for 2015 in Lviv region).
The basis of water supply systems in cities is surface water, the quality of which continues to deteriorate, and existing cleaning methods cannot solve the problem (Resolution of the Cabinet of Ministers of Ukraine 'On approval of the methodology for determining the standards of drinking water supply' from 25.08.2004 №1107). At the same time, fresh water of high drinking quality is still preserved in deep aquifers. In some cases it contains necessary for the human body microelements (Arsan et al, 2006).
On account of there was a need to conduct research aimed at identifying changes and trends in the possible deterioration of drinking quality groundwater (Rudko, 2010).
According to the Law of Ukraine «On the Basic Principles (Strategy) of the State Environmental Policy of Ukraine for the Period Until 2030» (dated February 28, 2019), underground and surface water pollution in Ukraine is one of the main environmental problems that pose a danger to society due to the increased level of population general morbidity and mortality. Water pollution is closely related to waste management, so its effective improving is a matter of public safety and «a key task in solving the energy and resource independence issues of the state, saving natural material and energy resources and the task of state environmental policy too» (Law of Ukraine 'On the Basic Principles (Strategy) of the State Environmental Policy of Ukraine until 2030' (February 28, 2019.
The work purpose is to investigate the water parameters of the Verkhno-Ivachivsk water intake, which ensure the majority of drinking water supply in Ternopil and also to develop a model of water quality assessment and management based on fuzzy logic and neural networks implemented in Matlab program.

Research materials and methods
The Verkhno-Ivachivsk water intake complex is located on the right bank of the River Seret. It is 12 km north-western of Ternopil. The water intake was commissioned in 1976. At present, it has 16 wells with a depth of 43-50 m located in a row 136-1087 m apart along the right bank of the Verkhno-Ivachivsk Reservoir and the River Seret. Water samples were taken at a depth of 1.5-2 m using plastic samplers with a volume of 1 dm3 (Fig. 1).
Ammonium content was determined by photometric method using a qualitative reaction with Nesler's reagent (Arsan et al, 2006). Nitrite content was determined based on nitrite's ability to diazotize sulfuric acid (Griess reagent) with 1-naphthylamine in red-purple color (Arsan et al, 2006). Chemical analyzes of water were carried out in Environmental biochemistry laboratory and Environmental monitoring and mathematical modeling of the environment laboratory, Ternopil Volodymyr Hnatiuk National Pedagogical University.
Statistical processing of the obtained results was conducted according to the method (Fetisov, 2010).
To determine the water quality of the studied reservoir, we used a model based on fuzzy logic and neural networks implemented in Matlab program (Rohatynskyi et al, 2020.)

Results and their analysis.
Upper Cretaceous, Neogene and Quaternary deposits take part in the geological structure of the territory of the Verkhno-Ivachivsk water intake (Fig. 2). Upper Cretaceous deposits are represented by Cenomanian and Turonian layers. Cenomanian deposits in the river valley lie at depths of 37.5-58.5 m, rising to 65-110 m in the water intake direction. These deposits are composed of sandstones, sands, limestones and siltstones. Deposits of Turonian layer in the river valley lie at depths of 1.5-21 m and increase towards the water intake. They are represented by chalk, in the lower part of the section -by marl. Water-bearing rocks are Turonian fractured marl-chalk deposits, at the base of which are poorly watered Cenomanian sandstones.
Neogene deposits are represented by Baden and Sarmatian layers. Baden deposits are composed of shell limestone, lithotamnian limestone and in some places marls. The thickness is up to 52 m. Lower Sarmatian deposits are represented by massive limestone Fig. 2. Schematic geological section through the territory of the Verkhno-Ivachivsk water intake (Khodakov et al, 1991) Note: 1 -quaternary deposits. Soil-plant layer, loam, peat; 2 -clay, marl, sand; 3 -undissected Tirasian-Kosovo deposits. Clays, dense carbonate rocks, limestones; 4 -chalky marls, writing chalk with silicon grips. Turonian layer; 5 -Cenomanian layer. Quartz-glauconite sandstones, argillites; 6 -lithological and stratigraphic boundaries (reliable, predictable); 7 -borehole: above the sign in the numeral is number of the borehole; in the denominator is the absolute height of the borehole in meters; 8 -groundwater level in Cenomanian deposits.
with sand and clay traces. The aquifer is distributed mainly in Baden deposits. The capacity of the aquifer varies from 10 to 26.8 m. It is fed by infiltration of atmospheric precipitation in watershed areas.
Quaternary deposits are widespread in the River Seret valley and represented by multi-grained sands, loams and swampy soils. The capacity is 10-15 m. The aquifer is fed by precipitation and infiltration of the reservoir and river water.
The expansion of the Verkhno-Ivachivsk water intake is considered problematic, since the municipal Malashiv landfill is located in the second sanitary belt of the deposit water protection zone (Syvyi, 2020).
The chemical water composition in the rivers of the region is the hydrocarbonate-calcium type of medium mineralization, which corresponds to the latitudinal hydrochemical zonation of surface waters and, in our case, is enhanced by the presence of carbonate rocks in the river valley -marls, limestones, etc. (Khilchevskyi et al, 2019).
The water composition changes throughout the year depending on the predominance of different water types in the river runoff: atmospheric, soil or underground. During spring full flow, runoff is formed by atmospheric precipitation, so the water mineralization decreases to 170-280 mg/dm3, and in the period of summer and winter low flow, when groundwater plays a major role in feeding rivers, mineralization increases to 500-800 mg/dm 3 ( Sinhalevych et al., 2016).
Water quality is formed under the influence of three factors: natural and domestic economy conditions for the runoff formation at the water intake, the quantity and quality of wastewater and other sources of water pollution and the processes occurring in the water body itself as well, which are largely determined by its hydrochemical and hydrological features, in particular, intensity of water exchange (Resolution of the Cabinet of Ministers of Ukraine 'On approval of the methodology for determining the standards of drinking water supply' from 25.08.2004 №1107).
Pollution of the reservoir and disruption of the element cycle in it (Hrubinko et al, 2013) leads to a ratio disturbance of the production and destruction processes, and, consequently, to an intensive accumulation of organic substances in the reservoir. This process occurs both in the water column and in bottom sediments, which leads to an increase in the rate of sediment accumulation (silting) and an increase in the content of organic substances in bottom sediments. Disruption of trophic relationships, eutrophication and other adverse processes were noted under the pollutant influence in the reservoir ecosystem (Hrubinko et al, 2013). Instead, the increase in the production potential of the reservoir, as a result of anthropogenic eutrophication, is ensured both by the increase in phytoplankton production in the pelagic zone and by higher aquatic vegetation and filamentous algae in the littoral.
An important component of the reservoir eutrophication is its intensive overgrowth, silting and waterlogging, as a result, the accumulation of organic substances due to the decay of biota organic remains in the reservoir and the arrival of toxic effect organic substances with surface runoff: amines, phenols, petroleum products, surface-active substances, etc. (Hrubinko et al, 2013).
In all investigated points, the water is slightly alkaline (Table 1), which contributes to the presence of carbonates in the hydrogen carbonate ion form, ensuring an environmentally acceptable gas regime of water and the absence of fatigue phenomena. The cause of water alkalinity is both the decay of organic substances in the bottom layer and mud with the ammonia formation, and the reservoir salinization with alkaline equivalents (sodium and potassium salts). Sufficiently high water alkalinity also contributes to the transition of a significant ammonium amount into toxic ammonia, which worsens the reservoir ecotoxicological situation, since ammonia is more toxic than ammonium.
The content of the main pollutants. The obtained data shows that ammonification has occurred in the water and bottom sediments (silt), as a consequence of the organic substance decomposition which have settled and undergone oxidation. The most ammonia-contaminated water is in the areas of Malashiv landfill runoff, stagnant water and near the dam. Flowing water areas are less polluted and the ammonia concentration is lower than the permissible norms (Table 2). Therefore, one of the critical factors for aquatic organisms, especially the bottom layer and mud, is the ammonification and accumulation of ammonia in significant concentrations and its presence in NH 3 form because of the water alkalinity. The content of phosphorus compounds in water is low, but almost all of them are in mobile form, which makes it biologically highly active (Table 3).
The revealed regularity is explained by the presence a significant amount of ions in water and silt that form poorly soluble phosphates and precipitate them in the mud.
Thus, the water quality according to the phosphate indicator is good even if they intensively arrive with washings off (Hrubinko et al, 2013) due to their transition into insoluble forms and accumulation in sludge, which is also facilitated by the water alkalinity.
That is, due to the high ammonia and low gaseous carbon dioxide content, phosphates promote sedimentation with silt components. However, in the summer, during the intensive algae development (especially blue-green algae), phosphates, a necessary nutrient component for their growth and reproduction, are removed from the silt, dissolve and reduce the water quality and pose a threat to the reservoir inhabitants, contributing to the «water blooming».

Indicators
Synthetic surface active agents (SAA) have an anthropogenic origin (synthetic detergents, industrial detergents and soluble petroleum products). The obtained data indicate high and dangerous pollution by this group of toxicants. According to the ecological assessment system of the surface land water quality and estuaries of Ukraine, the studied water, taking into account SAA indicators, belongs to the VII category (very bad) (Table 4).
Considering the reservoir structure and formation, it can be concluded that there is no significant inflow of water directly from the reservoir. Ingress of SAA pollutants is likely due to wash-off with rainwater, primarily from the Malashiv landfill.
Phenols are a group of aromatic compounds with strong alkaline properties. Together with ammonia, they determine the alkalinity of water and silt. It was established that phenols (Table 4) are the most in the places where washing off water with remains of organic matter (points 2, 3, 4, 5).
The research shows that phenol pollution is organic and is formed due to the decay of organic substances washed from the shore and, partially, with the water of the River Seret. According to the ecological assessment system of the surface land water quality and estuaries of Ukraine, the studied water with regard to the content of phenols belongs to the IV (satisfactory) and V (mediocre) water quality categories.
Biochemical oxygen demand indicator (BOD 5 ) shows the level of organic pollution. Its value in the reservoir is close to the permissible level but exceeds it at the point of water washing off the Malashiv landfill (Table 4). The established values indicate high organic pollution even in winter and correlates with the high content of petroleum products, surfactants, phenols and the formation of significant ammonia amounts, which is a product of anaerobic and aerobic oxidation of organic substances. According to the ecological assessment system of the surface land water quality and estuaries of Ukraine, the studied water in relation to BOD 5 belongs to the VI (bad) and the VII (very bad) categories.
The main factor affecting the surface water quality of the Verkhno-Ivachivsk reservoir is agriculture, which is manifested in the stable presence of ammonium nitrogen, nitrate and nitrite ions, increased biochemical oxygen consumption. Pollution comes with surface runoff too, which is evidenced by the increased concentration of suspended substances.
The presence of phosphate ions can be a consequence of pollution due to agricultural activities or pollution from nearby settlements. The summer trend of exceeding the normative indicators of biochemical oxygen demand stands out, which indicates excessive pollution by organic substances (Hrubinko et al, 2013).
Since water quality is affected by factors that change depending on external parameters and the internal state of the reservoir, in our opinion, in the above studies, it is appropriate to apply the mathematical apparatus of the fuzzy set theory. It allows, through the presentation of rule and frame type «if -then», to describe the chain of connections between indicators under a non-linear constantly dynamical and changing format of the interdependent indicator existence in real time. The practical value of using this approach in hydrochemical research of reservoirs is that the compiled rule and knowledge base can be constantly supplemented or adapted to the research apparatus of the reservoir in a specific region of Ukraine, Europe or the global geolocation reservoir system.
The implementation of research in modern Matlab software, with elements of artificial intelligence, allows the system based on the fuzzy set theory to constantly «self-learn», i.e. to make changes in the hydrochemical parameters of the reservoir in real time, which will make it possible to monitor real changes in the studied water.
The functional dependencies of the parameters in the model for assessing the quality level of the studied reservoir in general can be presented in the table. 5: g = f (Z 1 , Z 2 , Z 3 , Z 4 , Z 5 ).The input data, which determine the change range of the developed model, are systematized from the source (Klymenko et al, 2006).

Variable
Variable name Range of change (Klymenko et al, 2006).
Then we enter the input data and prescribe linguistic equations to establish neural connections between the input and the resulting water quality assessment indicator, according to the data presented in Table 5.
It is proposed to solve the forecasting tasks on the basis of modern intellectual technologies: the fuzzy set theory, neural networksa and fuzzy logic methods. Currently, the following types of fuzzy neural networks are used: Mamdani controllers, Tsukamoto fuzzy controllers, NEFPROX fuzzy neural network, TSK fuzzy neural network, and Wang-Mendel fuzzy neural network. Fuzzy sets make it possible to formalize quantities that have a qualitative basis, to identify relationships between regulated parameters and the quantities affecting them, and to formulate a fuzzy forecast in conditions of forecasting parameter uncertainty (Rohatynskyi et al, 2020).
After defuzzification of all neural connections in the Mamdani controller, Matlab software, we obtained a model for water quality level assessing in the Verkhno-Ivachivsk and Ternopil water intakes, which we present in a graphical interpretation in Figure 4. The implementation of the developed model for the practical realization of the studied reservoir will allow to replenish the knowledge base and, accordingly, the rule base with clearer logical statements and help to bring the developed model as close as possible to the «real time» mode. Furthermore, this model can be applied to another reservoir if the knowledge base and rules developed by the authors are adapted. The use of neural networks in studies of natural water bodies for qualitative indicators will allow for constant monitoring and improvement of model elements when natural factors change.
Based on the conducted modeling, the water quality level was assessed at an average level with indicator 1.52, which corresponds to the average level in the range (1.36-2.18) according to the rating scale, but is closer to the lower level of the scale and indicates an insufficient level water quality in the Verkhno-Ivachivsk water intake. At the same time, factor Z 1 (BOD 5 ) falls with a value of 3.1 into the range of an average level in the interval (3.1-3.9), according to the scale of terms (Table 5), since it has the influence of such factors as a sufficiently high level of NH4+ in the studied reservoirs of the Ternopil region. This indicator falls into the area of high values (6.1-6.9) (B), which negatively affects the quality of water.
Conducted research confirmed the presence phenols in the studied reservoir, which reduce water quality. The presence of anthropogenic load on the reservoir is confirmed by research and modeling of the influence of such a factor as SAA, which with an indicator 0.8 belongs to a high level (range of the term scale 0.651-0.88) (B), (VII very bad). According to of linguistic equations of fuzzy sets it reduces the determining level of water quality in the studied reservoir from high to medium. The conducted laboratory studies and modeling of the content of petroleum products indicate that their presence in the studied reservoir corresponds to the average level on the rating scale (0.238-0.244) (С).

Conclusions
Seasonal deterioration of the water begins in autumn and significantly intensifies in winter due to the death of phytoplankton and higher aquatic vegetation that develop in summer. It is evidenced by the intensive accumulation of ammonia and phenols.
The water quality according to the phosphate indicator is good even in the conditions of phosphates intensive supply with washings off, due to their transition into insoluble forms and accumulation in silte, which is also facilitated by the water alkalinity. That is, due to the high content of ammonia and low gaseous carbon dioxide, phosphates form slightly soluble compounds with silt components. However, in summer, during the intensive algae development (espe-cially diatoms and blue-green algae), phosphates, as a necessary nutrient component for their growth and reproduction, will be removed from the silt, turn into a mobile form and reduce the water quality. They pose a threat to the reservoir and its inhabitants as promote «bloom» (eutrophication) of water.
From the obtained data, it is clear that ammonification has occurred in the water, which is the decomposition result of the organic substances that have settled and undergone oxidation. The most ammonia-contaminated water is in the areas where the water flows from the Malashiv landfill, stagnant water, and in the areas of the reservoir near the dam.
Particularly dangerous petroleum products and SAA are the points of intensive surface runoff inflow -the area near the dam of the Malashiv landfill. The content of petroleum products correlates with the ammonia content and the decrease in the oxygen content.
BOD 5 is close to the permissible level and even exceeds it at the point of water washing off from the Malashiv landfill. The established value indicates high organic pollution even in winter and correlates with the high content of petroleum products, SAA, phenols and the formation of significant ammonia amounts, which is a product of anaerobic and aerobic oxidation of organic substances.
The water of the Verkhno-Ivachivsk water intake according to the content of phenols belongs to the IV (satisfactory) and the V (mediocre) category of water quality; according to the content of petroleum products and BOD 5 indicator, it is up to the VI (bad) and the VII (very poor) categories; according to the content of ammonium compounds (NH4+) relates to the VI (bad), VII (very bad) and VIII (too bad ) categories; according to the content of SAA -VII (very bad) category.
Performing defuzzification of all neural connections in the Mamdani controller, Matlab software, shows that the water quality of the Verkhno-Ivachivsk water intake corresponds to the average level, but closer to the lower level of the scale.
The developed water quality assessment model, with the available results of laboratory studies, allows to establish the influence degree of hydrochemical indicators through neural connections, and the implementation of the proposed model in the Matlab environment, with artificial intelligence modules, will allow the program to «self-learn», and by supplementing input and intermediate parameters adapt to the studied reservoir of any region and point of the world.