Skip to content
LIBRARY
Math.RealToBoolean.md

Math.RealToBoolean

Convert Real to Boolean signal.

This block computes the Boolean output y from the Real input u by the equation:

y = u ≥ threshold

where threshold is a parameter.

This component extends from BlockComponents.Interfaces.PartialBooleanSO

Usage

BlockComponents.Math.RealToBoolean(threshold=0.5)

Parameters:

NameDescriptionUnitsDefault value
thresholdOutput signal y is true, if input u >= threshold0.5

Connectors

  • y - This connector represents a boolean signal as an output from a component (BooleanOutput)

  • u - This connector represents a real signal as an input to a component (RealInput)

Behavior

Source

dyad
"""
Convert Real to Boolean signal.

This block computes the Boolean output `y` from the Real input `u` by the equation:

```
y = u ≥ threshold
```

where `threshold` is a parameter.
"""
component RealToBoolean
  extends BlockComponents.Interfaces.PartialBooleanSO
  "Connector of Real input signal"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -110, "y1": 450, "x2": -10, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Output signal y is true, if input u >= threshold"
  parameter threshold::Real = 0.5
relations
  y = u >= threshold
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RealToBoolean.svg"}
  }
}
end
Flattened Source
dyad
"""
Convert Real to Boolean signal.

This block computes the Boolean output `y` from the Real input `u` by the equation:

```
y = u ≥ threshold
```

where `threshold` is a parameter.
"""
component RealToBoolean
  "Connector of Boolean output signal"
  y = BooleanOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Connector of Real input signal"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -110, "y1": 450, "x2": -10, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Output signal y is true, if input u >= threshold"
  parameter threshold::Real = 0.5
relations
  y = u >= threshold
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RealToBoolean.svg"}
  }
}
end


Test Cases

No test cases defined.