Computational Water, Energy, and Environmental Engineering
Vol.3 No.4(2014), Article ID:49790,11 pages DOI:10.4236/cweee.2014.34014

C-Language Programming for Development of Conventional Water Treatment Plants Decision Support System

Thogare N. Shridhara, Samson O. Ojoawo*, Pilli V. Mahaganesha, Mallaura R. Thippeswary, Rahul Anand, Bevinahalli P. Sharath

Department of Civil Engineering, NMAM Institute of Technology, Udupi District, India

Email: *

Copyright © 2014 by authors and Scientific Research Publishing Inc.

This work is licensed under the Creative Commons Attribution International License (CC BY).

Received 23 July 2014; revised 25 August 2014; accepted 5 September 2014


Water-Decision Support System (DSS) tools enhance decision-makings towards improved water supply in a given region. The rigours of manual design of the conventional water treatment plants are easily eliminated with the use of softwares as in the case of DSS. Therefore, this paper focuses on the development of a Water-DSS for design of treatment plant in Karkala Town, Udupi District of India. A four-decade population projection was made using the baseline data of 1971 till date. The manual computation for water demand, unit operations and adjoining facilities was carried out and later coded in C-programming language for development of a DSS for easier design and process selection. Data validation was done and results from the two approaches were compared. With the C-programming technique, a decision support tool for design and process selection of drinking water treatment plant using conventional method has been developed and named Water-DSS1. The designed tool is simple, accurate, flexible, efficient and universal, easily adaptable to any similar conventional treatment plant. Water-DSS1 is thus recommended for general use in ultimately alleviating water supply challenges.

Keywords:Decision Support System, Treatment Plant, C-Programming, Water Supply

1. Introduction

In a simple form, Decision Support System, DSS is any system supporting decision-making, including executive information systems, executive support systems, geographic information systems and software agents [1] . The concept of DSS emerged in the 1970s, as a family of interactive computer-based systems in the field of decision theory and assisting in utilizing data models to solve unstructured problems, especially with great potential in the field of environmental management [2] .

C-programming has emerged as one of the most widely used languages for software development and for DSS. C language supports the powerful low level features like pointer, memory allocation, bit manipulations etc. The features of C language make it possible to see the language for system programming like the development of compiler, interpreter, operating system, system utilities etc. [3] . C language has become the language of choice of two decades among system programmers and application programmers. It is popular because it is powerful and flexible; it is portable; efficient; programmer-oriented; and can be modularized for step-wise refinement [4] .

The overall efficiency of a Water Treatment Plant depends largely on its design and the functionalities of the Unit Processes constituted in it [5] . Most of the design procedures for water treatment plant have been developed using manuals or spreadsheet calculations which are time consuming and costly [6] . Therefore, a DSS is required to speed up the design process and reduce the design cost. The central aim of this study is to develop and employ a DSS tool in the general design of Conventional Water Treatment Plants. A case study of Karkala town, Udupi District, Karnataka State, India has been selected, and the design based on projected population against the year 2043 using C-programming language in Code-Blocks 10.05. Study also focuses on developing an easier, cheaper and user-friendly DSS to assist in selecting appropriate and essential procedures for water treatment process; and to compare the obtained output values of manual design and C-programming. Thus, a general Water Decision Support System named WATER-DSS1 has been developed to reduce the design time and while maximizing the treatment plant efficiency, using Karkala Treatment Plant as a case study.

2. Methodology

(a) Study Area

The study area is Karkala Taluk which is located at 13.2˚N 74.98˚E (Figure 1). It has an average elevation of 81 metres (265 feet) above the Mean Sea Level. It has a population of 25,824 people (according to 2011 census). It has an area of 23.06 sq∙km and the annual rainfall is 4372.2 mm. currently the city have 3 MLD of total water supply from the Mundli River. The summer temperature is 38˚C and winter temperature is 24˚C. Suvarna River has been considered as the source to accomplish the future water demand for Karkala town [4] .

(b) Development of WATER-DSS

The DSS (Decision Support System) in this study is known as WATER-DSS. The development of WATERDSS applies methods of conventional computing practices and programming techniques. WATER-DSS was built by integrating the conceptual design of drinking water treatment through conventional method into a computer program, which has capability as a DSS. The structure design of WATER-DSS [6] is shown in Figure 2.

