Hello Abdalla:
> On Aug 14, 2016, at 3:12 AM, Abdalla Ahmad <[email protected]> wrote:
> Using the local variables as input PV to the script makes the PV has a null value. Even setting it inside the script makes no difference. If I use the local PV name inside the X/Y PV properties of the XY graph and using this for example in the script's input PVs:
>
> Loc://x(0,10)
> Loc://y(0,10)
>
> A trace appears on the graph, but still changing the PV values inside the script makes no difference.
>
> For more info, I will receive 4096-item array from a PV and need to process them all then display them on the graph.
You should not do any processing in a UI script.
All processing should be done on the IOC side, and the UI simply displays the result.
Processing arrays in a script on the UI thread would be the worst possible solution as far as performance is concerned.
To process arrays in the IOC, look at the aCalcout record, or use the aSub (formerly known as genSub) record.
One example where using local array PVs might make sense is to add “markers” to a display.
I have one example where a script receives a scalar “center” PV and updates local PVs loc://center_x(0, 0) and loc://center_y(0, 0).
The XY graph then shows a “trace" with X=loc://center_x(0, 0) and Y=loc://center_y(0, 0), i.e. it shows a 2-point line somewhat in the graph to indicate the center of something.
The script sets the array PVs like this:
# pvs[0]: Scalar input
# pvs[1]: 'x' waveform for marker
# pvs[2]: 'y' waveform for markers
from org.csstudio.opibuilder.scriptUtil import PVUtil
from jarray import array
c = PVUtil.getDouble(pvs[0])
.. somehow compute the the points (x1, y1) and (x2, y2)
pvs[1].setValue(array([ x1, x2 ], 'd'))
pvs[2].setValue(array([ y1, y2 ], 'd’))
Note that jarray.array is used to create a java array which is then written to the PV.
So this is an example which shows that you can update local array PVs from a script, but this is only meant for short PVs that update infrequently and are used to highlight something in the display. It’s not meant as an example for doing data processing in the UI.
-Kay
- References:
- Re: Drawing on XY graph widget without the use of a PV in CSS Márcio Paduan Donadio
- RE: Drawing on XY graph widget without the use of a PV in CSS Abdalla Ahmad
- Re: Drawing on XY graph widget without the use of a PV in CSS Pearson, Matthew R.
- Re: Drawing on XY graph widget without the use of a PV in CSS Kasemir, Kay
- RE: Drawing on XY graph widget without the use of a PV in CSS Abdalla Ahmad
- Navigate by Date:
- Prev:
Re: Question about data display in css boy opi databrowser Kasemir, Kay
- Next:
Re: Paramveer Jain
- 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
- Navigate by Thread:
- Prev:
RE: Drawing on XY graph widget without the use of a PV in CSS Abdalla Ahmad
- Next:
Pilatus AD 2-4 errors Miceli, Antonino
- 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
|