feat(mtconnect): serve DATA_SET/TABLE as compact JSON strings; park EVENT enumerations (#650)
Parser captures Entry/Cell content; the observation index merges /sample deltas into the /current baseline (resetTriggered replaces, removed deletes, UNAVAILABLE drops). Fixture gains a TABLE item and periodic DATA_SET/TABLE churn. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
+17
-3
@@ -89,9 +89,12 @@ class Feed:
|
||||
[
|
||||
("Favail", "AVAILABLE"),
|
||||
("Pprogram", "OTOPCUA-FIXTURE.NC"),
|
||||
# DATA_SET representation: the Agent renders these as <Entry key=...> children,
|
||||
# which is precisely the wire shape the driver demotes to String / BadNotSupported.
|
||||
("Pvars", "toolNumber=7 offsetX=1.25 offsetZ=-0.5"),
|
||||
# DATA_SET / TABLE representations: the Agent renders these as <Entry key=...>
|
||||
# children, which the driver serves as a JSON String (#650). The three Pvars keys
|
||||
# are STABLE for the life of the fixture; the periodic feed only touches `cycle`
|
||||
# (Pvars) and the G56 row (Ptab).
|
||||
("Pvars", "toolNumber=7 offsetX=1.25 offsetZ=-0.5 cycle=0"),
|
||||
("Ptab", "G54={X=1.0 Y=2.0} G55={X=3.0} G56={X=0 Z=0.5}"),
|
||||
]
|
||||
)
|
||||
self.send_conditions()
|
||||
@@ -142,6 +145,17 @@ class Feed:
|
||||
[("Cmode", CONTROLLER_MODES[(self._ticks // 44) % len(CONTROLLER_MODES)])]
|
||||
)
|
||||
|
||||
# DATA_SET / TABLE churn (#650): every ~5 s change one key / one row so a live gate can
|
||||
# observe a /sample delta merge. The other keys / rows never change.
|
||||
if self._ticks % 20 == 0:
|
||||
n = self._ticks // 20
|
||||
self.send_observations(
|
||||
[
|
||||
("Pvars", f"cycle={n}"),
|
||||
("Ptab", f"G56={{X={n} Z=0.5}}"),
|
||||
]
|
||||
)
|
||||
|
||||
# Re-assert conditions occasionally so a late-attaching driver still sees them.
|
||||
if self._ticks % 60 == 0:
|
||||
self.send_conditions()
|
||||
|
||||
Reference in New Issue
Block a user