Xor

block Xor "Logical 'xor': y = oneTrue(u)  (y is true, if exactly one element of u is true, otherwise it is false)"
    extends Modelica.Blocks.Interfaces.PartialBooleanMISO;
equation
    y = Modelica.Math.BooleanVectors.oneTrue(u);

    annotation (
        defaultComponentName = "xor1",
        Icon(graphics = {
            Text(
                extent = {
                    {-80, 40}, 
                    {60, -40}},
                textString = "xor")}),
        Documentation(info = "<html>\n<p>\nThe output is <strong>true</strong> if exactly one input is <strong>true</strong>, otherwise\nthe output is <strong>false</strong>.\n</p>\n\n<p>\nThe input connector is a vector of Boolean 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.BooleanNetwork1\">Modelica.Blocks.Examples.BooleanNetwork1</a>.\n</p>\n\n<p>\nIf no connection to the input connector \"u\" is present,\nthe output is set to <strong>false</strong>: y=false.\n</p>\n\n</html>"));
end Xor;