"The ZEN Service reported the following error: An error occurred when the parameters have been applied synchronously. This maybe caused, for example, by a timeout."
If I add a Zen Application Wait element of 1s in each iteration of the loop I do not seem to get this error. Is there a way to wait for verification that the previous hardware settings apply command has been successfully executed before attempting to apply the next one, or what could be the reason for this error?
Code: Select all
position = [...]
field = [...]
exposure = 100
hw = ZenHardwareSetting()
for i in range(0,100):
Zen.Application.Wait(1000) # no error if this line is added
hw.SetParameter('MTBRLFieldStop', 'Position', field[i])
Zen.Devices.ApplyHardwareSetting(hw) # this is where the sync error occurs occasionally
Zen.Devices.Stage.MoveTo(position[i])
hw.SetParameter('MTBLED1', 'IsEnabled', 'true')
Zen.Devices.ApplyHardwareSetting(hw)
Zen.Application.Wait(exposure)
hw.SetParameter('MTBLED1', 'IsEnabled', 'false')
Zen.Devices.ApplyHardwareSetting(hw)