block BooleanExpression "Set output signal to a time varying Boolean expression"
Modelica.Blocks.Interfaces.BooleanOutput y = false "Value of Boolean output"
annotation (
Dialog(group = "Time varying output signal"),
Placement(transformation(extent = {
{100, -10},
{120, 10}})));
annotation (
Icon(
coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Rectangle(
extent = {
{-100, 40},
{100, -40}},
fillColor = {235, 235, 235},
fillPattern = FillPattern.Solid,
borderPattern = BorderPattern.Raised),
Text(
extent = {
{-96, 15},
{96, -15}},
textString = "%y"),
Text(
extent = {
{-150, 90},
{150, 50}},
textString = "%name",
lineColor = {0, 0, 255}),
Polygon(
points = {
{100, 10},
{120, 0},
{100, -10},
{100, 10}},
lineColor = DynamicSelect({255, 0, 255}, if y then {0, 255, 0} else {255, 0, 255}),
fillColor = DynamicSelect({255, 255, 255}, if y then {0, 255, 0} else {255, 255, 255}),
fillPattern = FillPattern.Solid)}),
Documentation(info = "<html>\n<p>\nThe (time varying) Boolean output signal of this block can be defined in its\nparameter menu via variable <strong>y</strong>. The purpose is to support the\neasy definition of Boolean expressions in a block diagram. For example,\nin the y-menu the definition \"time >= 1 and time <= 2\" can be given in order\nto define that the output signal is <strong>true</strong> in the time interval\n1 ≤ time ≤ 2 and otherwise it is <strong>false</strong>.\nNote, that \"time\" is a built-in variable that is always\naccessible and represents the \"model time\" and that\nvariable <strong>y</strong> is both a variable and a connector.\n</p>\n</html>"));
end BooleanExpression;