How do I add a node to a simscape custom component?

3 views (last 30 days)
I am building a custom component, I would like to create an internal thermal node inside of the component, what is the best way to do this?
Right now I have to create a node on the outside of the part
Is there any way to create nodes from the library? Or do I need to create variables? I have also tried creating a node from a variable, but that also did not work
I am working from this example: https://www.mathworks.com/help/physmod/simscape/lang/defining-relationship-between-component-variables-and-nodes.html
but in this example they are using a domain. I am unsure of how to integrate a domain into a component.
Again my question is how do I create a non-visible node inside of a custom component?
nodes %conserving ports
p = foundation.electrical.electrical; % +:top
n = foundation.electrical.electrical; % -:bottom
Th = foundation.thermal.thermal; % H:top
Tc = foundation.thermal.thermal; % C:bottom
Tm = foundation.thermal.thermal; % M:bottom
end
parameters
dTmax = {63, 'K'}; % DeltaT Max constant from datasheet
Km = {0 , 'W/K'}; % Thermal conductivity
Rm = {0 , 'Ohm'}; % Resistivity
end
function setup
qE = {value={0,'J/s'},priority=priority.low};
qR = {value={0,'J/s'},priority=priority.low};
qS1 = {value={0,'J/s'},priority=priority.low};
qS2 = {value={0,'J/s'},priority=priority.low};
Th.T = {value={0,'K'},priority=priority.low};
Tc.T = {value={0,'K'},priority=priority.low};
Tm.T = {value={0,'K'},priority=priority.low};
end
% Parameter validation.
branches
i : p.i -> n.i;
qR : * -> Tm.Q; %This is for self heating, its a heat source from ground
qS1 : Tc.Q -> Tm.Q;
qS2 : Tm.Q -> Th.Q;
qE : Tc.Q -> Th.Q;
end
equations
qR == Rm * i * i;
qS1 == (Tc.T - Tm.T)*Km/2;
qS2 == (Tm.T - Th.T)*Km/2;
end

Accepted Answer

Steven
Steven on 28 Feb 2018
Edited: Steven on 28 Feb 2018
Figured it out, you do it this way
nodes(Access=private)
Tm = foundation.thermal.thermal;
end

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!