- You needed the current to also be a variable, along with its corresponding branches section defining the polarity of the current.
- You did not need need to define omega as a variable and create a separate equation for it.
Simscape language: AC Voltage Source - variable frequency input - Problem: Number of equations exceeds number of variables.
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
alty
am 28 Mär. 2016
Bearbeitet: Ali Degan
am 19 Mär. 2017
Hello everyone,
I try to write a file which will produce an AC Voltage Source in Simscape using the Simscape language. My goal is to vary the frequency by using an external signal.
This is my code:
component AC_frequ
%AC_frequ
%
%AC Voltage source - variable frequencies
%
nodes
v_p = foundation.electrical.electrical; %+ :top
v_n = foundation.electrical.electrical; %- :bottom
end
variables
v = { 0, 'V' }; % Voltage
omega = { 0, 'rad/s' }; % angular velocity
end
inputs
f = { 0, 'Hz' } %Frequenz :bottom
end
parameters
amp = { 1, 'V' }; % Peak amplitude
shift = { 0, 'deg' }; % Phase shift
end
equations
v == v_p.v - v_n.v;
v == amp*sin(omega*time + shift);
omega == {2*pi,'rad'}*f;
end
end
When I use the file in my simulation, it tells me the following: "Number of equations exceeds number of variables."
Can anyone spot my mistake?
0 Kommentare
Akzeptierte Antwort
Sebastian Castro
am 29 Mär. 2016
Bearbeitet: Sebastian Castro
am 29 Mär. 2016
As the error message suggested, you have 3 equations but 2 variables. Two issues:
This component file worked perfectly for me:
component AC_frequ
nodes
p = foundation.electrical.electrical; % +:top
n = foundation.electrical.electrical; % -:bottom
end
variables
i = { 0, 'A' }; % Current
v = { 0, 'V' }; % Voltage
end
parameters
amp = { 1, 'V' }; % Peak amplitude
shift = { 0, 'deg' }; % Phase shift
end
inputs
frequency = { 60, 'Hz' }; % f: bottom
end
branches
i : p.i -> n.i;
end
equations
v == p.v - n.v;
v == amp*sin(frequency*time + shift);
end
end
- Sebastian
3 Kommentare
Sebastian Castro
am 30 Mär. 2016
No problem!
Omega could be a variable, but it would introduce an extra set of equations into the system that you don't exactly need.
Variables are mostly necessary if you want to keep track of, log, initialize, or measure time-varying dynamic variables. If it's just some internal counter like in this case (frequency*time), a variable isn't necessary.
- Sebastian
Ali Degan
am 19 Mär. 2017
Bearbeitet: Ali Degan
am 19 Mär. 2017

I tried to mimic what you have written but I got an error. Can you please help me to resolve this error?
"The following block(s) do not have resolved block library links: 'acfre/AC_frequ' Physical Modeling blocks cannot have broken or inactive library links. Please restore library links for all Physical Modeling blocks."
Also, Can I make my own model in simscape technology instead of simscape component?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Electrical Sensors finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!