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

1 vue (au cours des 30 derniers jours)
Marlon Saveri Silva
Marlon Saveri Silva le 16 Juin 2019
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

Réponses (0)

Catégories

En savoir plus sur Elements dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by