How to change the initial condition of a customized block on Simscape?

5 views (last 30 days)
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?
Fig01_Try1.PNG
Fig02_Error.PNG
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

Answers (0)

Categories

Find more on Creating Custom Components and Libraries in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!