import math
#calculate Hydraulic Efficiency and Overall Efficiency and Outlet angles of the guide vanes and Rotor blade angle at inlet and oulet
## Maximum hydraulic efficiency occurs for minimum pressure loss, that is, when
## dp1/dQ=2.38Q-1.43=0
Q_opt=1.43/2.38;
p1_min=1.19*Q_opt**2-1.43*Q_opt+0.47; ## MPa
rho=1000.; ## kg/m**3
g=9.81; ## m/s**2
w=69.1; ## rad/s
P=200.*10.**3.; ## W
Ohm_P=0.565; ## rad
d=0.5; ## m
h=0.06; ## m
p1=p1_min*10.**6./(rho*g); ## mH2O, coversion of units
H=(w*P**(1/2.)/(rho**(1/2.)*Ohm_P))**(4/5.)/g;
Hydraulic_efficiency=(H-p1)/H;
print'%s %.3f %s'%("Hydraulic Efficiency =",Hydraulic_efficiency,"")
Overall_efficiency=P/(Q_opt*rho*g*H);
print'%s %.3f %s'%("Overall Efficiency =",Overall_efficiency,"")
H_Euler=H-p1;
u1=w*0.25;
v_w1=g*H_Euler/u1;
A=math.pi*d*h*0.95;
v_r=Q_opt/A;
alpha1=math.atan(v_r/v_w1);
print'%s %.3f %s'%("Outlet angles of the guide vanes =",alpha1,"degrees")
beta1=math.atan(v_r/(v_w1-u1));
print'%s %.2f %s'%("Rotor blade angle at inlet =",beta1,"degrees")
u2=w*0.325/2;
beta2=math.atan(v_r/u2);
print'%s %.3f %s'%("Rotor blade angle at outlet =",beta2,"degrees")
import math
#calculate Overall efficiency and Limiting value for the height of the draft tube above
w=6.25;
D=0.75; ## m
gv_angle=15; ## guide vane angle in degrees
g=9.81; ## m/s^2
H=27.5; ## m
A1=0.2; ## m^2
rho=1000.; ## kg/m^3
p_atm=101.3*10**3.;
p_min=35.*10.**3.;
u1=math.pi*w*D;
v1=u1*math.sin(105.)/math.sin(60.);
v_r1=v1*math.sin(gv_angle);
v_w1=v1*math.cos(gv_angle);
v_w2=0.;
n_hydraulic=u1*v_w1/g/H;
n_overall=0.97*n_hydraulic;
print'%s %.1f %s'%("Overall efficiency =",n_overall,"")
Q=A1*v_r1;
P=n_overall*Q*rho*g*H;
Ohm_P=w*2.*math.pi/(g*H)**(5/4)*(P/rho)**(1/2);
## sigma > 0.119*(0.5)^(1.84) = 0.0331
sigma=0.0331;
##((p_atm-p_min)/(rho*g)-z0)/H > 0.0331
z0=((p_atm-p_min)/(rho*g))-sigma*H;
print'%s %.2f %s'%("Limiting value for the height of the draft tube above =",z0,"m")