Code covered by the BSD License  

Highlights from
Marine Automatics

image thumbnail

Marine Automatics

by

 

28 Oct 2010 (Updated )

Simulation models of marine automatics elements library for MATLAB/Simulink

Demo2c2.m
% Control system parameters calculation for system Demo no. 2
% (C) Copyright by Mateusz Blonski, Szczecin 2010

% Get parameters of the motor
paramm=str2double(get_param('Demo2/DC Motor with magnet1','MaskValues'));
skm=paramm(1);
sku=paramm(2);
sR=paramm(3);
sL=paramm(4);
sJ=paramm(5);
sb=paramm(6);

% Get parameters of the displacement transducer
paramd=str2double(get_param('Demo2/Displacement transducer1','MaskValues'));
skdt=paramd(4)/paramd(3);

% Calculate kp and kd coefficient
skp=-((sL*sb + sJ*sR)*(sJ*sL*sR^2*sb^2 - sL*sb*(sJ*sL*(sR*sb + skm*sku)^3)^(1/2) - sJ*sR*(sJ*sL*(sR*sb + skm*sku)^3)^(1/2) + sJ*sL*skm^2*sku^2 + 2*sJ*sL*sR*sb*skm*sku))/(sJ*sL*skdt*skm*(sJ^2*sR^2 + sJ*sL*sR*sb - skm*sku*sJ*sL + sL^2*sb^2));
skd=-(sJ^2*sR^3*sb - (skdt*skm*skp*(sL*sb + sJ*sR)^5)^(1/2) + sL^2*sR*sb^3 + 2*sJ*sL*sR^2*sb^2 + sJ^2*sR^2*skm*sku + sL^2*sb^2*skm*sku + 2*sJ*sL*sR*sb*skm*sku - sJ^2*sL*sR*skdt*skm*skp - sJ*sL^2*sb*skdt*skm*skp)/(skm*skp*(sL*sb + sJ*sR)^2);

% Show message box
msgbox(['Calculated parameters are: P controller gain coefficient: kp=' num2str(skp) '; Rate generator gain coefficient: kd=' num2str(skd) ' V*s/rad'],'Demo no. 2','help');

Contact us