Overview

This library uses EPICS Channel Access protocol for communication between different servers. It provides a simple template that adds additional process variables(PVs) to EPICS records used for data acquisition. It utilizes the subgroup concept developed in Caproto (https://caproto.github.io/caproto/iocs.html#subgroups).

Conceptually the wrapper is very simple. It provides means to channel information from the network (via CA) to the underlying system level code.

The template_server.py has a Server class.

from caproto.server import PVGroup
class Server(PVGroup):
  #placeholder for the self.system attribute
  system = None

  # define relavant PVs.
  CMD = pvproperty(value='This is command string', max_length = 10000, dtype = str)
  ACK = pvproperty(value='0', read_only = True, dtype = str)
  values = pvproperty(value=[nan,nan], read_only = True, max_length = 10000)

  ...

Upon startup of the caproto io server, two async thread safe queue are created

@CMD.startup #this function will be executed on instantiaton
async def CMD(self, instance, async_lib):
    print('* request method called at server startup @CMD.startup')
    self.io_get_queue = async_lib.ThreadsafeQueue()
    self.io_put_queue = async_lib.ThreadsafeQueue()

the system level instance if exist gets these queues and uses them to communicate information back to the IO.

if self.system is not None:
   self.system.io_put_queue = self.io_put_queue
   self.system.io_get_queue = self.io_get_queue

The putter function for CMD PV will submit the new value of the PV to the system code for execution:

@CMD.putter  #A Putter for the PV with name CMD
async def CMD(self, instance, value):
    print('CMD putter received update for the {}, sending new value {}'.format('CMD',value))
    await self.system_io_execute(pv_name = 'CMD', value = value)
    return value

where self.system_io_execute act as a wrapper and used to submit commands to the system code for execution.

class sequence_server_wrapper.template.Server(prefix, *, macros=None, parent=None, name=None)[source]
async system_io_execute(self, pv_name, value)[source]

wrapper used to submit commands to the system code for execution

Parameters
pv_name: (string)

string name of the PV

value:

new value for the PV specified in the pv_name field

Examples

>>> self.system_io_execute(pv_name = 'CMD', value = '[0]')

Start by importing Sequence Server Wrapper.

import sequence_server_wrapper