diff --git a/docs/ScrivoEcoMaster.py b/docs/ScrivoEcoMaster.py new file mode 100644 index 0000000000000000000000000000000000000000..291b623341032a0eb3829174b68a916bf25506a7 --- /dev/null +++ b/docs/ScrivoEcoMaster.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Tue Apr 1 10:32:43 2025 + +Funzione per il settaggio della nuova lunghezza d'onda su eco master> +@author: Mauro T, +""" + +import PyTango +import time +#from tango import DevState + +def cambio_lambdaECO(new_wavelength = 13.2): + + device = 'srv-tango-srf-01:20000/fel01/master/eehg_fel01.01' +# new_wavelength = 13.2 + time_step = 0.2 + tempo_massimo = 15 + + master_proxy = PyTango.DeviceProxy(device) + + # 1 aggiorno i valori dal campo + master_proxy.command_inout('ReadFromField') + time.sleep(0.2) + # 2 scrivo la lunghezza d'onda richiesta + master_proxy.write_attribute('lambda_fel', new_wavelength) + # 3 lancio il calcolo necessario + master_proxy.command_inout('Calculate') + time.sleep(0.3) + + # 4 attendo che sia finito, ... puo' richiedere svariati secondi + contatore = 0 + attesa = True + while attesa: + contatore += 1 +# server_state = master_proxy.command_inout_asynch('State') + server_state = master_proxy.command_inout('State') + if server_state != PyTango.DevState.RUNNING: + break + if contatore > (tempo_massimo/time_step): + attesa = False + time.sleep(time_step) + + # 5 applico se non e' andato in time out + if attesa and master_proxy.command_inout('State') == PyTango.DevState.ON: +# master_proxy.command_inout('ApplyAll') + print('tutto ok ed avrebbe applcato') + + +#cambio_lambdaECO(12.2) \ No newline at end of file