You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `ConstantResampler` operator transforms a variable throughput input signal into a constant throughput output signal by emitting values at fixed time intervals. The operator maintains causal consistency while handling grid-aligned messages with special precision.
31
+
32
+
## Behavior
33
+
34
+
### Initialization
35
+
36
+
When receiving its first message at time t₀, the operator:
37
+
38
+
- Stores the initial value
39
+
- Sets up first emission point at t₀ + dt
40
+
- Does not emit
41
+
42
+
### Regular Operation
43
+
44
+
For subsequent messages, the operator follows these rules:
45
+
46
+
1.**Grid-Aligned Messages**:
47
+
48
+
- If a message arrives exactly at a grid point (t = nextEmit)
49
+
- Emits immediately with the current message's value
50
+
- Updates nextEmit to t + dt
51
+
52
+
2.**Between Grid Points**:
53
+
54
+
- If message time is between grid points
55
+
- Stores the value for future emissions
56
+
- No immediate emission
57
+
58
+
3.**Past Grid Points**:
59
+
60
+
- If message time is past one or more grid points
61
+
- Emits at each missed grid point using the last known value
62
+
- Maintains causal consistency by using values known at each emission time
63
+
64
+
4.**Large Gaps**:
65
+
- For large time gaps between messages
66
+
- Emits at all intermediate grid points
67
+
- Uses the last known value before each emission point
68
+
69
+
### Key Characteristics
70
+
71
+
- Lazy evaluation: only emits when receiving messages
72
+
- Maintains constant time intervals between emissions
73
+
- Preserves causal consistency
74
+
- Special handling for grid-aligned messages
75
+
- Buffers only one message (the most recent value)
76
+
- State is maintained between calls and can be serialized/restored
77
+
78
+
## Examples
79
+
80
+
### Basic Grid Alignment
81
+
82
+
```
83
+
Input: dt = 5
84
+
t=1: Receive(1, 10.0) -> No emission, nextEmit = 6
0 commit comments