Skip to content

Commit

Permalink
added tango RDS alarm parameters and EPICS v4 hysteresis
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Dec 11, 2024
1 parent f63fbb4 commit d8f3ad1
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
35 changes: 34 additions & 1 deletion src/event_model/documents/event_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,54 @@
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]


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[
Expand Down
31 changes: 30 additions & 1 deletion src/event_model/schemas/event_descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit d8f3ad1

Please sign in to comment.