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

1 view (last 30 days)
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

Accepted Answer

Steven
Steven on 13 Mar 2018
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;

More Answers (0)

Categories

Find more on Foundation and Custom Domains in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!