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
Copy file name to clipboardExpand all lines: 04-conservative.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,9 @@ The fix: California's node sends **null messages** periodically. A null message
52
52
In the grid context, a null message with value `0` can be used as "no change in dispatch." It is a heartbeat that lets the remote manager advance logical time even during quiet periods.
53
53
We create a `GridServer` that wraps the `OperatorConsole` and sends null messages periodically when the console has nothing to say:
54
54
55
+
Here, we use LF's [**reactor hierarchy**](https://www.lf-lang.org/docs/writing-reactors/composing-reactors/#hierarchy): `GridServer` contains an instance of `OperatorConsole` with `console = new OperatorConsole()`.
56
+
The contained `OperatorConsole` is responsible only for generating real operator commands, while the enclosing `GridServer` combines those commands with a heartbeat timer to forward either a real command or a null message.
57
+
55
58
```lf
56
59
reactor GridServer(null_message_period: time = 1 s) {
57
60
input balance_in: int // balance feedback from local GridManager
0 commit comments