The following example code returns a running sine wave. The piece of code can be used as a template. The class name VOneD and the function names are fixed.
#!/bin/env python
#
# this VoneD returns a running sine wave
#
import PyTango
import numpy as np
class VOneD:
def __init__(self):
print( " VOneD.init, mcaGenerator.py")
self.DataLength = 1024
self.count = 0
#
# dev_state
#
def dev_state( self):
argout = PyTango.DevState.ON
return argout
#
# DataLength
#
def read_DataLength( self):
return self.DataLength
def write_DataLength( self, argin):
self.DataLength = argin
return 1
#
# Data
#
def read_Data( self):
self.count += 1.
if self.count > 1000:
self.count = 0
off = self.count*100.
y = np.linspace( off, 50. + off, self.DataLength)
y = np.sin( y)*100.
return y.astype( int)
def Start(self):
"""
do some start operations
"""
return 1