paulscherrerinstitute / pcaspy

Portable Channel Access Server in Python
BSD 3-Clause "New" or "Revised" License
32 stars 24 forks source link

Doubts about the max value for count #67

Closed leo-leao closed 3 years ago

leo-leao commented 4 years ago

Good Morning, I´m developing a software that needs a pvdb with a count value of 360.000. However, in my tests, when I put an array with 360.000 positions and get the values with epics.caget it´s reported "ChannelAccessGetFailure: Get failed; status code: 72" My code is this. Can somebody help me?``


from pcaspy import Driver, SimpleServer
import numpy as np

prefix = 'MTEST:'
pvdb = {
    'TEMP' : {
    'prec' : 3,
    'scan' : 1,
        'count': 360000,
     },
}

data = np.arange(0,360000)
print(data)

class myDriver(Driver):
    def __init__(self):
        super(myDriver, self).__init__()
        self.setParam('TEMP', data)

if __name__ == '__main__':
    server = SimpleServer()
    server.createPV(prefix, pvdb)
    driver = myDriver()

    # process CA transactions
    while True:
        server.process(0.1)
xiaoqiangwang commented 4 years ago

Try to set the following environment variable before starting the server and client

export EPICS_CA_MAX_ARRAY_BYTES=1440000

Here is the reference https://epics.anl.gov/base/R3-14/8-docs/CAref.html#Configurin1

leo-leao commented 4 years ago

Tente definir a seguinte variável de ambiente antes de iniciar o servidor e o cliente

export EPICS_CA_MAX_ARRAY_BYTES=1440000

Aqui está a referência https://epics.anl.gov/base/R3-14/8-docs/CAref.html#Configurin1

Can you help me about where I can put this export in my code? I´m beginner in EPICS and I just had contact with pyepics and pcaspy.

xiaoqiangwang commented 4 years ago

Like this

$ export EPICS_CA_MAX_ARRAY_BYTES=2880000
$ python my_pcaspy_or_pyepics.py
pklaus commented 4 years ago

Alternatively, you can set the environment variable inside your Python script before importing pcaspy:

import os
os.environ["EPICS_CA_MAX_ARRAY_BYTES"] = "2880000"

from pcaspy import Driver, SimpleServer
import numpy as np

...