How to call the thermal liquid T-junction component in the simscape code?

8 views (last 30 days)
I am creating my own simscape block of a thermal liquid circulation system, and the component T-junction is required in my block. I have found the location of the sscp code in the library, which is "fluids.thermal_liquid.pipes_fittings.t_junction". I am trying to add this as the component using the code below. I am sure there are some additional lines to specify the details of this T-junction, but the sscp file is protected. Is this the right way to call this component, and what are the parameters needed to call this component? Thank you for the response.
components(ExternalAccess=none)
tJunc = fluids.thermal_liquid.pipes_fittings.t_junction(...
);
end

Accepted Answer

Yifeng Tang
Yifeng Tang on 13 Sep 2025
Edited: Yifeng Tang on 13 Sep 2025
Here is a method that will work with any block in the Add-On libraries. The key idea is to use the subsystem2ssc command to expose the names of the parameters and special syntax (like dropdown menu selection).
First, build a simple model and put the component you'd like to call into a subsystem. I also recommend that you change ALL parameters of the block, so none of them remains default. Save this model.
Modify and use the following code to get a .ssc file that represent the Simscape components and connections inside the subsystem:
% subsystem name
mySubsystem = 'getComponentNameExample/mySubsystem';
% delet existing .ssc files
try
delete("mySubsystem.ssc")
catch
end
% create .ssc file from subsystem
subsystem2ssc(mySubsystem)
% view the .ssc file
edit mySubsystem.ssc
This will give you "mySubsystem.ssc" file like the following:
% This component was automatically generated using 'subsystem2ssc'.
% Subsystem: getComponentNameExample/mySubsystem
component (Propagation = blocks) mySubsystem
nodes
C = foundation.thermal_liquid.thermal_liquid;
B = foundation.thermal_liquid.thermal_liquid;
A = foundation.thermal_liquid.thermal_liquid;
end
components(ExternalAccess = observe)
T_Junction_TL = fluids.thermal_liquid.pipes_fittings.t_junction(Re_0 = 15, Re_c = 120, area_branch = {.001, 'm^2'}, area_main = {.001, 'm^2'}, junction_spec = int32(1), tau = {.001, 's'});
end
connections
connect(A,T_Junction_TL.A);
connect(B,T_Junction_TL.B);
connect(C,T_Junction_TL.C);
end
end
You should be able to see the names of all the parameters you've modified.
Another way to see the name of the parameter is to move your mouse cursor close to the name in the parameter dialog box. Wait a second and some context info will show up, including the name of the parameter inside the ssc code. See the "area_branch" parameter in the picture below. It's the same name you can use to query the value using the get_param and set_param commands.
Hope this helps. Have fun!

More Answers (0)

Categories

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

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!