How to change the initial condition of a customized block on Simscape?
조회 수: 5 (최근 30일)
이전 댓글 표시
Dear all,
The default "Thermal Mass" block on SIMSCAPE presents Mass and Specific Heat as parameters. Since I would like The Specific Heat changes with the temperature (i.e., it changes each substep) I had created a custom block on SIMSCAPE called "OnlyMass" according to the code below. I'd built it using "ssc_build OnlyMass" and then I had solved my problem.
However, now I would like to assume a different initial temperature for such mass. However, when I try to do it an error occurs according to the image below.
Then, all bodies I have using such custom block starts with the same temperature :/.
How to fix this problem?
component OnlyMass
% Thermal Mass
% This block models internal energy storage in a thermal network. The rate
% of temperature increase is proportional to the heat flow rate into the
% material and inversely proportioanl to the mass and specific heat of the
% material.
% Copyright 2005-2016 The MathWorks, Inc.
nodes
M = foundation.thermal.thermal; % M:top
end
inputs
sp_heat = {447, 'J/(kg*K)'}; % c:bottom
end
parameters
mass = {1, 'kg' }; % Mass
end
variables
% Differential variables
T = {value = {295.15, 'K'}, priority = priority.high}; % Temperature
Q = {0, 'W'}; % Heat flow rate
end
branches
Q : M.Q -> *;
end
equations
assert(mass > 0)
assert(sp_heat > 0)
T == M.T;
Q == mass * sp_heat * T.der;
assert(T > 0, 'Temperature must be greater than absolute zero')
end
end
댓글 수: 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!