While simulating this system, the following assumptions are made:
1. Simulation is done for 60 consecutive months
2. Water received through direct Rain Fall is assumed to be not more than 30% of the capacity of the reservoir
3. Maximum water received through River Inflow is 130% of the capacity of the reservoir
4. Seepage loss is not more than 5% and Evaporation loss is not more than 8% of the gross volume of water
5. Demand is never more than the Capacity of the Reservoir.
#include < stdio.h >
#include < conio.h >
#include < math.h >
#include < stdlib.h >
void main()
{
clrscr();
float rain[61],rflow[61],vin[61],seep[61],evap[61],tloss[61],vnet[61];
float grossv[61],shortage[61],spill[61],vol[61],dem[61];
float dif;
int m,cap=100;
vol[0]=0;
randomize();
for(m=1;m<=60;m++)
{
rain[m] =(rand()%cap)*0.3;
rflow[m]=(rand()%cap)*1.3;
vin[m]=rain[m]+rflow[m];
grossv[m]=vol[m-1]+vin[m];
seep[m]= grossv[m]*0.05;
evap[m]=grossv[m]*0.08;
tloss[m]=seep[m]+evap[m];
dem[m]=rand()%cap;
if(tloss[m]>grossv[m])
{
shortage[m]=dem[m];
vol[m]=0;
spill[m]=0;
}
else
{
vnet[m]=grossv[m]-tloss[m];
if (dem[m]>vnet[m])
shortage[m]=dem[m]-vnet[m];
else
{
dif=vnet[m]-dem[m];
if (dif>cap)
{
spill[m]=dif-cap;
vol[m]=cap;
shortage[m]=0;
}
else
{
vol[m]=dif;
spill[m]=0;
shortage[m]=0;
}
}
}
}
printf("Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill\n\n");
for(m=1;m<=60;m++)
{
printf("%2.0d %5.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %5.1f %5.1f %5.1f %5.1f %5.1f\n\n",m,rain[m],rflow[m],vin[m],vol[m-1],grossv[m],seep[m],evap[m],tloss[m],vnet[m],dem[m],shortage[m],spill[m]);
if((m%15)==0 &&(m<60 p=""> {
getch();
printf("Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill\n\n");
}
}
getch();
}
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
1 5.1 88.4 93.5 0.0 93.5 4.7 7.5 12.2 81.3 27.0 0.0 0.0
2 3.6 55.9 59.5 54.3 113.8 5.7 9.1 14.8 99.0 54.0 0.0 0.0
3 14.7 93.6 108.3 45.0 153.3 7.7 12.3 19.9 133.4 1.0 0.0 32.4
4 1.2 24.7 25.9 100.0 125.9 6.3 10.1 16.4 109.5 6.0 0.0 3.5
5 28.5 104.0 132.5 100.0 232.5 11.6 18.6 30.2 202.3 31.0 0.0 71.3
6 4.8 14.3 19.1 100.0 119.1 6.0 9.5 15.5 103.6 60.0 0.0 0.0
7 23.1 13.0 36.1 43.6 79.7 4.0 6.4 10.4 69.4 88.0 18.6 11.7
8 2.1 53.3 55.4 100.0 155.4 7.8 12.4 20.2 135.2 46.0 0.0 0.0
9 11.1 5.2 16.3 89.2 105.5 5.3 8.4 13.7 91.8 15.0 0.0 0.0
10 8.7 110.5 119.2 76.8 196.0 9.8 15.7 25.5 170.5 41.0 0.0 29.5
11 23.1 115.7 138.8 100.0 238.8 11.9 19.1 31.0 207.8 9.0 0.0 98.8
12 0.6 83.2 83.8 100.0 183.8 9.2 14.7 23.9 159.9 83.0 0.0 0.0
13 9.9 66.3 76.2 76.9 153.1 7.7 12.2 19.9 133.2 51.0 0.0 0.0
14 4.5 83.2 87.7 82.2 169.9 8.5 13.6 22.1 147.8 51.0 0.0 0.0
15 20.4 74.1 94.5 96.8 191.3 9.6 15.3 24.9 166.4 50.0 0.0 16.4
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
16 16.2 66.3 82.5 100.0 182.5 9.1 14.6 23.7 158.8 82.0 0.0 0.0
17 1.2 126.1 127.3 76.8 204.1 10.2 16.3 26.5 177.5 20.0 0.0 57.5
18 24.9 102.7 127.6 100.0 227.6 11.4 18.2 29.6 198.0 8.0 0.0 90.0
19 28.8 37.7 66.5 100.0 166.5 8.3 13.3 21.6 144.9 76.0 0.0 0.0
20 25.2 63.7 88.9 68.9 157.8 7.9 12.6 20.5 137.2 26.0 0.0 11.2
21 29.7 118.3 148.0 100.0 248.0 12.4 19.8 32.2 215.8 46.0 0.0 69.8
22 19.8 89.7 109.5 100.0 209.5 10.5 16.8 27.2 182.3 4.0 0.0 78.3
23 24.0 22.1 46.1 100.0 146.1 7.3 11.7 19.0 127.1 55.0 0.0 0.0
24 21.0 110.5 131.5 72.1 203.6 10.2 16.3 26.5 177.1 4.0 0.0 73.1
25 6.3 87.1 93.4 100.0 193.4 9.7 15.5 25.1 168.3 12.0 0.0 56.3
26 18.3 102.7 121.0 100.0 221.0 11.1 17.7 28.7 192.3 61.0 0.0 31.3
27 27.3 88.4 115.7 100.0 215.7 10.8 17.3 28.0 187.7 54.0 0.0 33.7
28 3.9 59.8 63.7 100.0 163.7 8.2 13.1 21.3 142.4 71.0 0.0 0.0
29 3.0 57.2 60.2 71.4 131.6 6.6 10.5 17.1 114.5 44.0 0.0 0.0
30 23.4 122.2 145.6 70.5 216.1 10.8 17.3 28.1 188.0 10.0 0.0 78.0
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
31 1.8 35.1 36.9 100.0 136.9 6.8 11.0 17.8 119.1 80.0 0.0 0.0
32 12.0 117.0 129.0 39.1 168.1 8.4 13.4 21.9 146.2 27.0 0.0 19.2
33 19.8 62.4 82.2 100.0 182.2 9.1 14.6 23.7 158.5 1.0 0.0 57.5
34 11.1 37.7 48.8 100.0 148.8 7.4 11.9 19.3 129.5 39.0 0.0 0.0
35 0.3 117.0 117.3 90.5 207.8 10.4 16.6 27.0 180.7 13.0 0.0 67.7
36 9.6 94.9 104.5 100.0 204.5 10.2 16.4 26.6 177.9 86.0 0.0 0.0
37 12.3 66.3 78.6 91.9 170.5 8.5 13.6 22.2 148.3 98.0 0.0 0.0
38 16.2 94.9 111.1 50.3 161.4 8.1 12.9 21.0 140.5 8.0 0.0 32.5
39 2.7 33.8 36.5 100.0 136.5 6.8 10.9 17.7 118.8 20.0 0.0 0.0
40 9.9 54.6 64.5 98.8 163.3 8.2 13.1 21.2 142.0 80.0 0.0 0.0
41 6.6 93.6 100.2 62.0 162.2 8.1 13.0 21.1 141.1 88.0 0.0 0.0
42 14.7 70.2 84.9 53.1 138.0 6.9 11.0 17.9 120.1 25.0 0.0 0.0
43 4.2 9.1 13.3 95.1 108.4 5.4 8.7 14.1 94.3 28.0 0.0 0.0
44 18.0 22.1 40.1 66.3 106.4 5.3 8.5 13.8 92.6 28.0 0.0 0.0
45 3.3 102.7 106.0 64.6 170.6 8.5 13.6 22.2 148.4 94.0 0.0 0.0
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
46 29.4 41.6 71.0 54.4 125.4 6.3 10.0 16.3 109.1 82.0 0.0 0.0
47 20.1 35.1 55.2 27.1 82.3 4.1 6.6 10.7 71.6 34.0 0.0 0.0
48 4.2 83.2 87.4 37.6 125.0 6.2 10.0 16.2 108.7 95.0 0.0 0.0
49 8.4 39.0 47.4 13.7 61.1 3.1 4.9 7.9 53.2 32.0 0.0 0.0
50 28.5 113.1 141.6 21.2 162.8 8.1 13.0 21.2 141.6 68.0 0.0 0.0
51 6.3 0.0 6.3 73.6 79.9 4.0 6.4 10.4 69.5 18.0 0.0 0.0
52 3.6 123.5 127.1 51.5 178.6 8.9 14.3 23.2 155.4 28.0 0.0 27.4
53 25.8 107.9 133.7 100.0 233.7 11.7 18.7 30.4 203.3 65.0 0.0 38.3
54 24.9 87.1 112.0 100.0 212.0 10.6 17.0 27.6 184.4 15.0 0.0 69.4
55 14.1 127.4 141.5 100.0 241.5 12.1 19.3 31.4 210.1 96.0 0.0 14.1
56 3.6 1.3 4.9 100.0 104.9 5.2 8.4 13.6 91.3 28.0 0.0 0.0
57 7.8 126.1 133.9 63.3 197.2 9.9 15.8 25.6 171.5 40.0 0.0 31.5
58 0.3 26.0 26.3 100.0 126.3 6.3 10.1 16.4 109.9 32.0 0.0 0.0
59 28.2 29.9 58.1 77.9 136.0 6.8 10.9 17.7 118.3 44.0 0.0 0.0
60 3.6 78.0 81.6 74.3 155.9 7.8 12.5 20.3 135.6 79.0 0.0 0.0
60>
1. Simulation is done for 60 consecutive months
2. Water received through direct Rain Fall is assumed to be not more than 30% of the capacity of the reservoir
3. Maximum water received through River Inflow is 130% of the capacity of the reservoir
4. Seepage loss is not more than 5% and Evaporation loss is not more than 8% of the gross volume of water
5. Demand is never more than the Capacity of the Reservoir.
#include < stdio.h >
#include < conio.h >
#include < math.h >
#include < stdlib.h >
void main()
{
clrscr();
float rain[61],rflow[61],vin[61],seep[61],evap[61],tloss[61],vnet[61];
float grossv[61],shortage[61],spill[61],vol[61],dem[61];
float dif;
int m,cap=100;
vol[0]=0;
randomize();
for(m=1;m<=60;m++)
{
rain[m] =(rand()%cap)*0.3;
rflow[m]=(rand()%cap)*1.3;
vin[m]=rain[m]+rflow[m];
grossv[m]=vol[m-1]+vin[m];
seep[m]= grossv[m]*0.05;
evap[m]=grossv[m]*0.08;
tloss[m]=seep[m]+evap[m];
dem[m]=rand()%cap;
if(tloss[m]>grossv[m])
{
shortage[m]=dem[m];
vol[m]=0;
spill[m]=0;
}
else
{
vnet[m]=grossv[m]-tloss[m];
if (dem[m]>vnet[m])
shortage[m]=dem[m]-vnet[m];
else
{
dif=vnet[m]-dem[m];
if (dif>cap)
{
spill[m]=dif-cap;
vol[m]=cap;
shortage[m]=0;
}
else
{
vol[m]=dif;
spill[m]=0;
shortage[m]=0;
}
}
}
}
printf("Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill\n\n");
for(m=1;m<=60;m++)
{
printf("%2.0d %5.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %5.1f %5.1f %5.1f %5.1f %5.1f\n\n",m,rain[m],rflow[m],vin[m],vol[m-1],grossv[m],seep[m],evap[m],tloss[m],vnet[m],dem[m],shortage[m],spill[m]);
if((m%15)==0 &&(m<60 p=""> {
getch();
printf("Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill\n\n");
}
}
getch();
}
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
1 5.1 88.4 93.5 0.0 93.5 4.7 7.5 12.2 81.3 27.0 0.0 0.0
2 3.6 55.9 59.5 54.3 113.8 5.7 9.1 14.8 99.0 54.0 0.0 0.0
3 14.7 93.6 108.3 45.0 153.3 7.7 12.3 19.9 133.4 1.0 0.0 32.4
4 1.2 24.7 25.9 100.0 125.9 6.3 10.1 16.4 109.5 6.0 0.0 3.5
5 28.5 104.0 132.5 100.0 232.5 11.6 18.6 30.2 202.3 31.0 0.0 71.3
6 4.8 14.3 19.1 100.0 119.1 6.0 9.5 15.5 103.6 60.0 0.0 0.0
7 23.1 13.0 36.1 43.6 79.7 4.0 6.4 10.4 69.4 88.0 18.6 11.7
8 2.1 53.3 55.4 100.0 155.4 7.8 12.4 20.2 135.2 46.0 0.0 0.0
9 11.1 5.2 16.3 89.2 105.5 5.3 8.4 13.7 91.8 15.0 0.0 0.0
10 8.7 110.5 119.2 76.8 196.0 9.8 15.7 25.5 170.5 41.0 0.0 29.5
11 23.1 115.7 138.8 100.0 238.8 11.9 19.1 31.0 207.8 9.0 0.0 98.8
12 0.6 83.2 83.8 100.0 183.8 9.2 14.7 23.9 159.9 83.0 0.0 0.0
13 9.9 66.3 76.2 76.9 153.1 7.7 12.2 19.9 133.2 51.0 0.0 0.0
14 4.5 83.2 87.7 82.2 169.9 8.5 13.6 22.1 147.8 51.0 0.0 0.0
15 20.4 74.1 94.5 96.8 191.3 9.6 15.3 24.9 166.4 50.0 0.0 16.4
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
16 16.2 66.3 82.5 100.0 182.5 9.1 14.6 23.7 158.8 82.0 0.0 0.0
17 1.2 126.1 127.3 76.8 204.1 10.2 16.3 26.5 177.5 20.0 0.0 57.5
18 24.9 102.7 127.6 100.0 227.6 11.4 18.2 29.6 198.0 8.0 0.0 90.0
19 28.8 37.7 66.5 100.0 166.5 8.3 13.3 21.6 144.9 76.0 0.0 0.0
20 25.2 63.7 88.9 68.9 157.8 7.9 12.6 20.5 137.2 26.0 0.0 11.2
21 29.7 118.3 148.0 100.0 248.0 12.4 19.8 32.2 215.8 46.0 0.0 69.8
22 19.8 89.7 109.5 100.0 209.5 10.5 16.8 27.2 182.3 4.0 0.0 78.3
23 24.0 22.1 46.1 100.0 146.1 7.3 11.7 19.0 127.1 55.0 0.0 0.0
24 21.0 110.5 131.5 72.1 203.6 10.2 16.3 26.5 177.1 4.0 0.0 73.1
25 6.3 87.1 93.4 100.0 193.4 9.7 15.5 25.1 168.3 12.0 0.0 56.3
26 18.3 102.7 121.0 100.0 221.0 11.1 17.7 28.7 192.3 61.0 0.0 31.3
27 27.3 88.4 115.7 100.0 215.7 10.8 17.3 28.0 187.7 54.0 0.0 33.7
28 3.9 59.8 63.7 100.0 163.7 8.2 13.1 21.3 142.4 71.0 0.0 0.0
29 3.0 57.2 60.2 71.4 131.6 6.6 10.5 17.1 114.5 44.0 0.0 0.0
30 23.4 122.2 145.6 70.5 216.1 10.8 17.3 28.1 188.0 10.0 0.0 78.0
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
31 1.8 35.1 36.9 100.0 136.9 6.8 11.0 17.8 119.1 80.0 0.0 0.0
32 12.0 117.0 129.0 39.1 168.1 8.4 13.4 21.9 146.2 27.0 0.0 19.2
33 19.8 62.4 82.2 100.0 182.2 9.1 14.6 23.7 158.5 1.0 0.0 57.5
34 11.1 37.7 48.8 100.0 148.8 7.4 11.9 19.3 129.5 39.0 0.0 0.0
35 0.3 117.0 117.3 90.5 207.8 10.4 16.6 27.0 180.7 13.0 0.0 67.7
36 9.6 94.9 104.5 100.0 204.5 10.2 16.4 26.6 177.9 86.0 0.0 0.0
37 12.3 66.3 78.6 91.9 170.5 8.5 13.6 22.2 148.3 98.0 0.0 0.0
38 16.2 94.9 111.1 50.3 161.4 8.1 12.9 21.0 140.5 8.0 0.0 32.5
39 2.7 33.8 36.5 100.0 136.5 6.8 10.9 17.7 118.8 20.0 0.0 0.0
40 9.9 54.6 64.5 98.8 163.3 8.2 13.1 21.2 142.0 80.0 0.0 0.0
41 6.6 93.6 100.2 62.0 162.2 8.1 13.0 21.1 141.1 88.0 0.0 0.0
42 14.7 70.2 84.9 53.1 138.0 6.9 11.0 17.9 120.1 25.0 0.0 0.0
43 4.2 9.1 13.3 95.1 108.4 5.4 8.7 14.1 94.3 28.0 0.0 0.0
44 18.0 22.1 40.1 66.3 106.4 5.3 8.5 13.8 92.6 28.0 0.0 0.0
45 3.3 102.7 106.0 64.6 170.6 8.5 13.6 22.2 148.4 94.0 0.0 0.0
Mon Rain Rflow Vin V[m-1] Grossv Seep Evap Tloss Vnet Dem Short Spill
46 29.4 41.6 71.0 54.4 125.4 6.3 10.0 16.3 109.1 82.0 0.0 0.0
47 20.1 35.1 55.2 27.1 82.3 4.1 6.6 10.7 71.6 34.0 0.0 0.0
48 4.2 83.2 87.4 37.6 125.0 6.2 10.0 16.2 108.7 95.0 0.0 0.0
49 8.4 39.0 47.4 13.7 61.1 3.1 4.9 7.9 53.2 32.0 0.0 0.0
50 28.5 113.1 141.6 21.2 162.8 8.1 13.0 21.2 141.6 68.0 0.0 0.0
51 6.3 0.0 6.3 73.6 79.9 4.0 6.4 10.4 69.5 18.0 0.0 0.0
52 3.6 123.5 127.1 51.5 178.6 8.9 14.3 23.2 155.4 28.0 0.0 27.4
53 25.8 107.9 133.7 100.0 233.7 11.7 18.7 30.4 203.3 65.0 0.0 38.3
54 24.9 87.1 112.0 100.0 212.0 10.6 17.0 27.6 184.4 15.0 0.0 69.4
55 14.1 127.4 141.5 100.0 241.5 12.1 19.3 31.4 210.1 96.0 0.0 14.1
56 3.6 1.3 4.9 100.0 104.9 5.2 8.4 13.6 91.3 28.0 0.0 0.0
57 7.8 126.1 133.9 63.3 197.2 9.9 15.8 25.6 171.5 40.0 0.0 31.5
58 0.3 26.0 26.3 100.0 126.3 6.3 10.1 16.4 109.9 32.0 0.0 0.0
59 28.2 29.9 58.1 77.9 136.0 6.8 10.9 17.7 118.3 44.0 0.0 0.0
60 3.6 78.0 81.6 74.3 155.9 7.8 12.5 20.3 135.6 79.0 0.0 0.0
60>
No comments:
Post a Comment