ExpSineVoltage

model ExpSineVoltage "Exponentially damped sine voltage source"
    parameter SI.Voltage V(start = 1) "Amplitude of sine wave";
    parameter SI.Frequency freqHz(start = 2) "Frequency of sine wave";
    parameter SI.Angle phase = 0 "Phase of sine wave";
    parameter SI.Damping damping(start = 1) "Damping coefficient of sine wave";

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

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-64, -14}, 
                        {-59.2, 18.3}, 
                        {-56, 36.3}, 
                        {-52.7, 50.5}, 
                        {-49.5, 60.2}, 
                        {-46.3, 65.3}, 
                        {-43.1, 65.6}, 
                        {-39.9, 61.3}, 
                        {-36.7, 53.1}, 
                        {-32.6, 38.2}, 
                        {-27, 11.8}, 
                        {-19, -27.9}, 
                        {-14.2, -47.7}, 
                        {-10.1, -59.9}, 
                        {-6.1, -67.2}, 
                        {-2.1, -69.3}, 
                        {1.9, -66.5}, 
                        {5.9, -59.3}, 
                        {10.77, -46.1}, 
                        {24.44, -0.3}, 
                        {29.3, 12.4}, 
                        {34.1, 20.8}, 
                        {38.1, 24}, 
                        {42.9, 23.2}, 
                        {47.8, 17.8}, 
                        {54.2, 5.4}, 
                        {67.1, -24.5}, 
                        {73.5, -35.2}, 
                        {79.1, -39.9}, 
                        {84.7, -39.9}, 
                        {91.2, -34.5}, 
                        {96, -27.8}},
                    color = {192, 192, 192})}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                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}, 
                        {85, -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 = {
                        {-50, 0}, 
                        {-46.1, 28.2}, 
                        {-43.5, 44}, 
                        {-40.9, 56.4}, 
                        {-38.2, 64.9}, 
                        {-35.6, 69.4}, 
                        {-33, 69.6}, 
                        {-30.4, 65.9}, 
                        {-27.8, 58.7}, 
                        {-24.5, 45.7}, 
                        {-19.9, 22.5}, 
                        {-13.4, -12.2}, 
                        {-9.5, -29.5}, 
                        {-6.23, -40.1}, 
                        {-2.96, -46.5}, 
                        {0.302, -48.4}, 
                        {3.57, -45.9}, 
                        {6.83, -39.6}, 
                        {10.8, -28.1}, 
                        {21.9, 12}, 
                        {25.8, 23.1}, 
                        {29.7, 30.5}, 
                        {33, 33.3}, 
                        {36.9, 32.5}, 
                        {40.8, 27.8}, 
                        {46, 16.9}, 
                        {56.5, -9.2}, 
                        {61.7, -18.6}, 
                        {66.3, -22.7}, 
                        {70.9, -22.6}, 
                        {76.1, -18}, 
                        {80, -12.1}},
                    thickness = 0.5), 
                Text(
                    extent = {
                        {-78, 1}, 
                        {-55, -19}},
                    lineColor = {160, 160, 164},
                    textString = "offset"), 
                Text(
                    extent = {
                        {-72, -36}, 
                        {-26, -54}},
                    lineColor = {160, 160, 164},
                    textString = "startTime"), 
                Text(
                    extent = {
                        {76, -44}, 
                        {100, -64}},
                    lineColor = {160, 160, 164},
                    textString = "time"), 
                Line(
                    points = {
                        {-50, 0}, 
                        {18, 0}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-50, 0}, 
                        {-80, 0}},
                    thickness = 0.5), 
                Line(
                    points = {
                        {-50, 77}, 
                        {-50, 0}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {18, 0}, 
                        {18, 76}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {18, 73}, 
                        {-50, 73}},
                    color = {192, 192, 192}), 
                Text(
                    extent = {
                        {-42, 88}, 
                        {9, 74}},
                    lineColor = {160, 160, 164},
                    textString = "1/freqHz"), 
                Polygon(
                    points = {
                        {-50, 73}, 
                        {-41, 75}, 
                        {-41, 71}, 
                        {-50, 73}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {18, 73}, 
                        {10, 75}, 
                        {10, 71}, 
                        {18, 73}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-50, -61}, 
                        {-19, -61}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {-18, -61}, 
                        {-26, -59}, 
                        {-26, -63}, 
                        {-18, -61}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-51, -63}, 
                        {-27, -75}},
                    lineColor = {160, 160, 164},
                    textString = "t"), 
                Text(
                    extent = {
                        {-82, -67}, 
                        {108, -96}},
                    lineColor = {160, 160, 164},
                    textString = "V*exp(-damping*t)*sin(2*pi*freqHz*t+phase)"), 
                Line(
                    points = {
                        {-50, 0}, 
                        {-50, -40}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-50, -54}, 
                        {-50, -72}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {18, -76}, 
                        {-1, -48}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Text(
                    extent = {
                        {-77, 105}, 
                        {-38, 92}},
                    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 ExpSineVoltage;