LIBRARY
Math.RealToInteger
Convert Real to Integer signal.
This block computes the output y as the nearest integer value of the input u using round-half-away-from-zero (the MSL convention):
Usage
BlockComponents.Math.RealToInteger()
Connectors
u- This connector represents a real signal as an input to a component (RealInput)y- This connector represents an integer signal as an output from a component (IntegerOutput)
Behavior
Source
dyad
"""
Convert Real to Integer signal.
This block computes the output `y` as the nearest integer value of the input `u`
using round-half-away-from-zero (the MSL convention):
```math
y = \\begin{cases} \\lfloor u + 0.5 \\rfloor & u > 0 \\\\ \\lceil u - 0.5 \\rceil & u \\le 0 \\end{cases}
```
"""
component RealToInteger
"Connector of Real input signal"
u = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
},
"tags": []
}
}
"Connector of Integer output signal"
y = IntegerOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
relations
y = BlockComponents.round_int(u)
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/RealToInteger.svg"}
}
}
endFlattened Source
dyad
"""
Convert Real to Integer signal.
This block computes the output `y` as the nearest integer value of the input `u`
using round-half-away-from-zero (the MSL convention):
```math
y = \\begin{cases} \\lfloor u + 0.5 \\rfloor & u > 0 \\\\ \\lceil u - 0.5 \\rceil & u \\le 0 \\end{cases}
```
"""
component RealToInteger
"Connector of Real input signal"
u = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
},
"tags": []
}
}
"Connector of Integer output signal"
y = IntegerOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
relations
y = BlockComponents.round_int(u)
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/RealToInteger.svg"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests