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 2021 2022 2023 2024 2025 | 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 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Archive Viewer problems using formulae in correlation plots |
From: | "Singleton, SJ \(Steve\)" <[email protected]> |
To: | <[email protected]> |
Cc: | <[email protected]> |
Date: | Thu, 9 Mar 2006 10:51:17 -0000 |
Hello Sergei
We have a requirement from our vacuum group here at Diamond Light Source to be able to produce plots of dynamic pressure against integrated beam current, where dynamic pressure is defined as
(P – P0) / I
P is current pressure P0 is pressure at zero beam current I is beam current
and integrated beam current (IINT) is the total beam current since first beam in the storage ring.
These plots need to be able to cover long periods – months or years.
The correlation plot and formula facilities within archiveviewer seem ideally fitted to this requirement, and I have been testing using a simulation (our storage ring is still under construction). I have created simulated EPICS PVs for P, P0, I and IINT and set up the Channel Archiver to archive them every 10 seconds, then tried to set up an archive viewer plot, but have encountered several problems.
Firstly, during shutdowns or when beam is lost, (P – P0) / I = 0 / 0, i.e. undefined. I therefore decided to plot the conditional _expression_
(I < IMIN) ? 0 : (P – P0) / I
… unfortunately the formula facility did not permit conditional expressions using ? and : , so I made modifications to the code to provide this. (If these modifications are of interest to you, I will gladly provide you with the source code once I have finalised it.)
Secondly I found that the default domain PV for correlation plots, which the documentation says is the first PV in the list, seems actually to be the last. I made a modification to my archiveviewer to make it correspond to the documentation.
Thirdly, the pressure at zero beam current (P0) can only be determined when there is zero beam current, so when the machine is running this PV remains set to the last value. (In my simulation it is set to a constant.) I found that I could plot my _expression_ against time, but if I tried to do a correlation plot against IINT it failed. Digging in the code of archiveviewer, I found that for a time plot the viewer uses the archive retrieve methods “linear” and “plot binning” which cope OK with a PV that does not change, but for a correlation plot it uses the archiver retrieve method “average” which does not seem able to retrieve values for P0. In order to proceed, I made a temporary modification to the archive viewer to force it to use the ‘linear’ method (which meets the requirement for aligned time stamps) for correlation plots.
Having done the above, my plot started to work sometimes. On other occasions, though, I get the message
Couldn’t create dataset for AV entry formula0#TS-DI-IOC-01
with the explanation
java.lang IllegalArgumentException: Number of values from domain and range do not match. Do graphs come from different archives?
I looked further at the archiveviewer code and found that (in UseCases.java) the archive viewer performs two separate retrievals of data from the Channel Archiver, one to provide values for the PVs to be used to calculate formulae, and another to provide the values for PVs to be plotted directly. These two retrievals are for the same specified number of values and time span, and usually but not always return the same number of values; it is when they do not I get an error.
I have identified two definite cases when these two calls do not return the same number of values:
1. When the specified start time for the plot corresponds to a time when the archiver was not running. In this case, at the time, a number of values are returned for each set of PVs for times separated by a few microseconds close to the time the archiver started up; the number of these values differs between the two data sets. I made yet another experimental modification to make the archive viewer discard values whose time is separated from the previous time by only a few microseconds; the change made this problem go away.
2. When the specified end time for the plot is “now” different sets of values are sometimes returned for the last few seconds of the plot period. This problem can be avoided by setting the end time for the plot to -1m (i.e. 1 minute before the present time.)
With these changes made, my plot now works most of the time; however, I still occasionally get occurrences of the error message described above.
I would be interested to hear whether any other people have tried using formula and correlation plot facilities of archiveviewer, and if so, of their experiences with these features.
Steve Singleton
|