Figure 1. The study area.

Figure 2. WATER-DSS development structure.

(c) Conventional Water Treatment Plant Units

The units of a typical conventional treatment plant include aeration, plain sedimentation tank, sedimentation aided with coagulation, flocculation, filters, disinfection etc. Figure 3 shows the flowchart of conventional water treatment plant.

(d) Manual design of the Water Treatment Plant ([7] [8] )

(i) Forecasting population

The Conventional Water Treatment Plant is being designed for the next 3 decades.

Forecasting population of the study area for 3 decades by the Geometric Increase Method:

If the present is P and the average percentage growth is IG the population at the end of n decade will be:

So from Table 1, the Expected Population of Karkala by 2043 is 38,396 people.

(ii) Water demand

The water requirement per capita demand of Karkala = 100 LPCD (BIS Code).

Thus, water requirement of Karkala per day = 38,396 ´ 100 = 3,839,600 = 3.84 MLD.

So, the proposed water treatment plant design is of approximately 3.85 MLD in capacity.

(iii) Aeration process

Assuming number of steps = 5 and that tread width, t = 250 mm Diameter of the first step, D1 = 1 m (including the diameter of pipe)

Diameter of the second step,

Diameter of the third step,

Diameter of the fourth step,

Diameter of the fifth step,

Diameter of aeration tank (collector) = D5 + 2(1) = 3 + 2 = 5 m Further assuming that:

Rise of 1st step = 0.3 m Rise of 2nd step = 0.4 m Rise of 3rd step = 0.5 m Rise of 4th step = 0.6 m Rise of 5th step = 0.7 m Overall Dimension of Aeration tank of diameter 5 m and total height of Cascade is 2.5 m.

Figure 3. Flowchart of conventional water treatment plant.

Table 1. Forecasting of population for 3 decades.

(iv) Plain sedimentation tank

Quantity of water to be treated in 24 hours = 3.85 ´ 106 liters = 3850 m3.

Quantity of water to be treated by the sedimentation tank during detention period of 6 hours = = 962.5 m3.

Thus the capacity of the sedimentation tank required = 962.5 m3.

Assume the velocity of flow = 18 cm per min or 0.003 m/s.

Length of the tank required = Velocity of tank (m/s) ´ Detention period (s) = 0.003 ´ (6 ´ 60 ´ 60) = 64.8 m.

Cross section of tank required = = = 14.85 m2.

Assume the depth of water = 4 m which includes allowable allowance for sludge to be made as 80 cm (or 0.8 m).

Required width of tank = = 4.64 m.

Providing 0.5 m for free board, overall depth of the tank = 4 + 0.5 = 4.5.

Therefore the dimensions of the designed tank are = (64.8 ´ 4.64 ´ 4.5) m.

Note that the length of the tank may be provided in one, two, or three parts depending upon the shape of the area available.

(v) Sedimentation tank aided with coagulants

(1) Chemical feeding

Using alum as coagulant, the optimum quantity of dose will be determined actually by jar test in the laboratory.

Let the optimum dose be 5 - 8 mg/liter.

The average quantity of alum required = to = 4.82 to 7.7 kg/day.

The maximum requirement in summer will be 1.5 times more = 7.23 to 11.55 kg/day.

This quantity of alum shall be first mixed with the water to form a solution of 5 strength and then will be added through solution feed device which is given as = 11.55 ´ 20 liters/day = = 0.1604 liters/min.

Minimum dose which will be fed during average demand = = 0.1609 liters/min.

Quantity of solution to be fed in 8 hours/day = 0.1604 ´ 60 ´ 8 = 76.99 liters.

Providing solution tank of capacity = 0.07699 m3 = 0.077 m3.

Keeping the depth of solution in the tank as 0.35 m and 0.15 m as free board.

The sides of the square tank = = 0.4699 m = 0.5 m.

So the designed size of Solution Tank = (0.5 ´ 0.5 ´ 0.5) m.

(2) Approach channel

The flow of channel = = 0.11 m3/s.

