The function checkMotorZMX() is called for a motor, can be a VmExecutor. It finds the related ZMX devices (__SubDevices) and calls checkZMX() for each of them. This function makes sure that the ZMX is activated and that the error attribute is 'no error'. If so, it returns True. Otherwise is calls the reset() command, sleeps 1s, then re-reads the error attribute, returns True, if 'no error', otherise False.
Notice that checkMotorZMX() has the debug parameter. If set to True, debug output is generated, see the end of this subsection for an example output.
The function checkMotorZMX():
p09/door/haso107d10.01 [1]: HasyUtils.checkMotorZMX?
Signature: HasyUtils.checkMotorZMX(motorName, macro=None, Debug=True)
Docstring:
Inputs:
- motorName is a Pool device or a Tango device
- macro is used for macro.output()
- debug controls the debug output
If poolDevice (eh_mot65), we connect to the related TangoDevice and read the SubDevices,
If Tango device (p09/motor/eh.65), we read the subDevices directly
Loop over the subDevices and search for the ZMXDevice property and connect to the ZMX
and execute checkZMX()
This function can be used in hooks, e.g.:
class gh_pre_scan(Macro):
def run( self):
self.output( "general_features.pre_scan hook")
scanInfo = HasyUtils.createScanInfo( self.getParentMacro().getCommand())
for motRec in scanInfo[ 'motors']:
if not HasyUtils.checkMotorZMX( motRec[ 'name'], macro = self, debug = True):
self.abort()
....
File: /usr/lib/python3/dist-packages/HasyUtils/TgUtils.py
Type: function
The function checkZMX():
p09/door/haso107d10.01 [2]: HasyUtils.checkZMX?
Signature: HasyUtils.checkZMX(zmxName, macro=None, debug=True)
Docstring:
receives a ZMX name checks the device
if Deactivation != 0:
Deactivation = 0
if error != 'no error':
reset() is called then sleep(1)
if error != 'no error':
return False
else:
return True
return True
File: /usr/lib/python3/dist-packages/HasyUtils/TgUtils.py
Type: function
The debug output:
p09/door/haso107d10.01 [6]: ascan eh_mot65 1 1.1 3 0.1
TgUtils.checkMotorZMX: eh_mot65
TgUtils.checkMotorZMX: eh_mot65 has the TangoDevice attribute, follow
TgUtils.checkMotorZMX: reading subDevices from haso107d10:10000/p09/motor/eh.65
TgUtils.checkMotorZMX: subDevices ['p09/motor/eh.65', 'p09/zmx/exp.01']
TgUtils.checkMotorZMX: loop subDev p09/motor/eh.65
TgUtils.checkZMX: p09/zmx/exp.01
TgUtils.checkZMX: return True
TgUtils.checkMotorZMX: loop subDev p09/zmx/exp.01
TgUtils.checkMotorZMX: p09/zmx/exp.01 not an OmsVme58, continue
TgUtils.checkMotorZMX: return True
scanInfo: {'motors': [{'name': 'eh_mot65', 'start': 1.0, 'stop': 1.1}], 'title': 'ascan eh_mot65 1.0 1.1 3 0.1', 'serialno': 6726, 'intervals': 3, 'sampleTime': 0.1}
Operation will be saved in /home/kracht/Misc/IVP/temp/tst_[ScanId].fio (fio from FIO_FileRecorder)
Scan #6726 started at Thu Mar 2 16:28:24 2023. It will take at least 0:00:11.799600
#Pt No eh_mot65 eh_t01 eh_c01 sig_gen eh_c02 dt
0 1 0.1 100000 0.0119563 0 16.2466
1 1.03333 0.1 99999 399.481 0 17.0735
2 1.06666 0.1 99999 49.7412 0 17.8426
3 1.1 0.1 99999 2.3081e-05 0 18.6242
Operation saved in /home/kracht/Misc/IVP/temp/tst_06726.fio (fio)
Scan #6726 ended at Thu Mar 2 16:28:43 2023, taking 0:00:18.925702. Dead time 95.8% (motion dead time 93.0%)