Boolean to real

Converts true/false to two values.

  • signal
  • Boolean
  • Modelica Standard Library
  • 2 ports
  • 2 parameters
BlockBoolean to realKindbooleanToRealLibraryLogic

Description

Converts a Boolean signal to a Real one: realTrue while the input is true, realFalse otherwise.

Example

Logic gates AND, OR, XOR, NAND, NOR, and NOT on two Boolean pulse trains, and a Boolean turned into a number.

ABANDORXORNANDNORNOT ABoolean to real
In Gradara, select a Boolean to real block and press F1, then choose Open example. It opens as a new model in My models, ready to run.

Also in this example:ANDORXORNANDNORNOTBoolean pulse

Ports

Inputs 1

  • u

    Boolean input.

Outputs 1

  • y

    realTrue or realFalse.

Parameters

  • Value when truerealTrue1

    Output while u is true. Any real number.

  • Value when falserealFalse0

    Output while u is false. Any real number.

Equations

Modelica
y = realTrue if u, otherwise realFalse

Implementation

Modelica Standard Library 4.1.0Modelica.Blocks.Math.BooleanToReal
MSL documentation

Assumptions and limitations

  • The output jumps between the two values with no ramp or delay.

See also

Select a block in Gradara and press F1 to open its page offline.