File: sg_test.py

package info (click to toggle)
python-pyepics 3.5.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,336 kB
  • sloc: python: 10,539; makefile: 112; javascript: 104; sh: 53
file content (43 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import print_function

import time
import epics
import pvnames
print('== Test get/put for synchronous groups')

pvs = pvnames.motor_list

chids = [epics.ca.create_channel(pvname) for pvname in pvs]

for chid in chids:
    epics.ca.connect_channel(chid)
    epics.ca.put(chid, 0)

print('Now create synch group ')
sg = epics.ca.sg_create()

data = [epics.ca.sg_get(sg, chid) for chid in chids]

print('Now change these PVs for the next 10 seconds')
time.sleep(10.0)

print('Synchronous block:')
epics.ca.sg_block(sg)
print('Done.  Values')
for pvname, dat, chid in zip(pvs, data, chids):
    print("%s = %s" % (pvname, str( epics.ca._unpack(dat, chid=chid))))

epics.ca.sg_reset(sg)

print('OK, now we will put everything back to 0 synchronously')

for chid in chids:
    epics.ca.sg_put(sg, chid, 0)
print('sg_put done, but not blocked / commited. Sleep for 5 seconds ')
time.sleep(5.0)
print('Now Go: ')
epics.ca.sg_block(sg)
print('done.')