RealToBoolean

block RealToBoolean "Convert Real to Boolean signal"
    Blocks.Interfaces.RealInput u "Connector of Real input signal"
        annotation (Placement(transformation(extent = {
            {-140, -20}, 
            {-100, 20}})));

    extends Interfaces.partialBooleanSO;

    parameter Real threshold = 0.5 "Output signal y is true, if input u >= threshold";
equation
    y = threshold <= u;

    annotation (
        Documentation(info = "<html>\n<p>\nThis block computes the Boolean output <strong>y</strong>\nfrom the Real input <strong>u</strong> by the equation:\n</p>\n\n<pre>    y = u &ge; threshold;\n</pre>\n\n<p>\nwhere <strong>threshold</strong> is a parameter.\n</p>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {-86, 92}, 
                        {-6, 10}},
                    lineColor = {0, 0, 127},
                    textString = "R"), 
                Polygon(
                    points = {
                        {-12, -46}, 
                        {-32, -26}, 
                        {-32, -36}, 
                        {-64, -36}, 
                        {-64, -56}, 
                        {-32, -56}, 
                        {-32, -66}, 
                        {-12, -46}},
                    lineColor = {255, 0, 255},
                    fillColor = {255, 0, 255},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {8, -4}, 
                        {92, -94}},
                    lineColor = {255, 0, 255},
                    textString = "B")}));
end RealToBoolean;