EPICS Controls Argonne National Laboratory

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

Subject: Re: 回复: Re: question about pcaspy
From: Wang Xiaoqiang <[email protected]>
To: Silver <[email protected]>, tech-talk <[email protected]>
Date: Mon, 29 Aug 2016 15:35:41 +0200
Hi,

Yes. The scan value can be arbitrary, and each PV has its own scan thread.

If you have many PVs to poll, you can instead poll them sequentially in a thread.

	def __init__(self):
            Driver.__init__(self)
            tid = threading.Thread(target=self.poll)
            tid.setDaemon(true)
            tid.start()

        def poll(self):
            # get values from the device
            <<get value1>
            <<get value2>
            <<get value3>
            # set to the pv database
            self.setParam("value1", value1)
            self.setParam("value2", value2)
            self.setParam("value3", value3)
            # post the monitor event
            self.updatePVs()

Then you don't need to set the scan field, and omit the read method.
Such an example is here https://github.com/paulscherrerinstitute/pcaspy/blob/master/example/simscope.py. It runs a simulation task and publish the results periodically.

On 08/29/2016 02:22 PM, Silver wrote:
hi, xiaoqiang:

Thanks a lot for your letter. In fact, pcaspy is very convinent and
helpful for me, thanks for your work.

I have another question, can scan field be set to a arbitrary value such
as 0.001? If it can work, corresponding, the server.process(0.01) will
be set instead of server.process(0.1)?


------------------------------------------------------------------------
Best wishes
Geyang 2016-08-29

    *发件人:* Wang Xiaoqiang <mailto:[email protected]>
    *发送时间:* 2016-08-29 15:34
    *收件人:* geyang <mailto:[email protected]>; tech-talk
    <mailto:[email protected]>
    *主题:* Re: question about pcaspy
    Hi,
    According to
    http://www.aps.anl.gov/epics/base/R3-14/12-docs/CAref.html#Configurin2,
    you can set EPICS_CAS_SERVER_PORT
    # on the server side
    $ export EPICS_CAS_SERVER_PORT=5078
    $ python dummy.py
    # on the client side
    $ export EPICS_CA_SERVER_PORT=5078
    $ caget MTEST:RAND
    MTEST:RAND 0.000 (SEVR:INVALID STAT:UDF)
    But if the same driver is instantiated for many devices, you can create
    the database with different prefixes.
    if __name__ == '__main__':
          ...
          prefix = sys.argv[1]
          server.createPV(prefix, pvdb)
          ...
    Then to run the server for each device
    $ python dummy MTEST1:
    $ python dummy MTEST2:
    Best
    Xiaoqiang
    On 08/28/2016 02:45 AM, geyang wrote:
     > hi,
     >
     >    I would like to ask if  SimpleServer's port can be changed to
    others
     > in code, such as 5066/5068? For example, I have a device driver
    written
     > by pcaspy, I want to implement the same driver for many same type
     > devices on one machine, then I need to set them different server
    ports.
     >    thanks a lot for your help.
     >
     >
     > Best wishes
     > Geyang 2016/8/28
     >
     >
     >


References:
question about pcaspy geyang
Re: question about pcaspy Wang Xiaoqiang
回复: Re: question about pcaspy Silver

Navigate by Date:
Prev: Re: question about pcaspy Ralph Lange
Next: Re: OSI error messages with VxWorks 6.9.4.1 Ron Sluiter
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: 回复: Re: question about pcaspy Silver
Next: Re: question about pcaspy Kasemir, Kay
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 29 Aug 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·