MATLAB Answers

Steven
0

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

Asked by Steven
on 1 Mar 2018
Latest activity Answered by Steven
on 13 Mar 2018
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Steven
on 13 Mar 2018
 Accepted Answer

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 Comments

Sign in to comment.