Files
dev/script/test/TestConsinuousMscan.py
2018-04-17 12:05:48 +02:00

41 lines
1006 B
Python

SCAN_RANGE = [0.0, 1.0]
SCAN_TIME = 10.0
STREAM_SCALARS = ['Int8Scalar', 'Float64Scalar']
STREAM_WAVEFORMS = ['Int32Waveform']
EPICS_CHANELS = ['TESTIOC:TESTCALCOUT:Output']
stream = Stream("PID", dispatcher)
modulo, offset = 10,0
for name in STREAM_SCALARS:
stream.addScalar(name, name, modulo, offset )
plot_types = {}
for name in STREAM_WAVEFORMS:
stream.addWaveform(name, name, modulo, offset )
plot_types[name]=1
stream.initialize()
stream.start()
velocity = abs(float(SCAN_RANGE[1]-SCAN_RANGE[0])) / SCAN_TIME
motor.setSpeed(motor.defaultSpeed)
motor.move(float(SCAN_RANGE[0]))
motor.setSpeed(float(velocity) )
channels = []
for name in EPICS_CHANELS:
channel = Channel(name, 'd')
channel.monitored= True
channels.append(channel)
stream.waitCacheChange(10000)
motor.moveAsync(float(SCAN_RANGE[1]))
try:
mscan(stream, stream.getReadables() + channels, -1, SCAN_TIME, plot_types=plot_types)
finally:
stream.close()
motor.setSpeed(motor.defaultSpeed)