#!/usr/bin/python import time import sys import subprocess def test_ready(): """In the WaitReady state, simulate READY signal from PLC.""" print '---------- WatiReady test ----------' print '1. Simulate READY signal. State should go to WaitPermit state.' res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST2R.SVAL 1', shell=True) res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST2R 1', shell=True) print '2. Set CCPS trianguler waveform parameters(1V, 1Hz)' res = subprocess.call('caput EC-GN-P01-GAF-CCPS:STAT-AMP 3', shell=True) res = subprocess.call('caput EC-GN-P01-GAF-CCPS:STAT-FREQ 1', shell=True) #Hz res = subprocess.call('caput EC-GN-P01-GBF-CCPS:STAT-AMP 4', shell=True) res = subprocess.call('caput EC-GN-P01-GBF-CCPS:STAT-FREQ 1', shell=True) #Hz time.sleep(1) print '3. load csv file.' res = subprocess.call('caput EC-GN-P01-GAF:STAT-CSV-NAME test.csv', shell=True) res = subprocess.call('caput EC-GN-P01-GAF:STAT-CSV-LOAD 1', shell=True) res = subprocess.call('caput EC-GN-P01-GBF:STAT-CSV-NAME test2.csv', shell=True) res = subprocess.call('caput EC-GN-P01-GBF:STAT-CSV-LOAD 1', shell=True) time.sleep(1) print '4. Simulate CCPS_ON_REQUEST signal' res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YON-CCPS1.SVAL 1', shell=True) res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YON-CCPS1 1', shell=True) res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YON-CCPS2.SVAL 1', shell=True) res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YON-CCPS2 1', shell=True) time.sleep(1) print '5. Confirm CCPS_ON flag and triangular waveform generation.' print '6. Simulate CCPS status PVs.' res = subprocess.call('caput EC-GN-P01-GAF-CCPS:STAT-OP-V-DIFF.SCAN Passive', shell=True) res = subprocess.call('caput EC-GN-P01-GAF-CCPS:PSU2320-TR 1', shell=True) res = subprocess.call('caput EC-GN-P01-GBF-CCPS:STAT-OP-V-DIFF.SCAN Passive', shell=True) res = subprocess.call('caput EC-GN-P01-GBF-CCPS:PSU2320-TR 1', shell=True) print '7. Confirm PCF state changes to WaitPermit state.'