EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Problems configuring alarms with PvaPy
From: KRL Baker - STFC UKRI via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 7 Jun 2021 13:20:24 +0000

Hello Tech-Talk,

 

I am working with PvaPy to create and update some PVs and am trying to work out how to configure the alarms for the pv.

 

I have created the object using the code below, which creates the ‘counter’ pv and updates the values (which I can see with a pvmonitor or a pvinfo).

 

         initial_time = time.time()

    seconds, nanoseconds = extract_seconds_and_nanoseconds_from_timestamp(initial_time)

    timestamp = PvTimeStamp(seconds, nanoseconds, 0)

 

    # configure display values

    display = PvDisplay(0, 10, 'Test Display', 'Test Format', 'units')

 

    # set up alarm - severity (0=NO_ALARM, 1=MINOR, 2=MAJOR, 3=INVALID, 4=UNDEFINED), status, message

    alarm = PvAlarm()

    alarm.setSeverity(0)

    alarm.setMessage('test alarm message')

 

    alarm_values = PvValueAlarm(FLOAT)

 

    alarm_values.setHighAlarmLimit(9)

    alarm_values.setLowAlarmLimit(2)

    alarm_values.setHighWarningLimit(8)

    alarm_values.setLowWarningLimit(3)

 

    alarm_values.setHighAlarmSeverity(2)

    alarm_values.setLowAlarmSeverity(2)

    alarm_values.setHighWarningSeverity(1)

    alarm_values.setLowWarningSeverity(1)

    alarm_values.setActive(True)

 

    pv = PvObject({

        'value': FLOAT,

        'timeStamp': timestamp,

        'display': display,

        'alarm': alarm,

        'alarm_values': alarm_values

    }, {

        'timeStamp': timestamp.toDict(),

        'display': display.toDict(),

        'alarm': alarm.toDict(),

        'alarm_values': alarm_values.toDict()

    })

 

    server = PvaServer()

    server.addRecord('counter', pv)

    c = 0

    startTime = time.time()

    try:

        while True:

            time.sleep(1)

            if c == 11:

                c = 0

            seconds, nanoseconds = extract_seconds_and_nanoseconds_from_timestamp(time.time())

            epics_message = {

                'value': c,

                'timeStamp': {

                    'secondsPastEpoch': seconds,

                    'nanoseconds': nanoseconds

                }

            }

            pv.set(epics_message)

            c += 0.5

    finally:

        server.stop()

 

 

This creates a PV with the following structure:

    float value 10.5

    time_t timeStamp 2021-06-07 13:31:45.733

        long secondsPastEpoch 1623069105

        int nanoseconds 732768297

        int userTag 0

    display_t display

        double limitLow 0

        double limitHigh 10

        string description "Test Display"

        string format "Test Format"

        string units units

    alarm_t alarm

        int severity 0

        int status 0

        string message "test alarm message"

    valueAlarm_t alarm_values

       boolean active true

        float lowAlarmLimit 2

        float lowWarningLimit 3

        float highWarningLimit 8

        float highAlarmLimit 9

        int lowAlarmSeverity 2

        int lowWarningSeverity 1

        int highWarningSeverity 1

        int highAlarmSeverity 2

        byte hysteresis 0

 

As you can hopefully see from the code, I have set up the alarms with severity 0 (NO_ALARM) to begin with and set the severity of the warnings and limits to be MINOR and MAJOR (2 and 3).

 

However, using this set-up I would expect to see the alarm messages raised when the value of the PV approaches 0 or 10, but no alarm messages are displayed. The only time I am able to see messages is if I set the severity of the alarm object to be something other than 0, but this then raises alarm messages for all value states which is not the desired behaviour.

 

Is there something that I’m missing in the configuration of the alarms? Is there something that I need to set to ‘activate’ the logic behind the alarms?

 

Kathryn Baker (she/her)

Software Development for Accelerator Control Systems Graduate

Science and Technology Facilities Council

k.baker at stfc.ac.uk

 

This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. Opinions, conclusions or other information in this message and attachments that are not related directly to UKRI business are solely those of the author and do not represent the views of UKRI.


Replies:
Re: Problems configuring alarms with PvaPy Veseli, Sinisa via Tech-talk

Navigate by Date:
Prev: Re: using autosave, iocInit hangs Heinz Junkes via Tech-talk
Next: Re: Problems configuring alarms with PvaPy Veseli, Sinisa via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: arv-tool-0.8 with FLIR-Blackfly camera Mark Rivers via Tech-talk
Next: Re: Problems configuring alarms with PvaPy Veseli, Sinisa via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 07 Jun 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·