MultiProduct

block MultiProduct "Product of Reals: y = u[1]*u[2]* ... *u[n]"
    extends Modelica.Blocks.Interfaces.PartialRealMISO;
equation
    if 0 < size(u, 1) then 
        y = product(u);
    else 
        y = 0;
    end if;

    annotation (
        Icon(graphics = {
            Text(
                extent = {
                    {-74, 50}, 
                    {94, -94}},
                textString = "*")}),
        Documentation(info = "<html>\n<p>\nThis blocks computes the scalar Real output \"y\" as product of the elements of the\nReal input signal vector u:\n</p>\n<blockquote><pre>\ny = u[1]*u[2]* ... *u[N];\n</pre></blockquote>\n\n<p>\nThe input connector is a vector of Real input signals.\nWhen a connection line is drawn, the dimension of the input\nvector is enlarged by one and the connection is automatically\nconnected to this new free index (thanks to the\nconnectorSizing annotation).\n</p>\n\n<p>\nThe usage is demonstrated, e.g., in example\n<a href=\"modelica://Modelica.Blocks.Examples.RealNetwork1\">Modelica.Blocks.Examples.RealNetwork1</a>.\n</p>\n\n<p>\nIf no connection to the input connector \"u\" is present,\nthe output is set to zero: y=0.\n</p>\n</html>"));
end MultiProduct;