我在 Simulink 中有一个“热质量”块,它代表热质量,即一种材料或材料组合存储内部能量的能力。在 Simulink 的这个标准模块中,必须输入初始温度。只有一个信号可以连接到模块。该块的源代码如下所示:
component mass
% Thermal Mass
% The block represents a thermal mass, which is the ability of a material
% or combination of materials to store internal energy. The property is
% characterized by mass of the material and its specific heat.
%
% The block has one thermal conserving port.
% The block positive direction is from its port towards the block. This
% means that the heat flow is positive if it flows into the block.
% Copyright 2005-2013 The MathWorks, Inc.
nodes
M = foundation.thermal.thermal; % :top
end
parameters
mass = { 1, 'kg' }; % Mass
sp_heat = { 447, 'J/(kg*K)' }; % Specific heat
end
variables
Q = { 0, 'J/s' }; % Heat flow
end
variables(Conversion=absolute)
T = { 300, 'K' }; % Temperature
end
function setup
% Parameter range checking
if mass <= 0
pm_error('simscape:GreaterThanZero','Mass')
end
if sp_heat <= 0
pm_error('simscape:GreaterThanZero','Specific heat')
end
end
branches
Q : M.Q -> *;
end
equations
T == M.T;
Q == mass * sp_heat * T.der;
assert(T>0, 'Temperature must be greater than absolute zero')
end
end
我想构建另一个组件,其初始温度可以来自另一个块,以便它也可以在其他地方计算。因此,一个输入参数和其他所有参数都应该相同。我是 Simulink 新手,对域了解不多。任何想法,如何做到这一点?
谢谢!