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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS device disconnects and reconnects
From: Kate Feng <[email protected]>
To: [email protected], [email protected]
Date: Tue, 17 Sep 2013 14:26:04 -0400
Hi all,

   I wish to add more technical information on what I posted on Fri., July 26
at http://www.aps.anl.gov/epics/tech-talk/2013/msg01529.php
because technical discussions should be posted at [email protected]
to inform the author and users.

As one can see from the E-mail below, which I wrote on 07/19/2013 11:03 AM, I have
originally proposed:

> B)  For the camera's input records, the I/O interrupts should be called in the driver's
>     connection callback function to process them so that the alarm status will be updated
>     on those input record.

However, on Fri., 19 Jul 2013 16:12:21 -0400, one replied to me :
> Posting an EVENT would be the appropriate solution for I/O Interrupt scanned records,

Did I miss something ?  How could that be appropriate ? Does one meant to say I/O interrupt
event ? If so, it is the same as what I proposed originally in B).  My understanding is that I/O Interrupt
scanned records are not activated by post_event(). If one prefers to solve it via database, a better
alternative is to incorporate an EVENT post with the fanout/forward links. The solution was presented in
ADBase.template.diff at http://www.aps.anl.gov/epics/tech-talk/2013/msg01529.php

Regarding the output records, originally I have proposed to add the linked list at the IOC
level because on 6/11/13, Mark Rivers discussed offline about the option of reconnecting a camera of
a different model. This is possible because one can easily modify the IP address or the ID of a different
camera in model to match with that of the corresponding ASYN records.  In that case, it would be on the
safe side to set the values of the output records to match the new values of the camera. 

On 6/11/13, I replied:
> Regarding when the camera is reconnected, I think that the software should detect if it is the same camera model.

