图标
介绍
The (time varying) Boolean output signal of this block can be defined in its parameter menu via variable y. The purpose is to support the easy definition of Boolean expressions in a block diagram. For example, in the y-menu the definition "time >= 1 and time <= 2" can be given in order to define that the output signal is true in the time interval 1 ≤ time ≤ 2 and otherwise it is false. Note, that "time" is a built-in variable that is always accessible and represents the "model time" and that variable y is both a variable and a connector.
"time"是一个内置变量,指仿真中的时间变量;可在字符串中编写和“time”相关的函数,即
boolean y = Function(real time);
IO
输入:字符串;
输出:布尔值;
Modelica.Blocks.Interfaces.BooleanOutput y=false "Value of Boolean output"
用例
输出结果
代码
model test1
Modelica.Blocks.Sources.BooleanExpression booleanExpression1(y = if time > 2 then true else false) annotation(
Placement(visible = true, transformation(origin = { -3, -1}, extent = {{-11, -9}, {11, 9}}, rotation = 0)));
equation
annotation(
uses(Modelica(version = "3.2.2")));end test1;