Why do simscape components not use branches?

조회 수: 18 (최근 30일)
Steven
Steven 2018년 2월 28일
답변: Sabin 2026년 1월 2일 10:42
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.

답변 (1개)

Sabin
Sabin 2026년 1월 2일 10:42
The component conduction is using the base class foundation.thermal.branch (see first line):
component conduction < foundation.thermal.branch
The base class includes the branch as:
branches
Q : A.Q -> B.Q;
end

카테고리

Help CenterFile Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by