Simscape custom component compiler having trouble solving a simple two thermal resistor equation

1 次查看(过去 30 天)
I'm trying to write a custom thermal component, the basis of which is formed by two thermally conductive elements. The component compiles but I get this error when I try and run it.
Number of equations exceeds number of variables. Click on any Simscape blocks identified below for more detailed diagnostics.
component thermalresistivenet3
%thermalresistivenet3
% Move heat with electrical work.
% More comments not shown in the interest of space
nodes %conserving ports
Th = foundation.thermal.thermal; % H:top
Tc = foundation.thermal.thermal; % C:bottom
end
nodes(Access=private)
Tm = foundation.thermal.thermal;
end
parameters
Tini = {273, 'K'}; % Initial Temperature
Km = {20, 'W/K'}; % Thermal conduction
end
variables(Access=private)
qS1 = { 0, 'J/s' };% heat flux
qS2 = { 0, 'J/s' };% heat flux
end
function setup
qS1 = {value={0,'J/s'},priority=priority.low};
qS2 = {value={0,'J/s'},priority=priority.low};
%Set all thermal nodes to the same initial temperature
Th.T = {value=Tini,priority=priority.high};
Tc.T = {value=Tini,priority=priority.high};
Tm.T = {value=Tini,priority=priority.high};
end
% Parameter validation.
branches
qS1 : Tc.Q -> Tm.Q;
qS2 : Tm.Q -> Th.Q;
end
equations
assert(Th.T > 0)
assert(Tc.T > 0)
assert(Tm.T > 0)
%This is simply two thermal resistors connected to three thermal nodes.
qS1 == (Tc.T - Tm.T)*Km/2;
qS2 == (Tm.T - Th.T)*Km/2;
qS2 == qS1; %The heat flowing through one is the heat flowing through both
end % equations
end %component
In my mind this is a very simple thermal system. I want to write much more complicated thermal systems such as peltier devices. How do I model this system correctly?
Edit, if I remove the heat flow from the equation and set the equations equal to each other, I also run into a problem:
(Tc.T - Tm.T)*Km/2 == (Tm.T - Th.T)*Km/2;
Number of variables exceeds number of equations. Click on any Simscape blocks identified below for more detailed diagnostics. ThermalStackPeltierDebugsinglev2/thermalresistivenet3

采纳的回答

Steven
Steven 2018-3-13
The answer is simscape custom elements have terrible support and I found the answer on my own.
The answer is you don't write the heat flow part of the equations, this is taken care of by the branches. So the branches are an extension of the equations.
You only need these equations: qS1 == (Tc.T - Tm.T)*Km/2; qS2 == (Tm.T - Th.T)*Km/2;
The branches take care of the qS2 == qS1;

更多回答(0 个)

类别

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