# Commensurate units error - Simscape Covective heat transfer (Pipe)

2 views (last 30 days)
Aled on 8 May 2021
Answered: Yifeng Tang on 11 May 2021
Hi all,
I'm trying to create a custom block in simulink for external convective heat transfer for a cylinder. The equation for convective heat transfer coefficient uses a couple of empirical coefficients which are just numbers and do not have units (see attached image for equation). I am getting an error in the code of 'uncomensurate units' (see attached images) i believe because these coefficients need to be physical values.
From pervious models i understand that coefficients of an equation units need to be comensurate which i have tried to do here but not sure why i am getting the error. Any advice would be apprecitated
% Convective Heat Transfer - Radial Empirical Correlation
% The block represents an energy transfer by convection between two
% bodies by means of fluid motion. The transfer is governed by the Newton
% law of cooling and is directly proportional to the convection heat
% transfer coefficient, pipe surface area and the temperature difference.
%
% Connections A and B are thermal conserving ports associated
% with the points between which the energy transport by convection takes
% place. The block positive direction is from port A to port B. This means
% that the heat flow is positive if it flows from A to B.
% Copyright 2005-2016 The MathWorks, Inc.
parameters
d = { 1e-4, 'm' }; % Outer diameter
l = { 1e-4, 'm' }; % Length
C1 = { 1e-4, 'm' }; % Shape factor coefficient
Airflow = { 1, 'm/s^3' }; % External airflow
end
parameters (Access=private)
a = { 1, 'm/s' }; % C1 - Number 1
b = { 1.277, 'm/s^2' }; % C1 - Number 2
end
variables
heat_tr_coeff = { 20, 'W/(m^2*K)' }; % Heat transfer coefficient
C2 = { 1, 'm/s' }; % Airflow coefficient 2
end
equations
assert(d>0)
assert(l>0)
assert(heat_tr_coeff>0)
C2 == sqrt(a + b * Airflow)
heat_tr_coeff == C1 *((1 / d)^0.2) * (1 / (Tavg))^0.181 * (T)^0.266 * C2
Q == heat_tr_coeff * pi * d * (T) * l;
end
end

Yifeng Tang on 11 May 2021
Hi Aled,
Consider use the syntax
value(a,'unit','type')
to use only the value of a variable with specified unit.
More details here: