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 (CS
From: Anton Derbenev <[email protected]>
To: "Kasemir, Kay" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 30 Oct 2017 13:47:29 -0400
Zhefu,

as Kay pointed out, the documentation describes some common use-cases for PVs in scripts. If the PV approach works for you, however, you might consider implementing the desired logic in your IOC instead. It is easily done on database level (e.g. with calc record). In this case you won't have to deal with OPI scripts.

Anton.

On Mon, Oct 30, 2017 at 8:49 AM, Kasemir, Kay <[email protected]> wrote:

Hi:


This is how you read:

> data="">)


This is _not_ how you write, since you obviously can't assign anything to the number returned by getDouble():
> PVUtil.getDouble(pvs[1])=data

> However, the error occurs:
> SyntaxError:("can't assign to function call", ('<script>',3,0, 'PVUtil.getDouble(pvs[0])=value\n'))

This is how you would write:
pvs[1].setValue(data)


If you want to use scripts, it might be a good idea to study the example scripts in BOY Examples/scripts, where "setValue" is used a couple of times.
Or read the online help:
CSS Applications, Displays, BOY, Script, Access PV, "2. Write PV Value" introduces PV.setValue.

-Kay


Navigate by Date:
Prev: Re: streamdevice and AD driver in same IOC Hinko Kocevar
Next: Re: RTEMS+zoneset seems to be broken Matt Rippa
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: Re: streamdevice and AD driver in same IOC Hinko Kocevar
Next: Crosscompiling EPICS for ARM Arch - zedboard : Error 윤대희
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