From d8f3ad17585ad29f319a1d9f2b1c8d6b0c3118df Mon Sep 17 00:00:00 2001 From: Eva Lott Date: Wed, 11 Dec 2024 11:14:29 +0000 Subject: [PATCH] added tango `RDS` alarm parameters and EPICS v4 hysteresis --- src/event_model/documents/event_descriptor.py | 35 ++++++++++++++++++- src/event_model/schemas/event_descriptor.json | 31 +++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/event_model/documents/event_descriptor.py b/src/event_model/documents/event_descriptor.py index d9cb89084..b92966981 100644 --- a/src/event_model/documents/event_descriptor.py +++ b/src/event_model/documents/event_descriptor.py @@ -7,6 +7,35 @@ Dtype = Literal["string", "number", "array", "boolean", "integer"] +class RdsRange(TypedDict): + """RDS (Read different than set) parameters range. + + + https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html#the-read-different-than-set-rds-alarm + """ + + time_difference: Annotated[ + float, + Field( + description=( + "ms since last update to fail after if set point and " + "read point are not within `value_difference` of each other." + ) + ), + ] + value_difference: NotRequired[ + Annotated[ + float, + Field( + description=( + "Allowed difference in value between set point and read point " + "after `time_difference`." + ) + ), + ] + ] + + class LimitsRange(TypedDict): low: Optional[float] high: Optional[float] @@ -14,14 +43,18 @@ class LimitsRange(TypedDict): class Limits(TypedDict): """ - Epics limits: + Epics and tango limits: see 3.4.1 https://epics.anl.gov/base/R3-14/12-docs/AppDevGuide/node4.html + and + https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html """ control: NotRequired[Annotated[LimitsRange, Field(description="Control limits.")]] display: NotRequired[Annotated[LimitsRange, Field(description="Display limits.")]] warning: NotRequired[Annotated[LimitsRange, Field(description="Warning limits.")]] alarm: NotRequired[Annotated[LimitsRange, Field(description="Alarm limits.")]] + hysteresis: NotRequired[Annotated[float, Field(description="Hysteresis.")]] + rds: NotRequired[Annotated[RdsRange, Field(description="RDS parameters.")]] _ConstrainedDtype = Annotated[ diff --git a/src/event_model/schemas/event_descriptor.json b/src/event_model/schemas/event_descriptor.json index ea7ef71ed..02338d088 100644 --- a/src/event_model/schemas/event_descriptor.json +++ b/src/event_model/schemas/event_descriptor.json @@ -150,7 +150,7 @@ }, "Limits": { "title": "Limits", - "description": "Epics limits:\nsee 3.4.1 https://epics.anl.gov/base/R3-14/12-docs/AppDevGuide/node4.html", + "description": "Epics and tango limits:\nsee 3.4.1 https://epics.anl.gov/base/R3-14/12-docs/AppDevGuide/node4.html\nand\nhttps://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html", "type": "object", "properties": { "alarm": { @@ -165,6 +165,15 @@ "description": "Display limits.", "$ref": "#/$defs/LimitsRange" }, + "hysteresis": { + "title": "Hysteresis", + "description": "Hysteresis.", + "type": "number" + }, + "rds": { + "description": "RDS parameters.", + "$ref": "#/$defs/RdsRange" + }, "warning": { "description": "Warning limits.", "$ref": "#/$defs/LimitsRange" @@ -224,6 +233,26 @@ } } }, + "RdsRange": { + "title": "RdsRange", + "description": "RDS (Read different than set) parameters range.\n\n\nhttps://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html#the-read-different-than-set-rds-alarm", + "type": "object", + "properties": { + "time_difference": { + "title": "Time Difference", + "description": "ms since last update to fail after if set point and read point are not within `value_difference` of each other.", + "type": "number" + }, + "value_difference": { + "title": "Value Difference", + "description": "Allowed difference in value between set point and read point after `time_difference`.", + "type": "number" + } + }, + "required": [ + "time_difference" + ] + }, "DataType": { "title": "DataType", "patternProperties": {