How i can write an equation in SIMSCAPE script which is dependent on the output of that component?

1 次查看(过去 30 天)
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 个)

Sabin
Sabin 2024-12-14
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:

类别

Help CenterFile Exchange 中查找有关 Magnetic Elements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by