Skip to content
Snippets Groups Projects
Commit 497a49e5 authored by b2ecl account's avatar b2ecl account
Browse files

Added PVs for separate termistors (ECL:S%dBARREL:{TEMP01,TEMP02,TEMP03}),...

Added PVs for separate termistors (ECL:S%dBARREL:{TEMP01,TEMP02,TEMP03}), masked thermistor 1 for S34
parent bcb0768b
Branches master
No related tags found
No related merge requests found
......@@ -26,10 +26,14 @@ for phi in range(1, PHI_MAX+1):
phi_masking[phi - 1] = [0, 0, 0, 0]
if phi == 6:
phi_masking[phi - 1] = [0, 1, 1, 1]
if phi == 34:
phi_masking[phi - 1] = [0, 1, 1, 1]
if phi == 43:
phi_masking[phi - 1] = [1, 0, 1, 1]
if phi == 60:
phi_masking[phi - 1] = [1, 1, 1, 0]
if phi == 68:
phi_masking[phi - 1] = [0, 1, 1, 1]
phi_masking[phi - 1] = [0, 1, 1, 0]
################################################
# DEFINE PV NAMES
......@@ -42,16 +46,17 @@ pvdb = {
for phi in range(1, 72+1):
# Skip sectors for which all thermistors are masked
if phi_masking[phi - 1][:3] == [0, 0, 0]: continue
name = 'S%dBARREL:TEMPAVG' % phi
pvdb[name] = { 'prec': 2, 'scan': 15, 'unit': 'C',
'high': 38, 'hihi': 40 }
for suffix in ['AVG', '01', '02', '03']:
name = 'S%dBARREL:TEMP%s' % (phi, suffix)
pvdb[name] = { 'prec': 2, 'scan': 15, 'unit': 'C',
'high': 38, 'hihi': 40 }
#== Humidity
for phi in range(1, 72+1):
# Skip sectors for which humidity sensor is masked
if phi_masking[phi - 1][3] == 0: continue
name = 'S%dBARREL:RH' % phi
pvdb[name] = { 'prec': 2, 'scan': 15, 'unit': '%',
'lolo': 1, 'low': 2, 'high': 9, 'hihi': 10 }
'lolo': 1, 'low': 2, 'high': 13, 'hihi': 15 }
################################################
......@@ -108,25 +113,27 @@ class myDriver(Driver):
def get_pv_details(pv_name):
"""
@return (phi_id, pv_type)
@return (phi_id, pv_type, temperature_sensor_id)
phi_id: number in 1..72 range
pv_type: either 'TEMPAVG' or 'RH'
pv_type: either 'TEMPAVG' or 'TEMP' or 'RH'
temperature_sensor_id: either None or one of {0,1,2}
If pv_name doesn't correspond to any existing PV, returns None
"""
ret = None
for phi in range(1, PHI_MAX + 1):
if pv_name == 'S%dBARREL:TEMPAVG' % phi:
ret = (phi, 'TEMPAVG')
break
return (phi, 'TEMPAVG', None)
for i in range(3):
if pv_name == 'S%dBARREL:TEMP%02d' % (phi, i+1):
return (phi, 'TEMP', i)
if pv_name == 'S%dBARREL:RH' % phi:
ret = (phi, 'RH')
break
return ret
return (phi, 'RH', None)
return None
def get_pv_value(phi_id, pv_type):
def get_pv_value(phi_id, pv_type, sensor_id=None):
"""
@param phi_id number in 1..72 range
@param pv_type either 'TEMPAVG' or 'RH'
@param sensor_id Temperature sensor ID (0-2)
@return Value for the corresponding PV
"""
data = monitor_data[phi_id - 1]
......@@ -137,6 +144,8 @@ def get_pv_value(phi_id, pv_type):
valid_temps = [data[i] for i in range(3) if masking[i] == 1]
if len(valid_temps) == 0: return None
return sum(valid_temps) / len(valid_temps)
elif pv_type == 'TEMP':
return data[sensor_id]
#== Humidity
if pv_type == 'RH':
if masking[3] == 0: return None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment