How can solve this error: Output 'Taout' declared with unit expression that contains an affine unit: 'degC'. Affine units are not allowed when declaring members of this type.

2 ビュー (過去 30 日間)
I am trying to model a Tablet coater thermodynamic model to account for the change in thermodynamic properties with temperature of moist air and thermal liquid (water). For this, I want to make a costumized block which will solve the balanced equation relating inlet temperature and exhaust temp. i.e., Taout = (Mai*Cpa*Tai+Xw*Mcoat*Cpw*Tcoat-Xw*Mcoat*Hlv+Xorg*Mcoat*Cporg*Tcoat-Xorg*Mcoat*Hvorg+HLF*Trt)/(Mai*Cpa+Xw*Mcoat*Cpw+Xorg*Mcoat*Cporg +HLF).
when I applied the code to an unspecified component block in simscape, above mentioned error occured. how can I solve this.
component Tablet_coater
% This is a thermodynamic model of tablet film coater
% which gives the relationship between inlet temperature and exhaust
%temperature
parameters
% Add parameters here
HLF = { 150 , 'kJ/s*K' }; % Heat Loss Factor
Trt = {298 , 'degC'}; % Ambient temperature
end
nodes
b = foundation.moist_air.moist_air; % b:left
c = foundation.thermal_liquid.thermal_liquid; %c:left
end
outputs
Taout = { 0 , 'degC'}; %exhaust temperature:right
end
variables
Tin_b = {value={273,'degC'}};
Tcoat_c = {value={273,'degC'}};
end
variables
Mai_b = { 0 , 'g/min' };
Cpa_b = { 0 , 'kJ/(kg*K)' };
Xw_c = 0;
Xorg_c = 0;
Cporg_c = { 0 , 'kJ/(kg*K)' };
Cpw_c = {0 , 'kJ/(kg*K)' };
Mcoat_c = { 0 , 'g/min' };
Hlv_c = { 0 , 'kJ/kg' };
Hvorg_c = {0 , 'kJ/s*K' };
end
branches
Mai_b : b.Mai -> *;
Cpa_b : b.Cpa -> *;
Xw_c : c.Xw -> *;
Xorg_c : c.Xorg -> *;
Cporg_c : c.Cporg -> *;
Cpw_c : c.Cpw -> *;
Mcoat_c : c.Mcoat -> *;
Hlv_c : c.Hlv -> *;
Hvorg_c : c.Hvorg -> *;
end
equations
% Add equations here
Taout == fcn(Mai,Cpa,Xw,Xorg,Cporg,Cpw,Mcoat,Tcoat,Tai,Hlv,Hvorg);
Taout == (Mai*Cpa*Tai+Xw*Mcoat*Cpw*Tcoat-Xw*Mcoat*Hlv+Xorg*Mcoat*Cporg*Tcoat-Xorg*Mcoat*Hvorg+HLF*Trt)/(Mai*Cpa+Xw*Mcoat*Cpw+Xorg*Mcoat*Cporg +HLF);
end
end

回答 (1 件)

Yifeng Tang
Yifeng Tang 2021 年 7 月 30 日
Declare temperatue units in K. That's what the error message is saying. The numerical value of the temperature may be overridden either by initial conditions you set or when the solver try to initialize. But it's still a good idea to put a value in the right range.

カテゴリ

Help Center および File ExchangeFoundation and Custom Domains についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by