BTW, the patch I proposed on Fri., July 26 is a prototype I wrote to quickly carry out the concept I have
proposed so far among the IOC level, database, and GUI.  I understand that ASYN drivers have its own software
structure that only the devEpics/* should handle the EPICS record. However, the software structure can be
fine-tuned once the prototype is written and tested successfully.

In conclusion, what I have proposed via the IOC level (and possibly via the database) would have appropriately fix
the application to reflect connection issues. Every record that connects to the device will have an alarm severity
of invalid and will show the status in the display.  See disconnected.jpeg from
http://www.aps.anl.gov/epics/tech-talk/2013/msg01529.php

Best,
Kate Feng

*************************************************************************************************************

-------- Original Message --------
Subject:     Re: clear statement that the two camera solution was accepted
Date:     Fri, 19 Jul 2013 11:03:02 -0400
From:     Kate Feng <[email protected]>
To:     Dalesio, Leo <[email protected]>

Hi Bob,

    Thank you for your follow-up note.  Attached is the updated document, which I have added
the section VII) for the conclusion. I will send Mark Rivers the following :

A) At NSLS2, we have decided that at the reconnection/disconnection of the cameras,
the values of all the records should be processed to be the same as what was set
previously by EPICS users before the camera was disconnected. By doing so, the alarm
status of the records will be updated, too. One exception is that the 'Acquire' (i.e. busy)
record should always be reset to be 0 (i.e. off) at the reconnection/disconnection. This
can be achieved either

  1. by creating an event-driven binary input (i.e. bi) record, which will read
the status of the camera's connection/reconnection (i.e. AsynIO.CNCT), when the event is generated
in the driver's connection callback function. Via this bi record, the EPICS fanout records can forward
the processing link to the camera's corresponding output records. The driver should reset the value of
all the busy records (e.g. the 'Acquire' record for the cameras) to be 0 before the event was generated
when the camera is disconnected or reconnected.

 or
  
 2. by keeping a link list of pointers to all the record that need to be processed at
    disconnection/reconnection, and call 'dbpf' to process them in the driver's connection callback function.
    The driver should reset the value of all the busy records (e.g. the 'Acquire' record for the cameras) to
    be 0 .

B)  For the camera's input records, the I/O interrupts should be called in the driver's
    connection callback function to process them so that the alarm status will be updated
    on those input record.

C) To be precise and be consistent with other ASYN software written in asyn4-21/asyn/devEpics/*.c,
the busy record (e.g. for the Acquire on/off record) should set EPICS alarm status to be “COMM”
instead of WRITE_ALARM, when the device is disconnected. The ASYN ao, asynFloat64, bo, lo,
and mbbo records written in the directory asyn4-21/asyn/devEpics ( see devAsynInt32.c and
devAsynFloat64.c)
sets the EPICS alarm severity to be “Invalid” and the EPICS alarm status to be “COMM”, which
are correct actions.

D) The 'Acquire' record at ADBase.template should be set as 'PINI=YES' and 'VAL=0' to set the
camera in a known state (i.e. 'off' state).


E) To whiten the rectangular box, a new devConnected Boolean variable can be added in the
GUI manager (e.g. MEDM) to monitor the connection of the ASYN device. If the STAT field of
an EPICS record is changed to be epicsAlarmComm, then pr->devConnected is set to 0, and
pr->updateValueCb will be called to draw white rectangular boxes on the device's records.

Sincerely,
Kate Feng



On Fri, Jul 26, 2013 at 1:36 AM, Kate Feng <[email protected]> wrote:
Hi Mark,

Mark Rivers wrote:
> We have set the alarm status of the record to the most appropriate value based on the limited
> choices offered by EPICS.

  In response to your message to me at
http://www.aps.anl.gov/epics/tech-talk/2013/msg01262.php,
My response for that is listed at B).

I would like to contribute what I had developed in the past few weeks
regarding the disconnection/reconnection of the cameras.  The two objectives
are 1) to whiten the rectangular boxes of the ASYN output records on the GUI
screen when the ASYN device is disconnected, and 2) to process the value
of the EPICS records to match the corresponding parameters setup of the
device at reconnection of the cameras.

  Please CC the response to [email protected] because my E-mail
address is changed and the new one is not updated for the subscription yet.

 A) There were two options being considered for the response of disconnection/reconnection:

 Option 1) : See the attached patch prosilica.template.diff and ADBase.template.diff for the change in the record files.

 To modify mainly the record (i.e. database) file link, and run
post_event(eventNumber) in the
 prosilica::cameraLinkCallback() of prosilica.cpp file when the camera is found.
 The driver should reset the value of all the busy records (e.g. the 'Acquire'
 record for the cameras) to be 0 before the event was generated when the
 camera is disconnected or reconnected.

 The event number for each camera can be specified via prosilicaConfig() and
st.cmd. This method will trigger the processing of the output records.
 For the readbacks, the SCAN type is changed to 'Passive' and will be
processed if its associated output records are processed.  This works very well.  It is the same method as what I did at NSLS for the RTEMS firewire camera device driver, of which software is posted at
 https://sourceforge.net/projects/rtemsfirewirecameradriver/files/?source=navbar
 for one's reference.

   This method works well if one wishes to restore the value of the records to
what were  set by EPICS users prio to the disconnection of the cameras.  However, for other ASYN  devices, their associated record files need to be
modified as well.

 Option 2) :  The attached cam.diff is the patch for your reference, which I had developed for this option.

   To modify the source code by creating a link list of pointers to all the output
records that need to be processed at disconnection/reconnection, and
call 'dbpf' to process them in the driver's connection callback function
(i.e.  prosilica::cameraLinkCallback() ). The
driver should reset the value of all the busy records (e.g. the 'Acquire' record for the cameras) to be 0. The readback records should be changed to be what is
similar to the attached prosilica.template.diff and ADBase.template.diff.  In this case, the fanout records will not be needed. Only the FLNK links for each
readbacks are needed.

   The attached cam.diff is the patch for your reference, which I had developed
for this option. Only the ASYN ao, asynFloat64, bo, lo, and mbbo records were
modified for this purpose. I did not change the code for the waveform record or finish the development for this option because I was not sure if you wish to
pursuit this option. The prosilica.cpp file is modified based on the file, which
you committed the change to SVN, as per your E-mail reply at http://www.aps.anl.gov/epics/tech-talk/2013/msg01220.php.

   I would recommend a change to the patch that the dbpf() command
should set the .PROC field to be 1 if one wishes
to restore the value of the records to what were set by EPICS users before the
disconnection of the cameras. One exception is that the 'Acquire' (i.e. busy)
record should always be reset to be 0 (i.e. off) at the reconnection/disconnection.

   The advantage of this option is that once the software is fully developed,
there is no need to change the record files for the output records.  However, the SCAN field of the input records should be set as 'Passive'  and be triggered
via its associated output records. 

B) To be precise and be consistent with other ASYN software written in
asyn4-21/asyn/devEpics/*.c, the busy record (e.g. for the Acquire on/off record)
should set EPICS alarm status to be “COMM” instead of WRITE_ALARM, when the device is disconnected. The ASYN ao, asynFloat64, bo, lo, and mbbo records written in the directory asyn4-21/asyn/devEpics (see devAsynInt32.c and devAsynFloat64.c) set the EPICS alarm severity to be “Invalid” and the EPICS alarm status to be “COMM”, which are correct actions.

C) The 'Acquire' record at ADBase.template should be set as 'PINI=YES' and 'VAL=0' to set the camera in a known state (i.e. 'off' state) when the IOC is started.

D) To whiten the rectangular box, a new devConnected Boolean variable can be
added in the GUI manager (e.g. MEDM) to monitor the connection of the
ASYN device. If the STAT field of an EPICS record is changed to be epicsAlarmComm, then pr->devConnected is set to 0, and
pr->updateValueCb will be called to draw white rectangular boxes on the
device's records.

See the attached patch medm3_1_6.diff file is for your reference.

E) disconnected.jpeg is the result of the image when the camera is disconnected.

   Hope that it helps.

   Sincerely,
   Kate Feng




References:
RE: EPICS device disconnects and reconnects Kate Feng

Navigate by Date:
Prev: Re: Newport 8742 motor controller driver Pearson, Matthew R.
Next: PiezoSytemJena motorcontroller driver problems Ivashkevych, Oksana
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: EPICS device disconnects and reconnects Kate Feng
Next: flink Sebastian Matkovich
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·