%% Exercise 2

% Francis Turbine
clear all; close all; clc
rho=998 % Water density  [kg/m^3]
g=9.81  % Gravity        [m/s^2]
% Speed triangles

%
% The flow rate through a small Francis turbine is 4.5 m^3/s head is 150m and the rotational speed is 450rpm. The in let radius is r2 =0.6 m and the water leaves the guide vanes at the angle alpha2 = 72◦ and velocity V2 = 53.3 m/s. It leaves the turbine without swirl.

Q=4.5       % Discharge                 [m^3/s]
H=150       % Head                      [m]
n=450       % Rotational speed          [rpm]
r1=0.6      % Radius at the inlet       [m]
alpha1=18   % Angle between C1 and U1   [°]
C1=53.3     % Inlet speed               [m/s]

%% Questions
% Find the inlet angle of the relative velocity, beta1 between U1 and W1.
% What is the output power?
% What is the torque on the shaft?
%
%% Solution
%% 1. Find the inlet angle of the relative velocity, beta1 between U1 and W1.

% Calculate the rotational speed
omega=2*pi*n/60        %[rad/sec]
% Calculate U
U=r1*omega
spplot([U 0],[C1 -alpha1])
legend('','','','','U','C')
% Projecting C1 over U and M
Cu1=C1*cos(alpha1*pi/180)
Cm1=C1*sin(alpha1*pi/180)

Wu1=Cu1-U
Wm1=Cm1
[W1angle W1]=cart2pol(Wu1,Wm1)
beta1=W1angle/pi*180
spplot([U 0],[C1 -alpha1],[Cu1 0],[Cm1 -90],[W1 -W1angle/pi*180])
legend('','','','','U','C','Cu','Cm','W')

%
%% 2. What is the output power?
% From eulero: w=UCu1-UCu2; we are in BEP

w=U*Cu1
W=rho*Q*w/1000
eta=w/(g*H)

%
%% 3. What is the torque on the shaft?

T=W/omega       %[N/m]