Skip to content
Snippets Groups Projects
Commit 6c36e786 authored by Paulus Kruger's avatar Paulus Kruger
Browse files

TR variable _R added. PCB_number added

parent 24ed11e4
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,8 @@ device_registers: ...@@ -76,6 +76,8 @@ device_registers:
- name: Version - name: Version
description: Set in production description: Set in production
address: 0 address: 0
- name: Serial
address: 0x20
- name: VSENSE - name: VSENSE
description: Monitor ADC description: Monitor ADC
...@@ -116,6 +118,11 @@ variables: ...@@ -116,6 +118,11 @@ variables:
rw: ro #server RW variable, not linked to IO rw: ro #server RW variable, not linked to IO
dtype: uint8 dtype: uint8
- name: APSCTTR_monitor_rate
description: Monitor rate in seconds
rw: variable
dtype: uint8
- name: APSCTTR_translator_busy - name: APSCTTR_translator_busy
description: False when idle description: False when idle
rw: ro #server variable, not linked to IO rw: ro #server variable, not linked to IO
...@@ -134,7 +141,15 @@ variables: ...@@ -134,7 +141,15 @@ variables:
description: Version number description: Version number
driver: I2C_CLK driver: I2C_CLK
devreg: ROM.Version devreg: ROM.Version
width: 80 #10 characters width: 0x80 #16 characters
rw: ro
dtype: string
- name: APSCT_PCB_number
description: PCB number (astron.nl/webforms/IenS-Boarden/view.php?id=xxx)
driver: I2C_CLK
devreg: ROM.Serial
width: 0x80 #16 characters
rw: ro rw: ro
dtype: string dtype: string
...@@ -280,6 +295,7 @@ methods: ...@@ -280,6 +295,7 @@ methods:
instructions: instructions:
- APSCT_PCB_ID : Update - APSCT_PCB_ID : Update
- APSCT_PCB_version : Update - APSCT_PCB_version : Update
- APSCT_PCB_number : Update
- APSCT_PWR_on: Update - APSCT_PWR_on: Update
- APSCT_PWR_PLL_200MHz_on: Update - APSCT_PWR_PLL_200MHz_on: Update
- APSCT_PLL_200MHz_locked: Update - APSCT_PLL_200MHz_locked: Update
......
...@@ -22,7 +22,9 @@ device_registers: ...@@ -22,7 +22,9 @@ device_registers:
- name: Version - name: Version
description: Set in production description: Set in production
address: 0 address: 0
- name: Serial
address: 0x20
- name: MAX - name: MAX
description: MAX6620 fan speed controller description: MAX6620 fan speed controller
...@@ -45,6 +47,11 @@ variables: ...@@ -45,6 +47,11 @@ variables:
rw: ro #server RW variable, not linked to IO rw: ro #server RW variable, not linked to IO
dtype: uint8 dtype: uint8
- name: APSPUTR_monitor_rate
description: Monitor rate in seconds
rw: variable
dtype: uint8
- name: APSPUTR_translator_busy - name: APSPUTR_translator_busy
description: False when idle description: False when idle
rw: ro #server variable, not linked to IO rw: ro #server variable, not linked to IO
...@@ -62,7 +69,15 @@ variables: ...@@ -62,7 +69,15 @@ variables:
description: Version number description: Version number
driver: I2C_PU driver: I2C_PU
devreg: ROM.Version devreg: ROM.Version
width: 80 #10 characters width: 0x80 #10 characters
rw: ro
dtype: string
- name: APSPU_PCB_number
description: PCB number (astron.nl/webforms/IenS-Boarden/view.php?id=xxx)
driver: I2C_PU
devreg: ROM.Serial
width: 0x80 #16 characters
rw: ro rw: ro
dtype: string dtype: string
...@@ -114,6 +129,7 @@ methods: ...@@ -114,6 +129,7 @@ methods:
instructions: instructions:
- APSPU_PCB_ID : Update - APSPU_PCB_ID : Update
- APSPU_PCB_version : Update - APSPU_PCB_version : Update
- APSPU_PCB_number : Update
- name: APSPU_FAN_monitor_on - name: APSPU_FAN_monitor_on
driver: I2C_PU driver: I2C_PU
......
...@@ -89,6 +89,8 @@ device_registers: ...@@ -89,6 +89,8 @@ device_registers:
- name: Version - name: Version
description: Set in production description: Set in production
address: 0 address: 0
- name: Serial
address: 0x20
- name: AN - name: AN
description: Monitor ADC on RCU description: Monitor ADC on RCU
...@@ -206,6 +208,12 @@ device_registers: ...@@ -206,6 +208,12 @@ device_registers:
address: [0x1210,0x1110] address: [0x1210,0x1110]
variables: variables:
- name: RECVTR_monitor_rate
description: Monitor rate in seconds
driver: I2C_RCU
rw: variable
dtype: uint8
- name: ANT_mask - name: ANT_mask
description: Only masked RF chains are updated description: Only masked RF chains are updated
driver: I2C_RCU driver: I2C_RCU
...@@ -486,7 +494,17 @@ variables: ...@@ -486,7 +494,17 @@ variables:
description: RCU version number description: RCU version number
driver: I2C_RCU driver: I2C_RCU
devreg: ROM.Version devreg: ROM.Version
width: 80 #10 characters width: 0x80 #16 characters
rw: ro
dtype: string
dim: 32
mask: RCU_mask
- name: RCU_PCB_number
description: PCB number (astron.nl/webforms/IenS-Boarden/view.php?id=xxx)
driver: I2C_RCU
devreg: ROM.Serial
width: 0x80 #16 characters
rw: ro rw: ro
dtype: string dtype: string
dim: 32 dim: 32
...@@ -646,6 +664,7 @@ methods: ...@@ -646,6 +664,7 @@ methods:
- RCU_PWR_ANT_on: Update - RCU_PWR_ANT_on: Update
- RCU_PCB_ID: Update - RCU_PCB_ID: Update
- RCU_PCB_version: Update - RCU_PCB_version: Update
- RCU_PCB_number: Update
- RCU_LED_red_on: Update - RCU_LED_red_on: Update
- RCU_LED_green_on: Update - RCU_LED_green_on: Update
- RCU_attenuator_dB: Update - RCU_attenuator_dB: Update
......
...@@ -121,11 +121,15 @@ variables: ...@@ -121,11 +121,15 @@ variables:
dtype: uint8 dtype: uint8
dim: 2 dim: 2
- name: UNB2TR_monitor_rate
description: Monitor rate in seconds
rw: variable
dtype: uint8
- name: UNB2TR_translator_busy - name: UNB2TR_translator_busy
description: False when idle description: False when idle
rw: ro #server variable, not linked to IO rw: ro #server variable, not linked to IO
dtype: boolean dtype: boolean
dim: 1
##Central MP for whole Uniboard2 ##Central MP for whole Uniboard2
- name: UNB2_mask - name: UNB2_mask
...@@ -137,7 +141,7 @@ variables: ...@@ -137,7 +141,7 @@ variables:
driver: GPIO driver: GPIO
mask: UNB2_mask mask: UNB2_mask
width: 1 width: 1
rw: rw rw: ro
dtype: boolean dtype: boolean
convert_unit: bool_invert convert_unit: bool_invert
dim: 2 dim: 2
...@@ -156,7 +160,16 @@ variables: ...@@ -156,7 +160,16 @@ variables:
- name: UNB2_PCB_version - name: UNB2_PCB_version
driver: switch_UNB2 driver: switch_UNB2
devreg: 0x50.0 devreg: 0x50.0
width: 80 #10 characters width: 0x80 #16 char
rw: ro
dtype: string
dim: 2
- name: UNB2_PCB_number
description: PCB number (astron.nl/webforms/IenS-Boarden/view.php?id=xxx)
driver: switch_UNB2
devreg: 0x50.0x20
width: 0x80 #16 characters
rw: ro rw: ro
dtype: string dtype: string
dim: 2 dim: 2
...@@ -316,6 +329,7 @@ variables: ...@@ -316,6 +329,7 @@ variables:
rw: ro rw: ro
dtype: double dtype: double
scale: 3.90625e-3 #1/256 scale: 3.90625e-3 #1/256
convert_unit: temp_check
dim: 48 dim: 48
monitor: true monitor: true
...@@ -337,14 +351,15 @@ methods: ...@@ -337,14 +351,15 @@ methods:
- UNB2TR_I2C_error: 0 - UNB2TR_I2C_error: 0
- UNB2_PCB_ID: Update - UNB2_PCB_ID: Update
- UNB2_PCB_version: Update - UNB2_PCB_version: Update
- UNB2_PCB_number: Update
- UNB2_Front_Panel_LED_colour: Update - UNB2_Front_Panel_LED_colour: Update
- UNB2_PWR_on: Update - UNB2_PWR_on: Update
- name: UNB2_on - name: UNB2_on
mask: UNB2_mask mask: UNB2_mask
instructions: instructions:
- FP_IO.CONF: 0xff #TODO: setup correctly # - FP_IO.CONF: 0xff #TODO: setup correctly
- UNB2_PWR_on: 1 - UNB2_PWR_on: 0 #already inverted
- UNB2_Front_Panel_LED_colour: 1 - UNB2_Front_Panel_LED_colour: 1
- UNB2_PCB_ID: Update - UNB2_PCB_ID: Update
- UNB2_PCB_version: Update - UNB2_PCB_version: Update
...@@ -352,5 +367,5 @@ methods: ...@@ -352,5 +367,5 @@ methods:
- name: UNB2_off - name: UNB2_off
mask: UNB2_mask mask: UNB2_mask
instructions: instructions:
- UNB2_PWR_on: 0 - UNB2_PWR_on: 1 #inverted
# - UNB2_Front_Panel_LED_colour: 2 # - UNB2_Front_Panel_LED_colour: 2
...@@ -48,6 +48,6 @@ class i2c(hwdev): ...@@ -48,6 +48,6 @@ class i2c(hwdev):
# else: # else:
if bus: bus.close() if bus: bus.close()
logging.debug("I2C failed!") logging.debug("I2C failed!")
# data[0]=0xff if len(data)>0: data[0]=0
return False; return False;
...@@ -7,3 +7,7 @@ def period2RPM(T): ...@@ -7,3 +7,7 @@ def period2RPM(T):
def bool_invert(T): def bool_invert(T):
return not(T); return not(T);
def temp_check(T):
if (T<-100) or (T>200): return float('nan')
return T;
\ No newline at end of file
...@@ -24,9 +24,9 @@ class SubHandler(object): ...@@ -24,9 +24,9 @@ class SubHandler(object):
vname,myvar,v,reader=Vars_W[node.nodeid.Identifier] vname,myvar,v,reader=Vars_W[node.nodeid.Identifier]
# val=(val if isinstance(val, list) else [val] ) # val=(val if isinstance(val, list) else [val] )
logging.info(str(("Datachange callback",vname,val))) logging.info(str(("Datachange callback",vname,val)))
reader.setvar(v,val)
# myvar2.Value.Value=val # myvar2.Value.Value=val
# myvar2.SourceTimestamp = datetime.utcnow() # myvar2.SourceTimestamp = datetime.utcnow()
reader.setvar(v,val)
# Inst=Instr(DevType.Var,VarD,len(val),val) # Inst=Instr(DevType.Var,VarD,len(val),val)
# Q1.put(Inst) # Q1.put(Inst)
...@@ -68,7 +68,7 @@ def AddVarW(vname,varvalue2,v,Q1,debug): ...@@ -68,7 +68,7 @@ def AddVarW(vname,varvalue2,v,Q1,debug):
obj=(DEBUGobj if debug else PCCobj) obj=(DEBUGobj if debug else PCCobj)
myvar2 = obj.add_variable(idx, vname, varvalue2) myvar2 = obj.add_variable(idx, vname, varvalue2)
myvar2.set_writable() myvar2.set_writable()
if v: if not v is None:
Vars_W[myvar2.nodeid.Identifier]=[vname,myvar2.get_data_value(),v,Q1] Vars_W[myvar2.nodeid.Identifier]=[vname,myvar2.get_data_value(),v,Q1]
handle = sub.subscribe_data_change(myvar2) handle = sub.subscribe_data_change(myvar2)
return myvar2 return myvar2
......
...@@ -27,6 +27,7 @@ class yamlreader(yamlconfig): ...@@ -27,6 +27,7 @@ class yamlreader(yamlconfig):
self.timecount=1000; #0 start a 0, 1000 first point immediate self.timecount=1000; #0 start a 0, 1000 first point immediate
self.monitorvarcnt=0; self.monitorvarcnt=0;
self.statusid=self.getvarid(yamlfile+"_translator_busy"); self.statusid=self.getvarid(yamlfile+"_translator_busy");
self.monitorvarid=self.getvarid(yamlfile+"_monitor_rate");
self.statusOPC=None self.statusOPC=None
def SetBusy(self): def SetBusy(self):
...@@ -34,7 +35,6 @@ class yamlreader(yamlconfig): ...@@ -34,7 +35,6 @@ class yamlreader(yamlconfig):
self.OPCset(self.statusid,[1],[]) self.OPCset(self.statusid,[1],[])
def AddVars(self,AddVarR,AddVarW): def AddVars(self,AddVarR,AddVarW):
self.monitorvar=AddVarW(self.yamlfile+"_monitor_rate_RW",30,None,None,None)
for v in self.conf['variables']: for v in self.conf['variables']:
# print(v) # print(v)
dim1=v.get('dim',1); dim1=v.get('dim',1);
...@@ -51,7 +51,7 @@ class yamlreader(yamlconfig): ...@@ -51,7 +51,7 @@ class yamlreader(yamlconfig):
elif datatype=='string': varvalue2=dim1*[""] elif datatype=='string': varvalue2=dim1*[""]
if len(varvalue2)==1: varvalue2=varvalue2[0]; if len(varvalue2)==1: varvalue2=varvalue2[0];
# print(len(varvalue2),varvalue2) # print(len(varvalue2),varvalue2)
if v.get('rw') in ['ro','rw']: if v.get('rw') in ['ro','rw','variable']:
var1=AddVarR(name+"_R",varvalue2,v['id'],v.get('debug')) var1=AddVarR(name+"_R",varvalue2,v['id'],v.get('debug'))
v['OPCR']=var1 v['OPCR']=var1
logging.debug("Var added:"+name+"_R") logging.debug("Var added:"+name+"_R")
...@@ -72,6 +72,18 @@ class yamlreader(yamlconfig): ...@@ -72,6 +72,18 @@ class yamlreader(yamlconfig):
mask=mask.get('OPCW',None) mask=mask.get('OPCW',None)
if (mask==None): continue; if (mask==None): continue;
v['maskOPC']=mask v['maskOPC']=mask
if not self.monitorvarid is None:
self.monitorvar=self.conf['variables'][self.monitorvarid].get('OPCW')
self.monitorvar.set_value(30);
self.setvar(self.monitorvarid,30);
else:
logging.warning("No monitor_rate variable found")
self.monitorvar=None;
if not self.statusid is None:
self.statusOPC=self.conf['variables'][self.statusid].get('OPCR')
else:
logging.warning("No translator_busy variable found");
self.statusOPC=None;
def AddMethod(self,Addmethod): def AddMethod(self,Addmethod):
for v in self.conf['methods']: for v in self.conf['methods']:
...@@ -104,7 +116,15 @@ class yamlreader(yamlconfig): ...@@ -104,7 +116,15 @@ class yamlreader(yamlconfig):
def setvar(self,id1,data=[]): def setvar(self,id1,data=[]):
v=self.conf['variables'][id1]; v=self.conf['variables'][id1];
if v['rw']=='variable': return; if v['rw']=='variable':
var1=v.get('OPCR')
# if not(var1): var1=v.get('OPCW')
if not(var1):
logging.warn("OPCR variable not found!!");
return;
logging.info("Update variable")
var1.set_value(data);
return;
endian=v.get('endian','>'); endian=v.get('endian','>');
mask=v.get('maskOPC',None); mask=v.get('maskOPC',None);
mask=mask.get_value() if (mask!=None) else []; mask=mask.get_value() if (mask!=None) else [];
...@@ -236,10 +256,11 @@ class yamlreader(yamlconfig): ...@@ -236,10 +256,11 @@ class yamlreader(yamlconfig):
var1.set_value(data3); var1.set_value(data3);
def Monitor(self): def Monitor(self):
if self.monitorvar is None: return;
T1=self.monitorvar.get_value()*10; T1=self.monitorvar.get_value()*10;
if T1<=0: return; if T1<=0: return;
self.timecount+=1; self.timecount+=1;
if self.statusOPC is None: self.statusOPC=self.conf['variables'][self.statusid].get('OPCR') # if self.statusOPC is None: self.statusOPC=self.conf['variables'][self.statusid].get('OPCR')
while self.timecount>=T1: while self.timecount>=T1:
if not(self.statusOPC is None) and self.statusOPC.get_value(): return; if not(self.statusOPC is None) and self.statusOPC.get_value(): return;
if self.server.QoutLength()>0: return; if self.server.QoutLength()>0: return;
......
from test_common import * from test_common import *
connect()
name="RCU_attenuator" name="RCU_attenuator_dB"
RCU=[1]; RCU=[1];
Att=[10,10,10] Att=[10,10,10]
#RCU=[1,2,3]; #RCU=[1,2,3];
......
from test_common import *
connect("opc.tcp://localhost:4842/")
callmethod("APSPU_FAN_monitor_on")
disconnect();
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