VoltageSource

model VoltageSource "Constant AC voltage"
    extends Interfaces.Source;

    parameter Modelica.SIunits.Frequency f(start = 1) "Frequency of the source";
    parameter Modelica.SIunits.Voltage V(start = 1) "RMS voltage of the source";
    parameter Modelica.SIunits.Angle phi(start = 0) "Phase shift of the source";
equation
    v = Complex(V * cos(phi), V * sin(phi));
    omega = 2 * Modelica.Constants.pi * f;

    annotation (
        Icon(graphics = {
            Line(
                points = {
                    {-50, 0}, 
                    {50, 0}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {-70, 30}, 
                    {-70, 10}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {-80, 20}, 
                    {-60, 20}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {60, 20}, 
                    {80, 20}},
                color = {85, 170, 255})}),
        Documentation(info = "<html>\n\n<p>\nThis is a constant voltage source, specifying the complex voltage by the RMS voltage and the phase shift.\n</p>\n\n<h4>See also</h4>\n\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VariableVoltageSource\">VariableVoltageSource</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.CurrentSource\">CurrentSource</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VariableCurrentSource\">VariableCurrentSource</a>\n</p>\n</html>"));
end VoltageSource;