EPICS Home

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  2016  <20172018  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  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How to define a global variable and global array in python script for a widget of Control system studio (CSS) ?
From: Anton Derbenev <[email protected]>
To: lzf neu <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Sun, 29 Oct 2017 22:17:13 -0400
Hello Zhefu,

how about using a local PV to store the value? This would also give you the possibility to show it on your page, if needed. You can put local PV as an input for your script, e.g.:

loc://$(DID)_my_x(0)

implying that this possibility didn't change since I last checked...

Anton.

On Sun, Oct 29, 2017 at 10:33 AM, lzf neu <[email protected]> wrote:

Hi,

 

I want to add up a variable by 1 each time when PV are triggered and print the result in CSS terminal.


I try to define a variable x in python script as the following lines:


from org.csstudio.opibuilder.scriptUtil import PVUtil
x=0
x=x+1
print x


However, the results in CSS terminal are always print 1. And not 2, 3, 4, 5, 6, ....each time that I hope.


I have no idea how to define a global variable and a global array in python script for a widget of Control system studio (CSS), so that I can preserve the data each time.


Any help will be appreciated and thanks in advance !


Zhefu




Replies:
答复: How to define a global variable and global array in python script for a widget of Control system studio (CSS) ? lzf neu

Navigate by Date:
Prev: How to define a global variable and global array in python script for a widget of Control system studio (CSS) ? lzf neu
Next: Re: RTEMS+zoneset seems to be broken Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: How to define a global variable and global array in python script for a widget of Control system studio (CSS) ? lzf neu
Next: 答复: How to define a global variable and global array in python script for a widget of Control system studio (CSS) ? lzf neu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024