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  <20162017  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  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: CSS Boy Write PVs to file
From: Iain Marcuson <[email protected]>
To: "[email protected]" <[email protected]>
Date: Thu, 22 Sep 2016 13:33:57 +0000

 

 

This means waiting a little
should fix your problem:

pv = PVUtil.createPV(widget.getPV)
time.sleep(0.1)
value = PVUtil.getDouble(pv)

 

Waiting three seconds solved the problem and I can now access the PVs.

 

The PV needs to connect. If you get the value right away, you’ll receive a null because the PV has not connected and not received the initial value, yet.

 

Waiting via a delay will often be sufficient, but

a) You should not wait within the script, i.e. on the UI thread, because otherwise you’ll next ask:

    Why does all of CSS freeze while my script is sleeping?

b) Sometimes you need to wait 3 seconds instead of 0.1.

    Better would be to add a listener to the PV which gets notified as values arrive.

 

A file dialog box is part of the process, so I may be able to have the wait conducted in the background while the user selects a file.

 

Thank you for the help.


References:
Re: CSS Boy Write PVs to file Konrad, Martin
Re: CSS Boy Write PVs to file Kasemir, Kay

Navigate by Date:
Prev: Re: CSS Boy Write PVs to file Konrad, Martin
Next: RE: CSS Boy Write PVs to file Iain Marcuson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: CSS Boy Write PVs to file Mark Rivers
Next: Re: CSS Boy Write PVs to file Konrad, Martin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 22 Sep 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·