Simscape language: AC Voltage Source - variable frequency input - Problem: Number of equations exceeds number of variables.
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Electrical Sensors dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
