block RadioButton "Button that sets its output to true when pressed and is reset when an element of 'reset' becomes true"
extends Modelica.Icons.ObsoleteModel;
parameter Modelica.SIunits.Time buttonTimeTable[:] = {0} "Time instants where button is pressed and released";
input Boolean reset[:] = {false} "Reset button to false, if an element of reset becomes true"
annotation (Dialog(group = "Time varying expressions"));
Modelica.Blocks.Interfaces.BooleanOutput on annotation (Placement(transformation(extent = {
{100, -10},
{120, 10}})));
protected
Modelica.Blocks.Sources.BooleanTable table(table = buttonTimeTable);
initial equation
pre(reset) = fill(false, size(reset, 1));
algorithm
on := table.y;
when pre(reset) then
on := false;
end when;
annotation (
obsolete = "Obsolete model due to experimental design, that will be moved to Modelica.Blocks.Interaction in future",
Icon(
coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Rectangle(
extent = {
{-100, -100},
{100, 100}},
fillColor = DynamicSelect({192, 192, 192}, if on then {0, 255, 0} else {192, 192, 192}),
fillPattern = FillPattern.Solid,
lineColor = {128, 128, 128},
lineThickness = 0.5),
Text(
extent = {
{-80, -40},
{80, 40}},
textString = "%name")},
interaction = {
OnMouseDownSetBoolean(
variable = on,
value = true)}));
end RadioButton;