MATLAB Answers

Across and Through Variable determination for a basic algebraic system

1 view (last 30 days)
Omer
Omer on 14 Jun 2015
Edited: Andrew Schenk on 5 Mar 2016
I've been trying to model a system of algebraic equations in Simscape (no physical system, just to understand the basics of across and through variables). The system consist of two basic algebraic equations: x+y=1 and x-11y=5. So i created a domain and 2 components codes shown below:
I defined x as across, y as through variable.
domain alg
variables
x = { 1 , '1' };
end
variables(Balancing = true)
y = { 1 , '1' };
end
end
Component One & Two:
component generic
% Component 1 & 2
nodes
A = solve_alg_v4.alg; % :left
end
parameters
a = {1,'1'};
b = {1,'1'};
c = {1,'1'};
end
variables
x = { 1 , '1' };
y = { 1 , '1' };
end
branches
y : A.y -> *;
end
equations
x == A.x - B.x;
a*x + b*y == c;
end
end
When i build this, no problem is encountered and components are shown in the customised library. However when I connect two components and run the simulation it gives 'Steady state solve failed to converge' error.
The system looks like:
By the way i modelled the system by defining all variables as across (and each component has one node) it perfectly works and find solution to the system. However, still no good with through variable.
How would you solve this system with through and across variables?

  0 Comments

Sign in to comment.

Answers (1)

Andrew Schenk
Andrew Schenk on 15 Jun 2015
Edited: Andrew Schenk on 5 Mar 2016
In your diagram and generic component equations section above two ports, A and B, are used but the nodes section only defines A.
When you define a variable as a through variable, extra equations are automatically added to the system such that for each Through variable, the sum of all its values flowing into a branch point equals the sum of all its values flowing out. This extra equation over constrains the system and hence the error.
In contrast, for an across variable, two directly connected conserving ports must have the same values for all their Across variables.
The following documentation gives a good overview of the modeling principals used in Simscape modeling: http://www.mathworks.com/help/physmod/simscape/ug/basic-principles-of-modeling-physical-networks.html
To model a simple algebraic system, you should not be using Simscape domains. Instead, refer to the following example: http://www.mathworks.com/help/physmod/simscape/lang/simple-algebraic-system.html

  1 Comment

Yogesh Badhe
Yogesh Badhe on 11 Sep 2015
Currently I am using Simscape for modeling translational motion, so I am using mechanical translational domain, in domain file force is through variable, by definition it means " their values have balance at a node, sum of all its values flowing into a branch point equals sum of all its values flowing out." As I am engineering grad, till now we have only come across mass conservation or energy conservation, where something really goes in and comes out, but here force is vector, what do you mean by force going in and coming out? Till now I have only learned that force is balanced on desired system taking into account final acceleration of system, Can you please elaborate this Simscape terminology. Please give me some insights. Thank you in advance.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by