DiamondLightSource / pythonSoftIOC

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

Allow int64 datatype #160

Closed evalott100 closed 3 months ago

evalott100 commented 4 months ago

In pandablocks, SEQ:REPEATS is a uint32, but since int64 isn't an option on softioc, we set it to an analogue out with a precision of 0. This means in ophyd async we had to allow for an epics float to be regarded as an int in this special case.

https://github.com/bluesky/ophyd-async/pull/276#issuecomment-2090210564

I've decided that this is probably not where the fix should be, ophyd should trust the epics datatype. With this in mind, we should add functions for int64 in/out in builder.py for use in pandablocks-ioc. https://epics.anl.gov/base/R7-0/6-docs/int64outRecord.html

AlexanderWells-diamond commented 4 months ago

This is effectively asking for int64 support via the new EPICS 7 64bit record types - see issue #118 for some others we could also add while we're there

evalott100 commented 4 months ago

Did some debugging to narrow down exactly where our P4P error is happening: We're expecting a different type on the value field.

initial_values[pv].type()

# returns
Type([
    ('value', 'd'),   # HERE we should have ('value', 'I') or ('value', 'l')
    ('alarm', (
        'S', 
        'alarm_t', 
        [
            ('severity', 'i'), 
            ('status', 'i'), 
            ('message', 's')
        ]
    )), 
    ('timeStamp', (
        'S', 
        'time_t', 
        [
            ('secondsPastEpoch', 'l'), 
            ('nanoseconds', 'i'), 
            ('userTag', 'i')
        ]
    )), 
    ('display', (
        'S', 
        'structure', 
        [
            ('limitLow', 'd'), 
            ('limitHigh', 'd'), 
            ('description', 's'), 
            ('units', 's'), 
            ('precision', 'i'), 
            ('form', (
                'S', 
                'enum_t', 
                [
                    ('index', 'i'), 
                    ('choices', 'as')
                ]
            ))
        ]
    )), 
    ('control', (
        'S', 
        'structure', 
        [
            ('limitLow', 'd'), 
            ('limitHigh', 'd'), 
            ('minStep', 'd')
        ]
    )), 
    ('valueAlarm', (
        'S', 
        'structure', 
        [
            ('active', '?'), 
            ('lowAlarmLimit', 'd'), 
            ('lowWarningLimit', 'd'), 
            ('highWarningLimit', 'd'), 
            ('highAlarmLimit', 'd'), 
            ('lowAlarmSeverity', 'i'), 
            ('lowWarningSeverity', 'i'), 
            ('highWarningSeverity', 'i'), 
            ('highAlarmSeverity', 'i'), 
            ('hysteresis', 'd')
        ]
    ))
], id="epics:nt/NTScalar:1.0")