Code covered by the BSD License

Marine Automatics

Mateusz Blonski (view profile)

28 Oct 2010 (Updated )

Simulation models of marine automatics elements library for MATLAB/Simulink

Demo5cs1.m
```% Script for solving parameters of jacket water cooler for Demo no. 5
% (C) Copyright by Mateusz Blonski, Szczecin 2010

clear;
clc;

% Define variables
syms Tw TA2 n;

% Define constant parameters (check out help file of block Plate heat
TA1=36;
fA=0.1;
TB1=80;
fB=0.08;
TB2=63.3194;
A=2;
d=0.01;
z=0.002;
roA=1000;
cA=4186;
hA=10000;
row=4506;
cw=523;
roB=1000;
cB=4186;
hB=8000;
VA=A*d*(n-1)/2;
Vw=A*z*(n-2);
VB=A*d*(n-1)/2;
AA=A*(n+1)/2;
AB=A*(n+1)/2;
TA=(TA1+TA2)/2;
TB=(TB1+TB2)/2;

% Set the system of state equations for heat exchanger at steady state
eq1=fA*(TA1-TA2)/VA+(hA*AA/roA/cA/VA)*(Tw-TA);
eq2=(hB*AB/row/cw/Vw)*(TB-Tw)-(hA*AA/row/cw/Vw)*(Tw-TA);
eq3=fB*(TB1-TB2)/VB-(hB*AB/roB/cB/VB)*(TB-Tw);

% Solve the system with Tw, TA2 and n as variables
solv=solve(eq1,eq2,eq3,Tw,TA2,n);
Tw=double(solv.Tw);
TA2=double(solv.TA2);
n=double(solv.n);
display(Tw);
display(TA2);
display(n);```