DataTypeConversion_to_UInt32 DataTypeConversion_to_UInt32 Icon

WIP.DataTypeConversion_to_UInt32

DataTypeConversion_to_UInt32(; saturate_on_overflow=false)

Converts a real-valued input signal into a 32-bit unsigned integer (UInt32).

Parameters

  • saturate_on_overflow: When enabled, clamps output to 0–4,294,967,295 (saturation). When disabled, values wrap around using modulo arithmetic (default: false)

Variables

  • u(t): Real-valued input signal
  • y(t): 32-bit unsigned integer output (0–4,294,967,295)

Description

Converts input to UInt32 with floor rounding (fractional values rounded toward negative infinity). When saturateonoverflow is true, values outside 0–4,294,967,295 are clamped. When false, values wrap around. This block mimics Simulink's Data Type Conversion behavior when configured for 32-bit unsigned integers with Floor rounding.

Examples

to_uint32_floor(4294967299.9, true)    → 4294967295   (saturated)
to_uint32_floor(4294967299.9, false)   → 3            (wrapped)
to_uint32_floor(-3.2, true)            → 0            (saturated)
to_uint32_floor(-3.2, false)           → 4294967292   (wrapped)

Usage

PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow=false)

Parameters:

NameDescriptionUnitsDefault value
saturate_on_overflowfalse

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

\[ \begin{align} y\left( t \right) &= to\_uint32\_floor\left( u\left( t \right), \mathtt{saturate\_on\_overflow} \right) \end{align} \]

Source

"""
    DataTypeConversion_to_UInt32(; saturate_on_overflow=false)

Converts a real-valued input signal into a 32-bit unsigned integer (UInt32).

# Parameters
- `saturate_on_overflow`: When enabled, clamps output to 0–4,294,967,295 (saturation). When disabled, values wrap around using modulo arithmetic (default: false)

# Variables
- `u(t)`: Real-valued input signal
- `y(t)`: 32-bit unsigned integer output (0–4,294,967,295)

# Description
Converts input to UInt32 with floor rounding (fractional values rounded toward negative infinity).
When saturate_on_overflow is true, values outside 0–4,294,967,295 are clamped. When false, values wrap around.
This block mimics Simulink's Data Type Conversion behavior when configured for 32-bit unsigned integers with Floor rounding.

# Examples

touint32floor(4294967299.9, true) → 4294967295 (saturated) touint32floor(4294967299.9, false) → 3 (wrapped) touint32floor(-3.2, true) → 0 (saturated) touint32floor(-3.2, false) → 4294967292 (wrapped)

"""</span>
<span class="hljs-keyword">component</span> DataTypeConversion_to_UInt32
&nbsp;&nbsp;<span class="hljs-symbol">u</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealInput.html">RealInput</a></span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">y</span> = <span>Dyad.IntegerOutput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# Clamp to 0–4294967295 if overflow occurs
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">saturate_on_overflow</span>::<span>Boolean</span> = false
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;y = to_uint32_floor(u, saturate_on_overflow)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Convert.svg"}}}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
    DataTypeConversion_to_UInt32(; saturate_on_overflow=false)

Converts a real-valued input signal into a 32-bit unsigned integer (UInt32).

# Parameters
- `saturate_on_overflow`: When enabled, clamps output to 0–4,294,967,295 (saturation). When disabled, values wrap around using modulo arithmetic (default: false)

# Variables
- `u(t)`: Real-valued input signal
- `y(t)`: 32-bit unsigned integer output (0–4,294,967,295)

# Description
Converts input to UInt32 with floor rounding (fractional values rounded toward negative infinity).
When saturate_on_overflow is true, values outside 0–4,294,967,295 are clamped. When false, values wrap around.
This block mimics Simulink's Data Type Conversion behavior when configured for 32-bit unsigned integers with Floor rounding.

# Examples

touint32floor(4294967299.9, true) → 4294967295 (saturated) touint32floor(4294967299.9, false) → 3 (wrapped) touint32floor(-3.2, true) → 0 (saturated) touint32floor(-3.2, false) → 4294967292 (wrapped)

"""</span>
<span class="hljs-keyword">component</span> DataTypeConversion_to_UInt32
&nbsp;&nbsp;<span class="hljs-symbol">u</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealInput.html">RealInput</a></span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">y</span> = <span>Dyad.IntegerOutput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# Clamp to 0–4294967295 if overflow occurs
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">saturate_on_overflow</span>::<span>Boolean</span> = false
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;y = to_uint32_floor(u, saturate_on_overflow)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Convert.svg"}}}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses