DiamondLightSource / pythonSoftIOC

Embed an EPICS IOC in a Python process
Apache License 2.0
31 stars 9 forks source link

Enable setting alarm status of Out records #157

Closed AlexanderWells-diamond closed 5 months ago

AlexanderWells-diamond commented 5 months ago

Adds the set_alarm method to ProcessDeviceSupportOut, along with extra keyword arguments to set. As these are keyword args with defaults, there should be no compatibility problems.

Tests added to check calling set_alarm() before or after IocInit() causes the severity and status attributes to be set as expected.

Closes #53.

github-actions[bot] commented 5 months ago

Unit Test Results

     12 files  ±  0       12 suites  ±0   22m 13s :stopwatch: + 1m 14s    284 tests +  5     268 :heavy_check_mark: +  5    16 :zzz: ±0  0 :x: ±0  3 408 runs  +60  2 924 :heavy_check_mark: +52  484 :zzz: +8  0 :x: ±0 

Results for commit 4388c69c. ± Comparison against base commit 7babcdeb.

:recycle: This comment has been updated with latest results.

AlexanderWells-diamond commented 5 months ago

I've done a few more tweaks, and changed the default Status value to NO_ALARM, which is technically a breaking change we may need to highlight (although maybe not as a non-zero STAT is fairly meaningless with a SEVR of 0)

I have found one problem: Trying to set STAT and SEVR using the EPICS attribute names during record declaration doesn't work i.e.:

ai = builder.aIn('AI', SEVR="MINOR", STAT="HIHI")
ao = builder.aOut('AO', SEVR="MINOR", STAT="HIHI")

The records created here will not respect these SEVR and STAT values:

$ caget -a AI
MY-DEVICE-PREFIX:AI            2024-04-08 14:04:54.829984 0  
$ caget -a MY-DEVICE-PREFIX:AO
MY-DEVICE-PREFIX:AO            2024-04-08 14:04:54.328884 0 UDF INVALID

I believe this has never worked; they are passed to the epicsdbbuilder (as proven by giving invalid values producing an error message), but for reasons unknown at this time they are gone after record initialization.

Is it worth trying to support these keywords properly?

Araneidae commented 5 months ago

I suspect that SEVR and STAT aren't supposed to be set directly, but am not sure.