Skip to content
Snippets Groups Projects
Commit bb738ec9 authored by Mauro Trovo's avatar Mauro Trovo :headphones:
Browse files

add utilizzo

parent b199cbdf
No related branches found
No related tags found
No related merge requests found
#!/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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment