Skip to content

Commit

Permalink
Add rate option to Container
Browse files Browse the repository at this point in the history
  • Loading branch information
fqqb committed Mar 22, 2024
1 parent 874cec0 commit cde763d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/yamcs/pymdb/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(
long_description: str | None = None,
extra: Mapping[str, str] | None = None,
bits: int | None = None,
rate: float | None = None,
hint_partition: bool = False,
):
self.name: str = name
Expand Down Expand Up @@ -109,6 +110,17 @@ def __init__(
included.
"""

self.rate: float | None = rate
"""
Expected rate in seconds.
This is used by Yamcs to determine parameter expiration. A parameter's
realtime value is considered expired when ``1.9 * rate`` has passed
without a new update (where ``1.9`` is a configurable tolerance multiplier).
If ``None``, the contained parameters are not checked for expiration.
"""

self.hint_partition: bool = hint_partition
"""
Hint that this container's name should be used for partitioning when
Expand Down
4 changes: 4 additions & 0 deletions src/yamcs/pymdb/xtce.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,10 @@ def add_sequence_container(self, parent: ET.Element, container: Container):
if extra:
self.add_ancillary_data(el, extra)

if container.rate is not None:
rate_el = ET.SubElement(el, "DefaultRateInStream")
rate_el.attrib["maximumValue"] = _to_xml_value(container.rate)

if container.bits is not None:
encoding_el = ET.SubElement(el, "BinaryEncoding")
size_el = ET.SubElement(encoding_el, "SizeInBits")
Expand Down

0 comments on commit cde763d

Please sign in to comment.