You are on page 1of 5

%calculates Resistance, power and equilibrum angle of ship

%original file name: calculateResistance.m


%
%required: Vs - ship speed opt.: lcg (longtitudal center of gravity, beta
%(beam rise)
%
%returns: Resistance at speed, required power at that speed, equilibrum
%trim angle
%
%Example: calculateResistance(10,1.96,14)
%calculates Resistance at 10m/s, lcg=1.96m from transom, 14 deg chine rise
%
%Note: Tuned to the Stromboot, other ships may need other default
%parameters!
%Also the appendage resistances
%
%Author: Simon Egli (smn.egli At gmail Dot Com), 14.04.2012, www.hsr.ch
%Feel free to use this script, a shoutout would be great
%Copyright: CC-BY
function[resistance, power, tau0] = calculateResistance(Vs, lcg, beta)
global pmes; %pmes is a structure with all the needed information
ignoreBoundaries=0;
%Parameter von unserem Boot
m=pmes.mes.m; %Boot+3Mann mit Ausrstung [kg]
%lcg=1.966; %von hinterstem Tei aus [m]
vcg=pmes.vehicle.vcg; %von unterstem Teil aus [m]
b=pmes.vehicle.beam; %beam [m]
epsilon=pmes.vehicle.shaft_angle; %schaft winkel [deg]
%beta=14; %chine rise [deg]
f=vcg; %perpendicular distance of shaftline to centre of gravity (nach Bild ist
das bei uns gerade gleich vcg, da aus Mitte rauskommt)
%Vs=30;
theta=pmes.vehicle.theta; %Angle between the keel (centerline) and the outer edg
e of spray area measured in plan of bottom
g=9.81; %Gravity-constant [m/s^2]
rho=1000; %Dichte von Wasser [kg/m^3]
rhoair= 1.2041; %Dichte Luft, Meereshhe (20C)
Aair=pmes.vehicle.airArea;
Askeg=pmes.vehicle.skeg_area;
Arudder=pmes.vehicle.rudder_area;
Lshaft=pmes.vehicle.shaft_length;
Dshaft=pmes.vehicle.shaft_diameter;
L=pmes.vehicle.norm_diameters(1);
if(nargin==1)
lcg=pmes.vehicle.lcg;
beta=pmes.vehicle.beta;
end
if ignoreBoundaries==0
if beta>30||beta<10 %schauen ob Grenzen eingehalten
resistance=0;
power=0;
tau0=0;
return
end
end
%calculate Resistance
Dfs=[[]];
Mbh=[[]];
Rbh=[];
Mdf=[];
EPbh=[];
Vstep=0.2;
taumin=2;
j=0;
for tau=taumin:5 %tau: 2<=tau<=24
% if i>2
% tau=taux(i);
% end
%volumetric Froude:
%Fn=Vs/(g*m^(1/3))^0.5;
%normal Froude:
Fn=Vs/sqrt(g*L);
if ignoreBoundaries==0
if Fn>1.5||tau<2||tau>24 %schauen ob Grenzen eingehalten
resistance=0;
power=0;
tau0=0;
return
end
end
Cv=Vs/sqrt(g*b); %1
if ignoreBoundaries==0
if Cv>25||Cv<0.6 %schauen ob Grenzen eingehalten
resistance=0;
power=0;
tau0=0;
return
end
end
%if Cv<25&&Cv>0.6
%step 2:
Clbeta=(m*g)/(0.5*rho*Vs^2*b^2); %2

%step 3:
%Clbeta=Cl0-0.0065*beta*Cl0^0.6; %4
syms Cl0
Cl0=solve(Cl0-0.0065*beta*Cl0^(0.6)-Clbeta);
Cl0=double(Cl0(1));
%lambda=(d/sind(tau)-b/(2*pi)*tand(beta)/tand(tau))/b;

%step 4, solve for lambda:


syms lambda
lambda=solve(tau^1.1*(0.012*lambda^0.5+0.0055*lambda^(5/2)/Cv^2)-Cl0
,lambda); %3
lambda=double(lambda(1)); %wenn mehrere Lsungen, erste nehmen
if ignoreBoundaries==0
if lambda>4||lambda<1 %schauen ob Grenzen eingehalten
resistance=0;
power=0;
tau0=0;
return
end
end
%if lambda<4 && lambda>1
%step 5:
Lm=lambda*b;
%step 6: average bottom velocity
Vm=(1-(0.012*lambda^0.5*tau^1.1-0.0065*beta*(0.012*lambda^0.5*ta
u^1.1)^0.6)/(lambda*cosd(tau)))^0.5*Vs; %11
%step 7:
Rn=Vm*b*lambda/1E-6; %10 %viscosity evtl. noch anpassen!

%step8:
Cf=0.075/(log10(Rn)-2)^2; %log10!
%step9:
Ca=0.0004;
%step10:
corrlambda=0.5*(tand(beta)/(pi*tand(tau))-1/(2*tand(theta)))*cos
d(theta);
%syms corrlambda;
%corrlambda=solve((Lm/b * b *b/cosd(beta))/(b^2/cosd(beta))-(lam
bda+corrlambda),corrlambda);
corrlambda=double(corrlambda(1));
%step11:
Df=rho/2*b^2*Vs^2/cosd(beta)*(Cf+Ca)*((Vm/Vs)^2*lambda+corrlambd
a); %8
Dair=0.5*rhoair*Vs^2*Aair*0.7;% Luftwiderstand, C=0.7 (acc. incl
usion of whisker spray prediction)
%appendage Resistances...
%skeg Widerstand
Dk=rho/2*2*Askeg*Vm^2*Cf*4; %Berechnung siehe Arbeitsheft, 10.4.
2012
%shaft Widerstand
Dsh=rho/2*Lshaft*Dshaft*Vs^2*(1.1*sind(epsilon)^3+pi*Cf); %Berec
hnung siehe Arbeitsheft, 10.4.2012
%Rudder Widerstand
Dr=rho/2*Arudder*Vs^2*0.0015; %Berechnung siehe Arbeitsheft, 10.
4.2012
% Df=rho/2*b^2*Vm^2/cosd(beta)*(Cf+Ca)*(lambda+corrlambda); % lau
t savitsky.xls
%Df=Cf*0.5*rho*Vs^2*(lambda+corrlambda)*b^2/cosd(beta); %aus pri
ncipals of yacht design
Dfs(tau)=Df+Dk+Dsh+Dr+Dair; %total Drag = boat drag + app. drag
%calculate total resistance
%R=(g*m*sind(tau)+Df)*cosd(tau+epsilon)/cosd(epsilon);
%step12:
a=(vcg-(b/4)*tand(beta));

%step13:
Cp=0.75-1/(5.21*Cv^2/lambda^2+2.39);%5
%step14:
Lcp=Cp*lambda*b;
%step15:
c=lcg-Lcp;
%step16:
Md=m*g*(c*cosd(tau+epsilon)/cosd(epsilon)-f*sind(tau)/cosd(epsil
on));
%step17:
Mdf=Df*(a-c*tand(epsilon)-f/cosd(epsilon));
%step18:
Mbh(tau)=Md+Mdf; %calculate total moment
%Mbh(i,tau)
end
%calculate equilibrum angle and total Rbh
tau1=taumin;
tau2=taumin+1;
if tau>taumin+1
%if Vs>(Vsmin+Vstep) %erst ab zweitem Wert
%step19:
tau0=tau1-(Mbh(tau1)*(tau2-tau1)/(Mbh(tau2)-Mbh(tau1)));
%taux=tau0;
%step20:
Df0=Dfs(tau1)+(Dfs(tau2)-Dfs(tau1))/(tau2-tau1)*(tau0-ta
u1);
%step21:
Rbh(1)=cosd(tau0+epsilon)/cosd(epsilon)*(g*m*sind(tau0)+
Df0);
%in principles of yacht design eher so, aber ergibt
%komische Kurve
%Rbh(i,1)=cosd(tau0+epsilon)/cosd(epsilon)*(g*m*sind(tau
0)+Dfs(tau,i))
%Rbh(2)=Vs;

%step22:
EPbh=(Rbh*Vs); %effective power in Watts
%end
end
resistance=Rbh;
power=EPbh;
end

You might also like