Constant

block Constant "Generate constant signal of type Real"
    parameter Real k(start = 1) "Constant output value"
        annotation (Dialog(groupImage = "modelica://Modelica/Resources/Images/Blocks/Sources/Constant.png"));

    extends Interfaces.SO;
equation
    y = k;

    annotation (
        defaultComponentName = "const",
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-80, 68}, 
                        {-80, -80}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {-80, 90}, 
                        {-88, 68}, 
                        {-72, 68}, 
                        {-80, 90}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-90, -70}, 
                        {82, -70}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {90, -70}, 
                        {68, -62}, 
                        {68, -78}, 
                        {90, -70}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(points = {
                    {-80, 0}, 
                    {80, 0}}), 
                Text(
                    extent = {
                        {-150, -150}, 
                        {150, -110}},
                    textString = "k=%k")}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Polygon(
                    points = {
                        {-80, 90}, 
                        {-86, 68}, 
                        {-74, 68}, 
                        {-80, 90}},
                    lineColor = {95, 95, 95},
                    fillColor = {95, 95, 95},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-80, 68}, 
                        {-80, -80}},
                    color = {95, 95, 95}), 
                Line(
                    points = {
                        {-80, 0}, 
                        {80, 0}},
                    color = {0, 0, 255},
                    thickness = 0.5), 
                Line(
                    points = {
                        {-90, -70}, 
                        {82, -70}},
                    color = {95, 95, 95}), 
                Polygon(
                    points = {
                        {90, -70}, 
                        {68, -64}, 
                        {68, -76}, 
                        {90, -70}},
                    lineColor = {95, 95, 95},
                    fillColor = {95, 95, 95},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-83, 92}, 
                        {-30, 74}},
                    textString = "y"), 
                Text(
                    extent = {
                        {70, -80}, 
                        {94, -100}},
                    textString = "time"), 
                Text(
                    extent = {
                        {-101, 8}, 
                        {-81, -12}},
                    textString = "k")}),
        Documentation(info = "<html>\n<p>\nThe Real output y is a constant signal:\n</p>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Constant.png\"\n     alt=\"Constant.png\">\n</p>\n</html>"));
end Constant;