Info

This question is closed. Reopen it to edit or answer.

Error: Number of Equations Exceeds Number of Variables. What is the source of this error in my code?

1 view (last 30 days)
The following code produces the error mentioned in the subject line:
inputs
Q = { 0, 'm^3/s' }; % Q:left
P = { 0, 'Pa' }; %P:left
end
nodes
I = foundation.hydraulic.hydraulic; % I:left
O = foundation.hydraulic.hydraulic; % O:right
end
variables
q = { 0, 'm^3/s' };
p_i = { 0 , 'Pa' };
p_o = { 0 , 'Pa' };
end
function setup
through( q, I.q, O.q );
across( p_i, I.p, [] );
across( p_o, O.p, [] );
end
equations
q == Q;
p_o == P;
end
Basically I'm trying to use two inputs to control the flow and the pressure out of this block. I do not want the input pressure to be affected though, which is why I separated the across variables as shown in the setup section. I think my problem is a lack of fundamental understanding by what SimScape is looking for when it establishes the implicit relationship in the equation section. This code block was my best attempt at stitching together the ideal pressure source and ideal flow source components. If there is a simpler way to do this, that would be helpful as well.
Any ideas on the source of my error? Thanks for the help.

Answers (0)

Community Treasure Hunt

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

Start Hunting!