Allow user to select the Number of Through and Across Nodes in Custom Simulink File

Hello Matlab Community,
I need help. I am trying to create a custom orifice simulink block that manages a varying number of orifice holes. Therefore in theory, a user of the block would be able to type in how many orifice holes are present.
The way I am trying to make this work is by allowing the user to set the number of through and across variables in the node setup. For example:
nodes
A1 = foundation.hydraulic.hydraulic; % A:left
A2 = foundation.hydraulic.hydraulic; % A:left
B1 = foundation.hydraulic.hydraulic; % B:right
B2 = foundation.hydraulic.hydraulic; % B:right
end
function setup
% Calculate individual flow rates
through( q, A1.q, B1.q );
across( p, A1.p, B1.p );
through( q, A2.q, B2.q );
across( p, A2.p, B2.p );
end
I would imagine this would work for 2 orifice holes, but what I really want is the user to be able to list any number of orifice holes, perhaps even 50. I tried doing this with a while loop in the nodes block, but i dont think I can use a while loop when writing simulink files because it keeps failing at the while loop. Please help! Thanks!

Answers (0)

This question is closed.

Asked:

on 24 Nov 2011

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!