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: Mark Rivers <[email protected]>
To: "Kasemir, Kay" <[email protected]>, "Konrad, Martin" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Thu, 22 Sep 2016 11:39:14 +0000
> For example, check the sscan record for IOCs, http://www.aps.anl.gov/bcda/synApps/sscan/sscanRecord.html:
> You tell it to take data for some time, it uses data storage clients to write that to files.

One of the file writing clients it uses is called saveData, which can run in the same IOC as the sscan record.  It comes in the sscan module.  It saves data in binary "mda" files.  There are Python and IDL programs to display mda files and convert them to ASCII, etc.

http://cars9.uchicago.edu/software/idl/epics_sscan.html

Mark



________________________________
From: [email protected] [[email protected]] on behalf of Kasemir, Kay [[email protected]]
Sent: Thursday, September 22, 2016 6:18 AM
To: Konrad, Martin
Cc: [email protected]
Subject: Re: CSS Boy Write PVs to file

Hi:

On Sep 21, 2016, at 6:50 PM, Konrad, Martin <[email protected]<mailto:[email protected]>> wrote:
Hi Iain,
I wish to save some Process Variables to a CSV file, but I
cannot figure out the code to retrieve the values from the PVs into
Python.
I think the problem here is that createPV doesn't create the PV
immediately. It takes some time to happen (I guess due to inter-thread
synchronization in CS-Studio). My understanding of the documentation is
that the actual create happens at a rate of 50 Hz (queue run or
something similar in the receiving thread). This means waiting a little
should fix your problem:

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

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.

Overall, performing logic like data acquisition should not be handled in the user interface.
The user interface can start, stop, monitor the data accusation, but data acquisition needs to be performed by some service.
For example, check the sscan record for IOCs, http://www.aps.anl.gov/bcda/synApps/sscan/sscanRecord.html:
You tell it to take data for some time, it uses data storage clients to write that to files.

-Kay



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 Kasemir, Kay
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 
Navigate by Thread:
Prev: Re: CSS Boy Write PVs to file Kasemir, Kay
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 
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 ·