Providing a velocity of 0.4 m/s, the cross sectional area of approach channel = = 0.0275 m2.

Provide (0.175 ´ 0.225) m channel with 175 mm water depth and 50 cm free board.

(3) Mixing tank

Mechanical flash mixers will be used for mixing the coagulant solution with the water.

Assuming the detention period of one minute (60 s).

Capacity of flash mixer = 0.11 ´ 60 = 0.66 m3.

Providing depth of 1m, the sides of the square plan mixing tank = = 0.8 m.

Therefore provide (1 ´ 1 ´ 1) m size of mixing tank with flocculator.

(v) Flocculating Tank

A flocculating tank with mixing slow moving paddles is provided with variable speed electric motors.

Assuming the flocculating time of 30 minutes, the capacity of each flocculating tank = 0.11 ´ 30 = 19.8 m3.

So, provide a channel of capacity = 19.8 m3.

Providing 1.6 m depth of water and 10 m of length of channel its width = = 1.2375 m.

Therefore, provide channel of size (10 ´ 1.4 ´ 1.6) m with water depth of water 1.4 m and 0.2 m as free board in continuation on flash mixer.

(vi) Settling Tank

Provide a rectangle sedimentation tank with a square tank with surface loading of 2000 litres/hour/m2 plan of area.

Surface loading of each tank = = 19.8 m3.

Assume length = 6 m.

Therefore width becomes = = 3.3 m.

Therefore weir loading in the settling tank at average flow is given as = = = 48.61 m3/m/day.

Providing a detention period of 2.5 hours at a time of maximum flow.

Capacity of tank = = 1000.26 m3.

Now quantity of water to be treated in one hour = = 40.104 m3.

Therefore required depth of tank = = 2.035 m.

Add 0.5 m for storage and 0.5 m for free board, say overall depth = 3 m.

Provide rectangular settling tank (6 ´ 3.3 ´ 3) m. The bottom of the tank is sloped of 1 in 12 pushing the sludge towards the discharging end, with the help of scrappers from where it will be removed by the sludge outlet under hydrostatic pressure of water filled in the tank.

The water will be collected from settling tank over its discharging end along the weir provided all around the water from this channel shall be taken into the rapid gravity filters in covered channels (0.3 ´ 0.3) m.

(vii) Rapid Gravity Filter

Quantity of water to be treated = 3.85 litres/day.

Assume the rate of filtration of rapid gravity filter—2000 litres/m2/hour and also assuming that 30 minutes shall be utilized daily in the back-washing of the filter, the total filter area required = = 81.92 m2.

Provide 4 units of rapid gravity filters with two numbers of stand-by units.

Surface area of each unit = = 40.96.

Therefore each unit of size = (6.5 ´ 6.5) m.

(viii) Chlorination Plant

The dose of the chlorine to be added will vary from 0.5 to 1.0 ppm depending on the quantity of water and the chlorine demand tests.

Therefore quantity of chlorine required = = 0.08 kg/hour.

Therefore liquid chlorinator having capacity 0.1 to 5 kg/hour will be installed.

(ix) Underground Reservoir Water

Underground clear water reservoir having capacity of about 8 hours will be provided.

Quantity of water to be stored = 3.85 ´ 103 m3.

Providing 5 m depth, area of clear water reservoir = = 770 m2.

So, the dimensions of the designed underground clear water reservoir = (40 ´ 19.25 ´ 5) m.

(x) Design of Pumps (Centrifugal Pumps)

We are adopting two pump stations, one is at source and another is in the middle.

Maximum daily water requirement = 1.5 ´ 3.85 ´ 1000 m3/day = 5.775 ´ 103 m3/day.

Since Pumping time is 8 hours per day,.

Assume: Velocity in pipe, V = 2 m/s.



Say, therefore d = 0.36 m.

Calculation of total head loss:

Loss of head due to frictionNow,

Suction head, Hs = 2.5 m.

Delivery head, Hl = 12.5 m.

Total head, H = 33.978 + 2.5 + 12.5 = 48.978 48.98 m.

Therefore the power of pump = = = 163.27.

Pump power 164 HP.

Provide 41 HP Centrifugal Pumps of six numbers in that two numbers are standby at each pump station.

