How i can write an equation in SIMSCAPE script which is dependent on the output of that component?
1 view (last 30 days)
Show older comments
For example, I want to make a mutual inductor where mutual inductance M is a function of output current i1. How i can write that. Can anybody help me regarding this?
I would be really grateful for it.
Thanks Shahriar ============================================================================= For your referrence : The code is written below =============================================================================
component mutual_inductor_paper
nodes
p1 = foundation.electrical.electrical; % +:left
n1 = foundation.electrical.electrical; % -:left
p2 = foundation.electrical.electrical; % +:right
n2 = foundation.electrical.electrical; % -:right
end
parameters
L1 = { 1, 'H' }; % Toroidal inductance
L2 = { 2, 'H' }; % Poloidal inductance
pip = { 1, 'W' };
tim = { 1, 's' };
i10 = { 0, 'A' }; % Winding 1 initial current
i20 = { 0, 'A' }; % Winding 2 initial current
end
variables
i1 = { 0, 'A' };
v1 = { 0, 'V' };
i2 = { 0, 'A' };
v2 = { 0, 'V' };
end
function setup
through( i1, p1.i, n1.i );
across( v1, p1.v, n1.v );
through( i2, p2.i, n2.i );
across( v2, p2.v, n2.v );
i1 = i10; % Initialize current for winding 1
i2 = i20; % Initialize current for winding 2
end
equations
let
M = pip*time/(i1*^2)
in
v1 == L1*i1.der + M*i2.der;
v2 == L2*i2.der + M*i1.der;
end
end
end
1 Comment
Ryan G
on 11 Feb 2013
Is it possible to write the equation you want to implement? Does this code work for you currently (minus the feature you are asking about)?
Answers (1)
Sabin
on 14 Dec 2024
Simulink is a signal-based or input-output and works well for control design. Physical systems are often expressed in the form of DAEs, which are composed of sets of equations that must be solved simultaneously. Therefore, we don’t think in terms of inputs and outputs anymore.
A good starting point in understanding Simscape language is the Simscape documentation:
If you’re looking for a custom implementation of an inductor (both linear and nonlinear) check this example where the Simscape source code is open:
0 Comments
See Also
Categories
Find more on Magnetic Elements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!