Simscape language: AC Voltage Source - variable frequency input - Problem: Number of equations exceeds number of variables.
显示 更早的评论
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Electrical Sensors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
