BooleanStep

block BooleanStep "Generate step signal of type Boolean"
    parameter Modelica.SIunits.Time startTime = 0 "Time instant of step start"
        annotation (Dialog(groupImage = "modelica://Modelica/Resources/Images/Blocks/Sources/BooleanStep.png"));
    parameter Boolean startValue = false "Output before startTime";

    extends Interfaces.partialBooleanSource;
equation
    y = if startTime <= time then not startValue else startValue;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    visible = not startValue,
                    points = {
                        {-80, -70}, 
                        {0, -70}, 
                        {0, 50}, 
                        {80, 50}}), 
                Line(
                    visible = startValue,
                    points = {
                        {-80, 50}, 
                        {0, 50}, 
                        {0, -70}, 
                        {68, -70}}), 
                Text(
                    extent = {
                        {-150, -140}, 
                        {150, -110}},
                    textString = "%startTime")}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-80, -70}, 
                        {0, -70}, 
                        {0, 50}, 
                        {80, 50}},
                    color = {0, 0, 255},
                    thickness = 0.5), 
                Text(
                    extent = {
                        {-15, -74}, 
                        {20, -82}},
                    textString = "startTime"), 
                Polygon(
                    points = {
                        {2, 50}, 
                        {-80, 50}, 
                        {2, 50}},
                    lineColor = {95, 95, 95},
                    fillColor = {95, 95, 95},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-66, 62}, 
                        {-22, 48}},
                    textString = "not startValue"), 
                Text(
                    extent = {
                        {-68, -58}, 
                        {-36, -72}},
                    textString = "startValue")}),
        Documentation(info = "<html>\n<p>\nThe Boolean output y is a step signal:\n</p>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/BooleanStep.png\"\n     alt=\"BooleanStep.png\">\n</p>\n</html>"));
end BooleanStep;