Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tango RDS alarm parameters and EPICS v4 hysteresis #339

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading