Simscape language: AC Voltage Source - variable frequency input - Problem: Number of equations exceeds number of variables.
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Electrical Sensors 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!