Why do simscape components not use branches?
3 次查看(过去 30 天)
显示 更早的评论
If I create my own custom component, I need to use a branch
component conduction < foundation.thermal.branch
% Conductive Heat Transfer
% This block models heat transfer in a thermal network by conduction
% through a layer of material. The rate of heat transfer is governed by
% Fourier's law and is proportional to the temperature difference, material
% thermal conductivity, area normal to the heat flow direction, and
% inversely proportional to the layer thickness.
% Copyright 2005-2016 The MathWorks, Inc.
parameters
area = {1e-4, 'm^2' }; % Area
thickness = {0.1, 'm' }; % Thickness
th_cond = {401, 'W/(m*K)'}; % Thermal conductivity
end
equations
assert(area > 0)
assert(thickness > 0)
assert(th_cond > 0)
Q == T * area * th_cond / thickness;
end
This is what I think the equivalent would be in a custom component.
component customconduction
% CustomConductive Heat Transfer
nodes %conserving ports
Th = foundation.thermal.thermal; % H:top
Tc = foundation.thermal.thermal; % C:bottom
end
parameters
area = {1e-4, 'm^2' }; % Area
thickness = {0.1, 'm' }; % Thickness
th_cond = {401, 'W/(m*K)'}; % Thermal conductivity
end
variables(Access=private)
Qheat = { 0, 'J/s' };% heat flux
end
branches
Qheat : Tc.Q -> Th.Q;
end
equations
assert(area > 0)
assert(thickness > 0)
assert(th_cond > 0)
Qheat == (Tc.T - Th.T) * area * th_cond / thickness;
end
end
Why do non custom components not need to use branches? Is this correct in the way I have written this component? The simscape documentation is lacking in examples.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating Custom Components and Libraries 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!