Set

block Set "Digital Set Source"
    import D = Modelica.Electrical.Digital;
    import L = Modelica.Electrical.Digital.Interfaces.Logic;

    parameter D.Interfaces.Logic x(start = L.'1') "Logic value to be set";
    D.Interfaces.DigitalOutput y annotation (Placement(transformation(extent = {
        {90, -10}, 
        {110, 10}})));
algorithm
    y := x;

    annotation (
        Documentation(
            info = "<html>\n<p>\nSets a nine valued digital signal, which is specified by the <em>setval</em> parameter.\n</p>\n<p>\nTo specify <em>setval</em>, the integer code has to be used.\n</p>\n<p><strong>Code Table</strong></p>\n\n<table border=1 cellspacing=0 cellpadding=2>\n  <tr><td><strong>Logic value</strong></td>\n      <td><strong>Integer code</strong></td>\n      <td><strong>Meaning</strong></td>\n  </tr>\n\n  <tr><td>'U'</td> <td>1</td> <td>Uninitialized</td></tr>\n  <tr><td>'X'</td> <td>2</td> <td>Forcing Unknown</td></tr>\n  <tr><td>'0'</td> <td>3</td> <td>Forcing 0</td></tr>\n  <tr><td>'1'</td> <td>4</td> <td>Forcing 1</td></tr>\n  <tr><td>'Z'</td> <td>5</td> <td>High Impedance</td></tr>\n  <tr><td>'W'</td> <td>6</td> <td>Weak Unknown</td></tr>\n  <tr><td>'L'</td> <td>7</td> <td>Weak 0</td></tr>\n  <tr><td>'H'</td> <td>8</td> <td>Weak 1</td></tr>\n  <tr><td>'-'</td> <td>9</td> <td>Do not care</td></tr>\n</table>\n\n<p>\nIf the logic values are imported by<br><strong>import L = Digital.Interfaces.Logic;</strong><br>\nthey can be used to specify the parameter, e.g., <strong>L.'0'</strong> for forcing 0.\n</p>\n</html>",
            revisions = "<html>\n<dl>\n<dt><em>August 20, 2003</em></dt>\n<dd>by Teresa Schlegel initially modelled.</dd>\n</dl>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Rectangle(
                    extent = {
                        {-50, 100}, 
                        {50, -100}},
                    lineThickness = 0.5,
                    fillColor = {213, 255, 170},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-50, 40}, 
                        {50, 80}},
                    textString = "SET"), 
                Text(
                    extent = {
                        {152, -160}, 
                        {-148, -100}},
                    lineColor = {0, 0, 255},
                    textString = "%name"), 
                Line(
                    points = {
                        {50, 0}, 
                        {90, 0}},
                    color = {127, 0, 127})}));
end Set;