(e) A portion of Water-DSS1 C-Program for Karkala Treatment Plant Design

The unit processes manually designed above were coded in C-Language and fed into the in Code-Blocks 10.05 software. A portion of the program, for the population forecast, water demand, aeration unit design and underground clear water reservoir, is as shown below:




int main()


float wr,qty,len,vel,lpcd=100,det,cs,dep,sld,wid,fd,od,dose,alum1,alum2,fd2,dose2,fe,si,de,fl,vi,cs2,wi,den2, ca,dep2,si2,ft,ca2,dep3,wi2,len2;

float sl,sa,len3,wi3,wl,den3,ca3,dep4,qty2,ss,fb,qty3,fa,sa2,s,ae,dep5,s2,stp,tre,dia2,dia3,ris,ris1, count1=0, max, tim,qty4;

float dia4,x,y,total=0,Ig,pn,final_population,result,vel1,dis,hf,th,hp,p1;

int i,popu[125],d,j,n,year[125] ,p;


printf("\nEnter the number of census:\n");




printf("\nEnter the corresponding year:");


year[i] =d;

printf("Enter the population in the year %d:",d);






printf("\nIncrease in population in decade %d-%d:",year[i-1], year[i]);




printf("Percentage increase in population of decade %d-%d:",year[i-1],year[i]);

printf("%0.2f percent\n",y);



printf("\nTotal=%0.2f percent\n",total);


printf("Average per Decade=%0.2f percent\n",Ig);


printf("\nPopulation at the end of %d decades i.e. by the year 2041 is %0.2f",n-1,final_population);


printf("\nTherefore Expected population of Karkala by the year 2043 is %0.2f\n",result);

printf("\nThe WATER DEMAND\n");


printf("\nWater required of karkala per day=%f Million litres per day\n",wr);


printf("\nEnter the number of steps\n");


printf("\nEnter the tread width in millimeters\n");


printf("\nEnter the diameter of the first step in meter\n");



for(i=1; i<=stp-1;i++)


printf("\nDiameter of the %d step =%f meters",i,dia3);



printf("\nDiameter of the %d step =%f meters\n",i,dia3);

printf("\nDiameter of the aeration tank collector =%f meters\n",dia3+2*dia2);

printf("\nEnter the rise of the first step in millimeters\n");





printf("\nRise of the %d step =%f meters",i,ris1);





printf("\nRise of the %d step =%f meters\n",i,ris1);

printf("\nThe overall of aeration tank of diameter %f meters and total height of casacade is %f meters",dia3+2*dia2,count1);


printf("\nUnderground clear water reservoir having capacity of about 8 hours will be provided\n");

printf("\nEnter the depth in meters\n");



printf("\nArea of the clear water resevoir =%f square meters\n",ae);

printf("\nProviding square clear water resevoir\n ");


printf("\nThe dimension of the clear water resevior is(%f*%f*%f) meters\n",s2,s2,dep5);

return 0;


3. Results and Discussions

(a) Results: A portion of the direct output values from the C-program is as presented here:

Population forecasting

Enter the corresponding year: 1971 Enter the population in the year 1971: 18593 Enter the corresponding year: 1981 Enter the population in the year 1981: 20713 Enter the corresponding year: 1991 Enter the population in the year 1991: 24109 Enter the corresponding year: 2001 Enter the population in the year 2001: 25116 Increase in population in decade 1971-1981: 2120 Percentage increase in population of decade 1971-1981: 11.40 percent Increase in population in decade 1981-1991: 3396 Percentage increase in population of decade 1981-1991: 16.40 percent Increase in population in decade 1991-2001: 1007 Percentage increase in population of decade 1991-2001: 4.18 percent Total = 31.97 percent Average per decade = 10.66 percent Population at the end of 3 decades i.e. by the year 2041 is 37660.35 Therefore expected population of Karkala by the year 2043 is 38430.95

Water demand

Water required of Karkala per day=3.843095 million liters per day

Design of the aeration tank

