Modelica_StateGraph2.Blocks.Interactive

Interactive components

Package Content

NameDescription
Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource RadioButtonSource Boolean signal source that mimis a radio button
Modelica_StateGraph2.Blocks.Interactive.TrigButton TrigButton Button that sets its output y to true when pressing starts and otherwise sets its output to false
Modelica_StateGraph2.Blocks.Interactive.PressButton PressButton Button that sets its output y to true when pressed down and changed to false when button is released
Modelica_StateGraph2.Blocks.Interactive.ToggleButton ToggleButton Button that sets its value to the opposite of its previous value when pressed down and then keeps this value until pressed anew


Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource

Boolean signal source that mimis a radio button

Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource

Information


Boolean signal source that mimics a radio button: Via a table, a radio button is pressed (i.e., the output 'on' is set to true) and is reset when an element of the Boolean vector 'reset' becomes true. If both appear at the same time instant, setting the button according to the table has a higher priority as reseting the button. Example:

  RadioButtonSource start(buttonTimeTable={1,3}, reset={stop.on});
  RadioButtonSource stop (buttonTimeTable={2,4}, reset={start.on});

The "start" button is pressed at time=1 s and time=3 s, whereas the "stop" button is pressed at time=2 s and time=4 s. This gives the following result:

time [s] start.on stop.on
0 false false
1 false false
1 true false
2 true false
2 false true
3 false true
3 true false
4 true false
4 false true

Parameters

TypeNameDefaultDescription
TimebuttonTimeTable[:] Time instants where button is pressed [s]
Time varying expressions
Booleanreset[:]{false}Reset button to false, if an element of reset becomes true

Connectors

TypeNameDescription
output BooleanOutputon 

Modelica definition

block RadioButtonSource 
  "Boolean signal source that mimis a radio button"

  parameter Modelica.SIunits.Time buttonTimeTable[:] 
    "Time instants where button is pressed";
  input Boolean reset[:]={false} 
    "Reset button to false, if an element of reset becomes true";

  Modelica.Blocks.Interfaces.BooleanOutput on(start=false,fixed=true);
protected 
  Modelica.Blocks.Sources.BooleanTable table(table=buttonTimeTable);
  parameter Integer nReset = size(reset,1);
  Boolean pre_reset[nReset];
initial equation 
  pre(pre_reset)=fill(false,nReset);
  pre(reset) = fill(false,nReset);
algorithm 
  pre_reset :=pre(reset);
  when pre_reset then
     on := false;
  end when;

  when change(table.y) then
     on := true;
  end when;
end RadioButtonSource;

Modelica_StateGraph2.Blocks.Interactive.TrigButton Modelica_StateGraph2.Blocks.Interactive.TrigButton

Button that sets its output y to true when pressing starts and otherwise sets its output to false

Modelica_StateGraph2.Blocks.Interactive.TrigButton

Parameters

TypeNameDefaultDescription
Stringlabel"" 
BooleanuseGraphicalOutputtrue 

Connectors

TypeNameDescription
output BooleanOutputy 

Modelica definition

model TrigButton 
  "Button that sets its output y to true when pressing starts and otherwise sets its output to false"
  parameter String label="";
  parameter Boolean useGraphicalOutput = true;

  Modelica.Blocks.Interfaces.BooleanOutput y;
protected 
  Boolean buttonState(start=false,fixed=true);
  Boolean pre_buttonState(start=false,fixed=true);
equation 
  when pre(buttonState) then
    buttonState = false;
  end when;
  pre_buttonState = pre(buttonState);
  y = edge(pre_buttonState);
end TrigButton;

Modelica_StateGraph2.Blocks.Interactive.PressButton Modelica_StateGraph2.Blocks.Interactive.PressButton

Button that sets its output y to true when pressed down and changed to false when button is released

Modelica_StateGraph2.Blocks.Interactive.PressButton

Parameters

TypeNameDefaultDescription
Stringlabel"" 
BooleanuseGraphicalOutputtrue 

Connectors

TypeNameDescription
output BooleanOutputy 

Modelica definition

model PressButton 
  "Button that sets its output y to true when pressed down and changed to false when button is released"
  parameter String label="";
  parameter Boolean useGraphicalOutput = true;

  Modelica.Blocks.Interfaces.BooleanOutput y;

protected 
  Boolean buttonState(start=false,fixed=true);
equation 

  //Dummy equation to make model check
  when false then
    buttonState = false;
  end when;

  y = pre(buttonState);
end PressButton;

Modelica_StateGraph2.Blocks.Interactive.ToggleButton Modelica_StateGraph2.Blocks.Interactive.ToggleButton

Button that sets its value to the opposite of its previous value when pressed down and then keeps this value until pressed anew

Modelica_StateGraph2.Blocks.Interactive.ToggleButton

Parameters

TypeNameDefaultDescription
Stringlabel"" 

Connectors

TypeNameDescription
output BooleanOutputy 

Modelica definition

model ToggleButton 
  "Button that sets its value to the opposite of its previous value when pressed down and then keeps this value until pressed anew"
  parameter String label="";
  Modelica.Blocks.Interfaces.BooleanOutput y;

equation 
  when false then
    y = false;
  end when;
end ToggleButton;

Automatically generated Fri Nov 12 17:27:07 2010.