Skip to content

Tiled/Databroker compatibility for composite parameters - #65

Open
Bilchreis wants to merge 5 commits into
masterfrom
tiled-writer-compat
Open

Tiled/Databroker compatibility for composite parameters#65
Bilchreis wants to merge 5 commits into
masterfrom
tiled-writer-compat

Conversation

@Bilchreis

Copy link
Copy Markdown
Contributor

Tiled and Databroker only support flat (non-nested) datatypes, but SECoP
allows arbitrarily nested StructOf/TupleOf parameters. This PR adds
support for decomposing shallow composite parameters (nesting depth <= 1)
into individual flat signals so they can be consumed by tiled/databroker,
instead of failing or silently misrepresenting the data.

Composite parameter decomposition

  • New CompositeKind classifier (util.classify_datatype) sorts a
    parameter's datatype into:
    • ATOMIC — scalar or array-of-scalar, unchanged single-Signal behaviour.
    • DECOMPOSABLE — a top-level StructOf/TupleOf with depth <= 1: split
      into one read-only param_name_<member> SignalR per member, plus a
      write-only param_name SignalW if the parameter is settable.
    • UNSUPPORTED — deeper nesting (struct/tuple nested inside a
      struct/tuple/array): no signal is generated. Raises
      IncompatibleSECoPDatatype if the parameter is mandatory for the
      module's interface class, otherwise warns and skips it.
  • SECoPBackend gains a MEMBER attribute type for these split signals;
    each fetches the parent's cached wire reading and extracts its own
    field/index, so no extra round-trips are incurred.
  • status (SECoP's TupleOf(EnumType, StringType)) is now always
    decomposed into status_0/status_1 instead of exposing a single
    structured-numpy-array signal.
  • SECoPMoveableDevice is now generic over its target datatype
    (StandardMovable[SignalDatatypeT]); locate(), movable_logic, and
    set_name() were updated to handle the case where target/value are
    decomposed (write-only target, and a private undecomposed value
    readback signal built solely to satisfy StandardMovable's internal
    plumbing).
  • GenNodeCode.py updated to codegen the split member signals, per-member
    enum classes for enum-typed struct/tuple members, and the parametrized
    SECoPMoveableDevice[T] base class.

Other changes

  • Warn when a generated device name exceeds tiled's 63-character storage
    limit (warn_on_long_device_names).
  • Removed dead code: SECoPReadableDevice.observe_status_change and the
    now-unused bluesky.plan_stubs import.

Tests

  • New test_device_naming.py for the long-name warning.
  • Extended test_classgen.py, test_dtype.py, test_nested.py,
    test_annotation.py, and test_Node.py to cover composite-parameter
    decomposition, CompositeKind classification, and set_name timing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant