How to get updated PV value in script

88 views
Skip to first unread message

Amien Crombie

unread,
Apr 10, 2014, 7:35:35 AM4/10/14
to css...@googlegroups.com
Hi Xihui

If you maybe can help me with script below...

Amien



# This is my Python script file called 'setOffsets.py'


from org.csstudio.opibuilder.scriptUtil import PVUtil, ScriptUtil
from java.lang import Thread, Runnable
from org.eclipse.jface.dialogs import MessageDialog

# I have 10 PV's nl pvs[0] = my RAW value, pvs[1] my RANGE value
# then I have pvs[2]..pvs[9] for my 8 OffsetValues
# I have enabled 1 trigger on pvs[1] = my RANGE
# In short I'm saving my offsets for each RANGE

value = PVUtil.getLong(pvs[0])     #  get value of RAWValue
irange = PVUtil.getLong(pvs[1])    #  get value of RANGE

ty=display.getWidget("ty")
tz=display.getWidget("tz")
tp=display.getWidget("tp")

ty.setPropertyValue("text",value)   # my problem here !!!  value not updated with RANGE change. It only changes with the next RANGE trigger
tp.setPropertyValue("text",irange)  # the irange change as RANGE changes normally

t = irange + 1
tz.setPropertyValue("text",t)

# here I need to update the pvs[range+1] with the RAWvalue
pvs[t].setValue(value)             

# the value is the previous RANGE'value. I have a test whereby RANGE 1 returns 120 and RANGE 2 returns 720
# but when I'm on RANGE 1, i get the value 720 and
# on RANGE 2 I get 120
# so it looks like my 'value' is not current updated until I change to next range
Reply all
Reply to author
Forward
0 new messages