SineVoltage

model SineVoltage "Sine voltage source"
    parameter SI.Voltage V(start = 1) "Amplitude of sine wave";
    parameter SI.Angle phase = 0 "Phase of sine wave";
    parameter SI.Frequency freqHz(start = 1) "Frequency of sine wave";

    extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Sine signalSource(final amplitude = V, final freqHz = freqHz, final phase = phase));

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-66, 0}, 
                        {-56.2, 29.9}, 
                        {-49.8, 46.5}, 
                        {-44.2, 58.1}, 
                        {-39.3, 65.2}, 
                        {-34.3, 69.2}, 
                        {-29.4, 69.8}, 
                        {-24.5, 67}, 
                        {-19.6, 61}, 
                        {-14.6, 52}, 
                        {-9, 38.6}, 
                        {-1.98, 18.6}, 
                        {12.79, -26.9}, 
                        {19.1, -44}, 
                        {24.8, -56.2}, 
                        {29.7, -64}, 
                        {34.6, -68.6}, 
                        {39.5, -70}, 
                        {44.5, -67.9}, 
                        {49.4, -62.5}, 
                        {54.3, -54.1}, 
                        {59.9, -41.3}, 
                        {67, -21.7}, 
                        {74, 0}},
                    color = {192, 192, 192})}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-80, -90}, 
                        {-80, 84}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {-80, 100}, 
                        {-86, 84}, 
                        {-74, 84}, 
                        {-80, 100}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-99, -40}, 
                        {100, -40}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {100, -40}, 
                        {84, -34}, 
                        {84, -46}, 
                        {100, -40}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-41, -2}, 
                        {-32.6, 32.2}, 
                        {-27.1, 51.1}, 
                        {-22.3, 64.4}, 
                        {-18.1, 72.6}, 
                        {-13.9, 77.1}, 
                        {-8, 78}, 
                        {-5.42, 74.6}, 
                        {-1.201, 67.7}, 
                        {3.02, 57.4}, 
                        {7.84, 42.1}, 
                        {13.9, 19.2}, 
                        {26.5, -32.8}, 
                        {32, -52.2}, 
                        {36.8, -66.2}, 
                        {41, -75.1}, 
                        {45.2, -80.4}, 
                        {49.5, -82}, 
                        {53.7, -79.6}, 
                        {57.9, -73.5}, 
                        {62.1, -63.9}, 
                        {66.9, -49.2}, 
                        {73, -26.8}, 
                        {79, -2}},
                    thickness = 0.5), 
                Line(
                    points = {
                        {-41, -2}, 
                        {-80, -2}},
                    thickness = 0.5), 
                Text(
                    extent = {
                        {-106, -11}, 
                        {-60, -29}},
                    lineColor = {160, 160, 164},
                    textString = "offset"), 
                Line(
                    points = {
                        {-41, -2}, 
                        {-41, -40}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Text(
                    extent = {
                        {-60, -43}, 
                        {-14, -61}},
                    lineColor = {160, 160, 164},
                    textString = "startTime"), 
                Text(
                    extent = {
                        {76, -52}, 
                        {100, -72}},
                    lineColor = {160, 160, 164},
                    textString = "time"), 
                Line(
                    points = {
                        {-8, 78}, 
                        {45, 78}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-41, -2}, 
                        {52, -2}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Polygon(
                    points = {
                        {33, 78}, 
                        {30, 65}, 
                        {37, 65}, 
                        {33, 78}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {37, 57}, 
                        {83, 39}},
                    lineColor = {160, 160, 164},
                    textString = "V"), 
                Polygon(
                    points = {
                        {33, -2}, 
                        {30, 11}, 
                        {36, 11}, 
                        {33, -2}, 
                        {33, -2}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {33, 78}, 
                        {33, -2}},
                    color = {192, 192, 192}), 
                Text(
                    extent = {
                        {-69, 109}, 
                        {-4, 83}},
                    lineColor = {160, 160, 164},
                    textString = "v = p.v - n.v")}),
        Documentation(
            revisions = "<html>\n<ul>\n<li><em> 1998   </em>\n       by Christoph Clauss<br> initially implemented<br>\n       </li>\n</ul>\n</html>",
            info = "<html>\n<p>This voltage source uses the corresponding signal source of the Modelica.Blocks.Sources package. Care for the meaning of the parameters in the Blocks package. Furthermore, an offset parameter is introduced, which is added to the value calculated by the blocks source. The startTime parameter allows to shift the blocks source behavior on the time axis.</p>\n</html>"));
end SineVoltage;