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  <20142015  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  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Monitoring whether an IP device is connected or not
From: David Michel <[email protected]>
To: "J. Lewis Muir" <[email protected]>
Cc: [email protected]
Date: Thu, 27 Feb 2014 11:26:41 +0000
> you could make the black box IOC have a record instance named "blackBox:heartbeat" which cycles periodically between 0 and 1 [...]  I suspect there's some way for the function to set a value (e.g. 0 for disconnected and 1 for connected) of one of the fields of the aSub record instance.

That's exactly what I was doing in fact :-) But I thought that it wasn't very elegant and maybe someone had thought of a better way, i.e. not using the ping program from the host.


> [...] if your existing IOC loses communication with the black box IOC, the longin record instance's STAT and SEVR fields will go to some value other than NO_ALARM, and you can detect this with another record[...]

Thanks for that. That's a good idea which I'll try straight away!

Cheers
David




---
Dr. David Michel
Address: 8 Viking Drive, Didcot, OX11 9RD, Oxfordshire
Mobile: 0789 670 98 01 - Home: 0123 581 46 93


On 26 February 2014 15:55, J. Lewis Muir <[email protected]> wrote:
On 2/25/14, 11:20 AM, David Michel wrote:
>> Depending on what platform your IOC is running, you could potentially
>> execute the platform's ping program from your C function.  This would
>> allow you to ping without running your IOC as root.
>
> That's exactly what I was doing. On Linux (Ubuntu).
>
>> if you can make a small change to your black box, is to run a simple
>> server on your black box that listens on a TCP or UDP port.  You
>> could then use asyn or StreamDevice on your IOC to send a tiny
>> request to that server.
>
> Yes, that could be an option - Similarly, I was thinking I could
> perhaps run an "dummy" IOC with a "dummy" record that is queried from
> the other IOC. This way, I can use the builtin PVExistTest routine
> that will notify the IOC and my OPI rather quickly and without much
> development effort.
>
> What I'm not sure of with this approach is how to turn the
> "disconnected" information into say a bi record with 1 for connected
> and 0 for disconnected ??

Hi, David.

If you're willing to install an IOC on your black box and your existing
IOC can communicate with it, then you could just have a record instance
on your existing IOC with a CA input link (i.e. Channel Access INLINK)
referencing a PV on your black box IOC.  For example, if on your
black box IOC you had a longout record instance named "blackBox:id",
you could have a longin record instance on your existing IOC named
"exisiting:idOfBlackBox" with its INP field set to "blackBox:id CP
NMS".  Now, if your existing IOC loses communication with the black box
IOC, the longin record instance's STAT and SEVR fields will go to some
value other than NO_ALARM, and you can detect this with another record
instance to make your bi record instance be 1 for connected and 0 for
disconnected.  Or you could just make your OPI observe the STAT or SEVR
fields of "existing:idOfBlackBox" and react accordingly.

If you wanted to be fancier, you could make the black box IOC have a
record instance named "blackBox:heartbeat" which cycles periodically
between 0 and 1.  Monitor that PV from your existing IOC and add logic
to detect when the black box heartbeat value does not change at the
expected interval.

If you want to stick with your approach of executing the ping program
from a C function, I suspect there's some way for the function to set
a value (e.g. 0 for disconnected and 1 for connected) of one of the
fields of the aSub record instance.  I've never used the aSub record,
though, so I couldn't say for sure without looking at the aSub record or
documentation.

Another approach that would work with your C function approach would
be to call your C function from an EPICS SNL program [1].  Based on
the return status of the C function, you could set an EPICS PV in the
SNL program to 0 or 1 using the pvPut function.  That would be pretty
straightforward.

Lewis

1. http://www-csr.bessy.de/control/SoftDist/sequencer/index.html


References:
Monitoring whether an IP device is connected or not David Michel
Re: Monitoring whether an IP device is connected or not J. Lewis Muir
Re: Monitoring whether an IP device is connected or not David Michel
Re: Monitoring whether an IP device is connected or not J. Lewis Muir

Navigate by Date:
Prev: Re: newline in IOCSH_PS1 value Eric Norum
Next: Re: Monitoring whether an IP device is connected or not David Michel
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Monitoring whether an IP device is connected or not J. Lewis Muir
Next: Re: Monitoring whether an IP device is connected or not Dohn Arms
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·