Enter the number of steps 5 Enter the tread width in millimeters 250 Enter the diameter of the first step in meter 1 Diameter of the 1 step = 1.000000 meters Diameter of the 2 step = 1.500000 meters Diameter of the 3 step = 2.000000 meters Diameter of the 4 step = 2.500000 meters Diameter of the 5 step = 3.000000 meters Diameter of the aeration tank collector = 5.000000 meters Enter the rise of the first step in millimeters 300 Rise of the 1 step = 0.300000 meters Rise of the 2 step = 0.400000 meters Rise of the 3 step = 0.500000 meters Rise of the 4 step = 0.600000 meters Rise of the 5 step = 0.700000 meters The overall of aeration tank of diameter 5.000000 meters and total height of casacade is 2.500000 meters

Design of underground clear water reservoir

Underground clear water reservoir having capacity of about 8 hours will be provided Enter the depth in meters 5 Area of the clear water reservoir = 768.618896 square meters Providing square clear water reservoir The dimension of the clear water reservoir is (27.723976 ´ 27.723976 ´ 5.000000) meters Process returned 0 (0 × 0) execution time: 318.415 s Press any key to continue.

(b) Discussions: With the C-programming technique a decision support tool for design and process selection of drinking water treatment plant using conventional method has been developed and named WATER-DSS1. The tool assists in decision making on the process of drinking water treatment plant using conventional treatment methods. The process consists of pre-treatment, coagulation, flocculation, sedimentation, filtration and disinfection. The processes are selected based on the requirement to treat the raw water, chemically, physically

Table 2 . Comparison of the manual and C-program output values. 

and microbiologically. Each parameters of water has its own treatment procedure but often these can be combined.

In validating the developed program, required data was keyed in and run. At the same time, manual computations are done using the conventional method for the designing the different units of the water treatment plant. The output values of the C-program as compared with those of manual design are presented in Table2 Meanwhile, if the user desires to get the design of any particular unit of the water treatment plant, it is possible to access the desired unit’s design using the “switch case” statement. This flexibility further confirms the userfriendliness of C-programming Language.

In comparing the C-program output values and the manually designed values only marginal differences were observed, especially in the decimal places. It is so, because in the c-programming “float” data type is used which gives the accurate values up to six decimal points whereas in manual design the values are rounded off to two decimal points.

4. Conclusion

In this paper with the C-programming technique, a decision support tool for design and process selection of drinking water treatment plant using conventional method has been developed and named Water-DSS1. The applied C-program is user friendly, saves time and gives more accurate values. The program is much more efficient and reliable than the manual design and can be used repeatedly for different sets of data. It is universal in its approach and easily adaptable to any similar conventional water treatment plant apart from the Karkala one reported in this paper. Water-DSS1 is therefore recommended for general use in alleviating water supply challenges.


  1. Power, D.J. (1997) What Is DSS? DSstar. The Online Executive Journal for Data-Intensive Decision Support, 2, 15-20.
  2. Gorry, G.A. and Scott Morton, M.S. (1971) A Framework for Management Information Systems. Sloan Management Review, 13, 55-70.
  3. Kanetkar, Y.P. (2013) Let Us C. 13th Edition, BPB Publications, New Delhi.
  4. Mahaganesha, P.V., Thippeswamy, M.R., Anand, R. and Sharath, B.P. (2014) Design of Conventional Water Treatment PLANT for Karkala Town Using C-Programming. B.E Project Report, Department of Civil Engineering, NMAM Institute of Technology, Nitte.
  5. Ojoawo, S.O. (1997) Performance Evaluation of the Ogbomoso Waterworks. B.Tech Project Report Submitted to the Department of Civil Engineering, Ladoke Akintola University of Technology, Ogbomoso, 3.
  6. Hung, C.K. (2006) Development of a Decision Support System for Drinking Water Treatment Process Design (WATERDSS). M.E Project Report Submitted to the Faculty of Civil Engineering, Universiti Teknologi Malaysia, 32-35.
  7. Garg, S.K. (2004) Water Supply Engineering. 18th Edition, Khanna Publishers, Delhi.
  8. Crittenden, J., Trussell, R., Hand, D., Howe, K. and Tchobanoglous, G. (2005) Water Treatment: Principles and Design. John Wiley and Sons, New York.


*Corresponding author.