##Ex9.3.5.1.;Calculate Energy generated
import math
R=12.;##unit=m; R is the range
r=3.;##unit=m; the head below turbine stops operating
time=(44700./2.);
A=30*10**6;
g=9.80;
p=1025.;
##The total theoretical work W=integrate('1','w',R,r);
W=(g*p*A*((R**2)-(r**2)))/2.;
print'%s %.2f %s'%(" W=",W," ");
##The average power generated
Pav=W/time;##unit=watts
print'%s %.2f %s'%("\n The average power generated=",Pav," watts");
pav=(Pav/1000.)*3600.;##unit=kWh
print'%s %.2f %s'%("\n The average power generated=",pav," kWh")
##the energy generated
Energy_generated=pav*0.73
print'%s %.2f %s'%("\n Energy generated=",Energy_generated," kWh");
##Ex9.3.6.1;calculate power in h.p. at any instant and the yearly power output
import math
A=0.5*10**6;##unit=m
h0=8.5;##unit=m
t=3*3600.##unit=s; since t=3 hr
p=1025.;##unit=kg/m^3
h=8.;##unit=m
n0=0.70;##efficiency of the generator;70%
##volume of the basin=Ah0
volume_of_the_basin=A*h0;
##Average discharge Q=volume/time period
Q=(A*h0)/t;
print'%s %.2f %s %.2f %s '%(" volume of the basin=",volume_of_the_basin," m^3"and " \n Average discharge Q=",Q," m^3 /s")
##power at any instant
P=((Q*p*h)/75)*n0;
print'%s %.2f %s'%("\n power at any instant P=",P," h.p.");
##The total energy in kWh/tidal cycle
E=P*0.736*3;
print'%s %.2f %s'%("\n The total energy in kWh/tidal cycle E=",E,"");
##Total number of tidal cycle in a year=705
print("\n Total number of tidal cycle in a year=705");
##Therefore Total output per annum
Total_output_per_annum=E*705;
print'%s %.2f %s'%("\n Total output per annum= ",Total_output_per_annum,"kWh/year");
##The value of "power of instant" in a text book is misprinted.