Sum

block Sum "Output the sum of the elements of the input vector"
    extends Interfaces.ComplexMISO;

    parameter Complex k[nin] = fill(Complex(1, 0), nin) "Optional: sum coefficients";
equation
    y = k * uInternal;

    annotation (
        defaultComponentName = "sum1",
        Documentation(info = "<html>\n<p>\nThis blocks computes output <code>y</code> as\n<em>sum</em> of the elements of the input signal vector\n<code>u</code>:\n</p>\n<blockquote><pre>\ny = u[1] + u[2] + ...;\n</pre></blockquote>\n<p>\nExample:\n</p>\n<blockquote><pre>\n  parameter:   nin = 3;\n\nresults in the following equations:\n\n  y = u[1] + u[2] + u[3];\n</pre></blockquote>\n\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {26, 42}, 
                        {-34, 42}, 
                        {6, 2}, 
                        {-34, -38}, 
                        {26, -38}},
                    color = {85, 170, 255})}));
end Sum;