1 view (last 30 days)

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?

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

Yogesh Badhe
on 11 Sep 2015

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

Start Hunting!
## 0 Comments

Sign in to comment.