www.pudn.com > SHIPCONTROL.rar > mariner.m, change:2015-12-08,size:2408b


function xdot=mariner(x,ui) 
%M.S.Chislett and J, Stroem-Tejsen(1965) 
 
if ~(length(x)==7),error('x-vector must have dimension 7!'); end 
if ~(length(ui)==1),error('u-vector must have dimension 1!'); end 
 
 
%Normalization variables 
U0=7.72; 
U=sqrt((U0+x(1)^2)+x(2)^2); 
L=160.93; 
%cruise speed UO =- 7.72m/s 15 knots 
%total speed Uin m/s 
%length of Ship in ID 
 
%Non-dimensional states and inputs 
delta_c=ui(1); 
u=x(1)/U; v=x(2)/U; delta=x(7); 
r=x(3)*L/U; psi=x(4); 
 
  
  
 
%Parameters,hydrodynamic derivatives and maindimensions 
 
delta_max=10; 
Ddelta_max=5; 
 
m=798e-5; Iz=39.2e-5; xG=-0.023; 
 
 
Xudot= -840e-5; Yvdot= -1546e-5; Nvdot=23e-5; 
Xu= -184e-5; Yrdot=9e-5; Nrdot=-83e-5; 
Xuu= -110e-5; Yv= -1160e-5; Nv= -264e-5; 
Xuuu= -215e-5; Yr= -499e-5; Nr=-166e-5; 
Xvv=-899e-5; Yvvv=-8078e-5;Nvvv=1636e-5; 
Xrr=18e-5; Yvvr=15356e-5; Nvvr=-5483e-5; 
Xdd=-95e-5; Yvu =-1160e-5; Nvu=-264e-5; 
Xudd=-190e-5; Yru=-499e-5; Nru=-166e-5; 
Xrv=798e-5; Yd =278e-5; Nd=-139e-5; 
Xvd=93e-5; Yddd = -90e-5; Nddd = 45e-5; 
Xuvd=93e-5; Yud=556e-5; Nud=-278e-5; 
Yuud=278e-5; Nuud=-139e-5; 
Yvdd=-4e-5;  Nvdd=13e-5; 
Yvvd=1190e-5; Nvvd=-489e-5; 
Y0=-4e-5; N0=3e-5; 
Y0u=-8e-5; N0u=6e-5; 
Y0uu=-4e-5; N0uu=3e-5; 
 
 
 
%Masses and moments of inertia 
m11=m-Xudot; m23= m*xG-Yrdot; m33=Iz-Nrdot; 
m22=m-Yvdot; m32=m*xG-Nvdot; 
 
% Rudder saturation and dynamics 
if abs(delta_c) >= delta_max*pi/180; 
delta_c=sign(delta_c)*delta_max*pi/180;  
end 
 
% delta_c=(delta_max*pi/180)*tanh(dj/(delta_max*pi/180)); 
 
delta_dot=(delta_c- delta); 
 
 
%  
% delta=delta_c-(delta_c-delta)*exp(-1/4); 
if abs(delta_dot)>= Ddelta_max*pi/180 
delta_dot=sign(delta_dot)*Ddelta_max*pi/180;  
end 
 
%Forces and moments 
X=Xu*u+Xuu*u^2 + Xuuu*u^3+ Xvv*v^2+ Xrr*r^2+ Xrv*r*v+ Xdd*delta^2+... 
  Xudd*u*delta^2+ Xvd*v*delta+ Xuvd*u*v*delta; 
 
Y=Yv*v+ Yr*r+Yvvv*v^3+ Yvvr*v^2*r+ Yvu*v*u+ Yru*r*u+ Yd*delta+... 
  Yddd*delta^3+Yud*u*delta+ Yuud*u^2*delta+Yvdd*v*delta^2+... 
  Yvvd*v^2*delta+ (Y0+Y0u*u+Y0uu*u^2); 
N=Nv*v+ Nr*r+Nvvv*v^3+ Nvvr*v^2*r+ Nvu*v*u+ Nru*r*u+ Nd*delta+... 
Nddd*delta^3+ Nud*u*delta+ Nuud*u^2*delta+ Nvdd*v*delta^2+ ... 
Nvvd*v^2*delta+ (N0 +N0u*u+N0uu*u^2); 
%Dimensional state derivative 
xdot= [ X*(U^2/L)/m11 
-(-m33*Y+m23*N)/(m22*m33-m23*m32)*U^2/L 
 (-m32*Y+m22*N)/(m22*m33-m23*m32)*U^2/L^2 
  r*U/L 
(cos(psi)*(U0/U+u)-sin(psi)*v)*U 
(sin(psi)*(U0/U+u)+cos(psi)*v)*U 
     delta_dot     ];