From ac6eec29ed15ddf21a4a4bf56708b389b5a9b4b5 Mon Sep 17 00:00:00 2001 From: ximenes Date: Wed, 19 Feb 2020 17:33:46 -0300 Subject: [PATCH 1/5] Add Voltage IOC PVs for FBP model power supplies --- siriuspy/siriuspy/csdevice/pwrsupply.py | 6 ++++++ siriuspy/siriuspy/pwrsupply/psmodel.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/siriuspy/siriuspy/csdevice/pwrsupply.py b/siriuspy/siriuspy/csdevice/pwrsupply.py index 0f38fe99d..e1dfc613e 100644 --- a/siriuspy/siriuspy/csdevice/pwrsupply.py +++ b/siriuspy/siriuspy/csdevice/pwrsupply.py @@ -838,6 +838,12 @@ def _get_ps_FBP_propty_database(): 'IntlkHardLabels-Cte': {'type': 'string', 'count': len(_et.HARD_INTLCK_FBP), 'value': _et.HARD_INTLCK_FBP}, + 'LoadVoltage-Mon': {'type': 'float', 'value': 0.0, + 'prec': DEFAULT_PS_CURRENT_PRECISION, + 'unit': 'V'}, + 'DCLinkVoltage-Mon': {'type': 'float', 'value': 0.0, + 'prec': DEFAULT_PS_CURRENT_PRECISION, + 'unit': 'V'}, 'SwitchesTemperature-Mon': {'type': 'float', 'value': 0.0, 'prec': 2, 'unit': 'C'}, diff --git a/siriuspy/siriuspy/pwrsupply/psmodel.py b/siriuspy/siriuspy/pwrsupply/psmodel.py index 1516a4132..daf8e8cce 100644 --- a/siriuspy/siriuspy/pwrsupply/psmodel.py +++ b/siriuspy/siriuspy/pwrsupply/psmodel.py @@ -227,6 +227,8 @@ class PSModelFBP(_PSModel): 'Current-RB': _psbsmp.ConstFBP.V_PS_SETPOINT, 'CurrentRef-Mon': _psbsmp.ConstFBP.V_PS_REFERENCE, 'Current-Mon': _psbsmp.ConstFBP.V_I_LOAD, + 'LoadVoltage-Mon': _psbsmp.ConstFBP.V_V_LOAD, + 'DCLinkVoltage-Mon': _psbsmp.ConstFBP.V_V_DCLINK, 'SwitchesTemperature-Mon': _psbsmp.ConstFBP.V_TEMP_SWITCHES, 'PWMDutyCycle-Mon': _psbsmp.ConstFBP.V_DUTY_CYCLE, } From f4ab90d22648332fab5dbea382c9c1f73667036d Mon Sep 17 00:00:00 2001 From: ximenes Date: Thu, 20 Feb 2020 10:23:20 -0300 Subject: [PATCH 2/5] Add ioc PVs corresponding to ps parameters --- siriuspy/siriuspy/csdevice/pwrsupply.py | 85 ++++++++++++---- siriuspy/siriuspy/pwrsupply/bsmp.py | 2 +- siriuspy/siriuspy/pwrsupply/psmodel.py | 126 ++++++++---------------- 3 files changed, 109 insertions(+), 104 deletions(-) diff --git a/siriuspy/siriuspy/csdevice/pwrsupply.py b/siriuspy/siriuspy/csdevice/pwrsupply.py index e1dfc613e..bd21fee05 100644 --- a/siriuspy/siriuspy/csdevice/pwrsupply.py +++ b/siriuspy/siriuspy/csdevice/pwrsupply.py @@ -518,40 +518,85 @@ def get_basic_propty_database(): 'WfmUpdateAuto-Sts': {'type': 'enum', 'enums': _et.DSBL_ENBL, 'value': Const.DsblEnbl.Dsbl}, # Power Supply Parameters + # --- PS --- 'ParamPSName-Cte': {'type': 'char', 'count': 64, 'value': ''}, - 'ParamPSModel-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamNrModules-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamCommCmdInferface-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamCommRS485BaudRate-Cte': {'type': 'float', 'value': float('NaN')}, + 'ParamPSModel-Cte': {'type': 'float', 'value': 0.0}, + 'ParamNrModules-Cte': {'type': 'float', 'value': 0.0}, + # --- COMM --- + 'ParamCommCmdInferface-Cte': {'type': 'float', 'value': 0.0}, + 'ParamCommRS485BaudRate-Cte': {'type': 'float', 'value': 0.0}, 'ParamCommRS485Addr-Cte': {'type': 'float', 'count': 4, - 'value': _np.array([float('NaN'), ] * 4)}, - 'ParamCommRS485TermRes-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamCommUDCNetAddr-Cte': {'type': 'float', 'value': float('NaN')}, + 'value': _np.array([0.0, ] * 4)}, + 'ParamCommRS485TermRes-Cte': {'type': 'float', 'value': 0.0}, + 'ParamCommUDCNetAddr-Cte': {'type': 'float', 'value': 0.0}, 'ParamCommEthIP-Cte': {'type': 'float', 'count': 4, - 'value': _np.array([float('NaN'), ] * 4)}, + 'value': _np.array([0.0, ] * 4)}, 'ParamCommEthSubnetMask-Cte': {'type': 'float', 'count': 4, - 'value': _np.array([float('NaN'), ] * 4)}, - 'ParamCommBuzVol-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamCtrlFreqCtrlISR-Cte': {'type': 'float', 'value': float('NaN')}, + 'value': _np.array([0.0, ] * 4)}, + 'ParamCommBuzVol-Cte': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + # --- Control --- + 'ParamCtrlFreqCtrlISR-Cte': + {'type': 'float', 'value': 0.0, 'unit': 'Hz'}, 'ParamCtrlFreqTimeSlicer-Cte': {'type': 'float', 'count': 4, - 'value': _np.array([float('NaN'), ] * 4)}, - 'ParamCtrlMaxRef-Cte': {'type': 'float', 'value': float('NaN')}, - 'ParamCtrlMinRef-Cte': {'type': 'float', 'value': float('NaN')}, + 'value': _np.array([0.0, ] * 4), + 'unit': 'Hz'}, + 'ParamCtrlMaxRef-Cte': + {'type': 'float', 'value': 0.0, 'unit': 'A/V'}, + 'ParamCtrlMinRef-Cte': + {'type': 'float', 'value': 0.0, 'unit': 'A/V'}, 'ParamCtrlMaxRefOpenLoop-Cte': - {'type': 'float', 'value': float('NaN')}, + {'type': 'float', 'value': 0.0}, 'ParamCtrlMinRefOpenLoop-Cte': - {'type': 'float', 'value': float('NaN')}, + {'type': 'float', 'value': 0.0}, 'ParamCtrlSlewRateSlowRef-Cte': - {'type': 'float', 'value': float('NaN')}, + {'type': 'float', 'value': 0.0, 'unit': 'Ref/s'}, 'ParamCtrlSlewRateSigGenAmp-Cte': - {'type': 'float', 'value': float('NaN')}, + {'type': 'float', 'value': 0.0, 'unit': 'Ref/s'}, 'ParamCtrlSlewRateSigGenOffset-Cte': - {'type': 'float', 'value': float('NaN')}, + {'type': 'float', 'value': 0.0, 'unit': 'Ref/s'}, 'ParamCtrlSlewRateWfmRef-Cte': - {'type': 'float', 'value': float('NaN')}}) + {'type': 'float', 'value': 0.0, 'unit': 'Ref/s'}, + # --- PWM --- + 'ParamPWMFreq': + {'type': 'float', 'value': 0.0, 'unit': 'Hz'}, + 'ParamPWMDeadTime': + {'type': 'float', 'value': 0.0, 'unit': 'ns'}, + 'ParamPWMMaxDuty': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + 'ParamPWMMinDuty': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + 'ParamPWMMaxDutyOpenLoop': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + 'ParamPWMMinDutyOpenLoop': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + 'ParamPWMLimDutyShare': + {'type': 'float', 'value': 0.0, 'unit': '%'}, + # --- Analog Variables --- + 'ParamAnalogMax': + {'type': 'float', 'count': 64, + 'value': _np.array([0.0, ] * 64)}, + 'ParamAnalogMin': + {'type': 'float', 'count': 64, + 'value': _np.array([0.0, ] * 64)}, + # --- Debounce Manager --- + 'ParamHardIntlkDebounceTime': + {'type': 'float', 'count': 32, + 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, + 'ParamHardIntlkResetTime': + {'type': 'float', 'count': 32, + 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, + 'ParamSoftIntlkDebounceTime': + {'type': 'float', 'count': 32, + 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, + 'ParamSoftIntlkResetTime': + {'type': 'float', 'count': 32, + 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, + }) + return dbase diff --git a/siriuspy/siriuspy/pwrsupply/bsmp.py b/siriuspy/siriuspy/pwrsupply/bsmp.py index 699412fdf..467c663de 100644 --- a/siriuspy/siriuspy/pwrsupply/bsmp.py +++ b/siriuspy/siriuspy/pwrsupply/bsmp.py @@ -193,7 +193,7 @@ class ConstPSBSMP: # ----- class Analog Variables ----- P_ANALOG_MAX = 46 P_ANALOG_MIN = 47 - # ----- Debounding manager ----- + # ----- class Debounding manager ----- P_HARD_INTLK_DEBOUNCE_TIME = 48 P_HARD_INTLK_RESET_TIME = 49 P_SOFT_INTLK_DEBOUNCE_TIME = 50 diff --git a/siriuspy/siriuspy/pwrsupply/psmodel.py b/siriuspy/siriuspy/pwrsupply/psmodel.py index daf8e8cce..ce5555aaf 100644 --- a/siriuspy/siriuspy/pwrsupply/psmodel.py +++ b/siriuspy/siriuspy/pwrsupply/psmodel.py @@ -32,40 +32,39 @@ class _PSModel: 'PRUCtrlQueueSize-Mon': 'queue_length'} _e2p = { # Epics to Power Supply parameter - # --- PS - 'ParamPSName-Cte': _c.P_PS_NAME, - 'ParamPSModel-Cte': _c.P_PS_MODEL, - 'ParamNrModules-Cte': _c.P_PS_NR_PSMODELS, - # --- COMM - 'ParamCommCmdInferface-Cte': _c.P_COMM_CMD_INTERFACE, - 'ParamCommCMD_INTERFACE-Cte': _c.P_COMM_CMD_INTERFACE, - 'ParamCommRS485BaudRate-Cte': _c.P_COMM_RS485_BAUDRATE, - 'ParamCommRS485Addr-Cte': _c.P_COMM_RS485_ADDRESS, - 'ParamCommRS485TermRes-Cte': _c.P_COMM_RS485_TERMINATOR_RESISTOR, - 'ParamCommUDCNetAddr-Cte': _c.P_COMM_UDC_NETWORK_ADDRESS, - 'ParamCommEthIP-Cte': _c.P_COMM_ETHERNET_IP, - 'ParamCommEthSubnetMask-Cte': _c.P_COMM_ETHERNET_SUBNET_MASK, - 'ParamCommBuzVol-Cte': _c. P_COMM_BUZZER_VOLUME, - # # ----- class Control ----- - 'ParamCtrlFreqCtrlISR-Cte': _c.P_CTRL_FREQ_CONTROL_ISR, - 'ParamCtrlFreqTimeSlicer-Cte': _c.P_CTRL_FREQ_TIME_SLICER, - 'ParamCtrlMaxRef-Cte': _c.P_CTRL_MAX_REF, - 'ParamCtrlMinRef-Cte': _c.P_CTRL_MIN_REF, - 'ParamCtrlMaxRefOpenLoop-Cte': _c.P_CTRL_MAX_REF_OPEN_LOOP, - 'ParamCtrlMinRefOpenLoop-Cte': _c.P_CTRL_MIN_REF_OPEN_LOOP, - 'ParamCtrlSlewRateSlowRef-Cte': _c.P_CTRL_SLEW_RATE_SLOWREF, - 'ParamCtrlSlewRateSigGenAmp-Cte': _c.P_CTRL_SLEW_RATE_SIGGEN_AMP, - 'ParamCtrlSlewRateSigGenOffset-Cte': _c.P_CTRL_SLEW_RATE_SIGGEN_OFFSET, - 'ParamCtrlSlewRateWfmRef-Cte': _c.P_CTRL_SLEW_RATE_WFMREF, - # # ----- class PWM ----- - # P_PWM_FREQ = 21 - # P_PWM_DEAD_TIME = 22 - # P_PWM_MAX_DUTY = 23 - # P_PWM_MIN_DUTY = 24 - # P_PWM_MAX_DUTY_OPEN_LOOP = 25 - # P_PWM_MIN_DUTY_OPEN_LOOP = 26 - # P_PWM_LIM_DUTY_SHARE = 27 - # # ----- class HRADC ----- + # --- PS --- + 'ParamPSName-Cte': _c.P_PS_NAME, # 00 + 'ParamPSModel-Cte': _c.P_PS_MODEL, # 01 + 'ParamNrModules-Cte': _c.P_PS_NR_PSMODELS, # 02 + # --- Communication --- + 'ParamCommCmdInferface-Cte': _c.P_COMM_CMD_INTERFACE, # 03 + 'ParamCommRS485BaudRate-Cte': _c.P_COMM_RS485_BAUDRATE, # 04 + 'ParamCommRS485Addr-Cte': _c.P_COMM_RS485_ADDRESS, # 05 + 'ParamCommRS485TermRes-Cte': _c.P_COMM_RS485_TERMINATOR_RESISTOR, # 06 + 'ParamCommUDCNetAddr-Cte': _c.P_COMM_UDC_NETWORK_ADDRESS, # 07 + 'ParamCommEthIP-Cte': _c.P_COMM_ETHERNET_IP, # 08 + 'ParamCommEthSubnetMask-Cte': _c.P_COMM_ETHERNET_SUBNET_MASK, # 09 + 'ParamCommBuzVol-Cte': _c. P_COMM_BUZZER_VOLUME, # 10 + # --- Control --- + 'ParamCtrlFreqCtrlISR-Cte': _c.P_CTRL_FREQ_CONTROL_ISR, # 11 + 'ParamCtrlFreqTimeSlicer-Cte': _c.P_CTRL_FREQ_TIME_SLICER, # 12 + 'ParamCtrlMaxRef-Cte': _c.P_CTRL_MAX_REF, # 13 + 'ParamCtrlMinRef-Cte': _c.P_CTRL_MIN_REF, # 14 + 'ParamCtrlMaxRefOpenLoop-Cte': _c.P_CTRL_MAX_REF_OPEN_LOOP, # 15 + 'ParamCtrlMinRefOpenLoop-Cte': _c.P_CTRL_MIN_REF_OPEN_LOOP, # 16 + 'ParamCtrlSlewRateSlowRef-Cte': _c.P_CTRL_SLEW_RATE_SLOWREF, # 17 + 'ParamCtrlSlewRateSigGenAmp-Cte': _c.P_CTRL_SLEW_RATE_SIGGEN_AMP, # 18 + 'ParamCtrlSlewRateSigGenOffset-Cte': _c.P_CTRL_SLEW_RATE_SIGGEN_OFFSET, # 19 + 'ParamCtrlSlewRateWfmRef-Cte': _c.P_CTRL_SLEW_RATE_WFMREF, # 20 + # --- PWM --- + 'ParamPWMFreq': _c.P_PWM_FREQ, # 21 + 'ParamPWMDeadTime': _c.P_PWM_DEAD_TIME, # 22 + 'ParamPWMMaxDuty': _c.P_PWM_MAX_DUTY, # 23 + 'ParamPWMMinDuty': _c.P_PWM_MIN_DUTY, # 24 + 'ParamPWMMaxDutyOpenLoop': _c.P_PWM_MAX_DUTY_OPEN_LOOP, # 25 + 'ParamPWMMinDutyOpenLoop': _c.P_PWM_MIN_DUTY_OPEN_LOOP, # 26 + 'ParamPWMLimDutyShare': _c.P_PWM_LIM_DUTY_SHARE, # 27 + # # --- HRADC --- # P_HRADC_NR_BOARDS = 28 # P_HRADC_SPI_CLK = 29 # P_HRADC_FREQ_SAMPLING = 30 @@ -74,65 +73,26 @@ class _PSModel: # P_HRADC_TRANSDUCER_OUTPUT = 33 # P_HRADC_TRANSDUCER_GAIN = 34 # P_HRADC_TRANSDUCER_OFFSET = 35 - # # ----- class SigGen ----- + # # --- SigGen --- # P_SIGGEN_TYPE = 36 # P_SIGGEN_NUM_CYCLES = 37 # P_SIGGEN_FREQ = 38 # P_SIGGEN_AMPLITUDE = 39 # P_SIGGEN_OFFSET = 40 # P_SIGGEN_AUX_PARAM = 41 - # # ----- class WfmRef ----- + # # --- WfmRef --- # P_WFMREF_ID = 42 # P_WFMREF_SYNC_MODE = 43 # P_WFMREF_GAIN = 44 # P_WFMREF_OFFSET = 45 - # # ----- class Analog Variables ----- - # P_ANALOG_MAX = 46 - # P_ANALOG_MIN = 47 - # # ----- class Control ----- - # P_CTRL_FREQ_CONTROL_ISR = 11 - # P_CTRL_FREQ_TIME_SLICER = 12 - # P_CTRL_MAX_REF = 13 - # P_CTRL_MIN_REF = 14 - # P_CTRL_MAX_REF_OPEN_LOOP = 15 - # P_CTRL_MIN_REF_OPEN_LOOP = 16 - # P_CTRL_SLEW_RATE_SLOWREF = 17 - # P_CTRL_SLEW_RATE_SIGGEN_AMP = 18 - # P_CTRL_SLEW_RATE_SIGGEN_OFFSET = 19 - # P_CTRL_SLEW_RATE_WFMREF = 20 - # # ----- class PWM ----- - # P_PWM_FREQ = 21 - # P_PWM_DEAD_TIME = 22 - # P_PWM_MAX_DUTY = 23 - # P_PWM_MIN_DUTY = 24 - # P_PWM_MAX_DUTY_OPEN_LOOP = 25 - # P_PWM_MIN_DUTY_OPEN_LOOP = 26 - # P_PWM_LIM_DUTY_SHARE = 27 - # # ----- class HRADC ----- - # P_HRADC_NR_BOARDS = 28 - # P_HRADC_SPI_CLK = 29 - # P_HRADC_FREQ_SAMPLING = 30 - # P_HRADC_ENABLE_HEATER = 31 - # P_HRADC_ENABLE_RAILS_MON = 32 - # P_HRADC_TRANSDUCER_OUTPUT = 33 - # P_HRADC_TRANSDUCER_GAIN = 34 - # P_HRADC_TRANSDUCER_OFFSET = 35 - # # ----- class SigGen ----- - # P_SIGGEN_TYPE = 36 - # P_SIGGEN_NUM_CYCLES = 37 - # P_SIGGEN_FREQ = 38 - # P_SIGGEN_AMPLITUDE = 39 - # P_SIGGEN_OFFSET = 40 - # P_SIGGEN_AUX_PARAM = 41 - # # ----- class WfmRef ----- - # P_WFMREF_ID = 42 - # P_WFMREF_SYNC_MODE = 43 - # P_WFMREF_GAIN = 44 - # P_WFMREF_OFFSET = 45 - # # ----- class Analog Variables ----- - # P_ANALOG_MAX = 46 - # P_ANALOG_MIN = 47 - + # --- Analog Variables --- + 'ParamAnalogMax': _c.P_ANALOG_MAX, # 46 + 'ParamAnalogMin': _c.P_ANALOG_MIN, # 47 + # --- Debounce Manager --- + 'ParamHardIntlkDebounceTime': _c.P_HARD_INTLK_DEBOUNCE_TIME, # 48 + 'ParamHardIntlkResetTime': _c.P_HARD_INTLK_RESET_TIME, # 49 + 'ParamSoftIntlkDebounceTime': _c.P_SOFT_INTLK_DEBOUNCE_TIME, # 50 + 'ParamSoftIntlkResetTime': _c.P_SOFT_INTLK_RESET_TIME, # 51 } _variables = dict() # this will be filled in derived classes From ac622acbdf800c50f1eaee72b971a2a441f2ee64 Mon Sep 17 00:00:00 2001 From: ximenes Date: Thu, 20 Feb 2020 13:40:52 -0300 Subject: [PATCH 3/5] Add missing suffixes in newly added PS ioc PVs --- siriuspy/siriuspy/clientarch/__init__.py | 1 + siriuspy/siriuspy/clientarch/client.py | 17 ++++++++++++++-- siriuspy/siriuspy/csdevice/pwrsupply.py | 26 ++++++++++++------------ siriuspy/siriuspy/pwrsupply/psmodel.py | 26 ++++++++++++------------ 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/siriuspy/siriuspy/clientarch/__init__.py b/siriuspy/siriuspy/clientarch/__init__.py index 13cdc619b..f38b52c32 100644 --- a/siriuspy/siriuspy/clientarch/__init__.py +++ b/siriuspy/siriuspy/clientarch/__init__.py @@ -2,6 +2,7 @@ import siriuspy.envars as _envars from .client import ClientArchiver +from .pvarch import PVArch SERVER_URL = _envars.SRVURL_ARCHIVER diff --git a/siriuspy/siriuspy/clientarch/client.py b/siriuspy/siriuspy/clientarch/client.py index 5ea49bfdd..f0aa4fdc7 100644 --- a/siriuspy/siriuspy/clientarch/client.py +++ b/siriuspy/siriuspy/clientarch/client.py @@ -45,7 +45,10 @@ def getPVsInfo(self, pvnames): if isinstance(pvnames, (list, tuple)): pvnames = ','.join(pvnames) url = self._create_url(method='getPVStatus', pv=pvnames) - return self._make_request(url).json() + req = self._make_request(url) + if not req.ok: + return None + return req.json() def getAllPVs(self, pvnames): """.""" @@ -95,7 +98,7 @@ def getData(self, pvname, timestamp_start, timestamp_stop): pvname -- name of pv. timestamp_start -- timestamp of interval start Example: (2019-05-23T13:32:27.570Z) - timestamp_stop -- timestamp of interval start + timestamp_stop -- timestamp of interval stop Example: (2019-05-23T14:32:27.570Z) """ tstart = _parse.quote(timestamp_start) @@ -112,6 +115,16 @@ def getData(self, pvname, timestamp_start, timestamp_stop): severity = [v['severity'] for v in data] return timestamp, value, status, severity + def getPVDetails(self, pvname): + """.""" + url = self._create_url( + method='getPVDetails', pv=pvname) + req = self._make_request(url) + if not req.ok: + return None + data = req.json() + return data + def _make_request(self, url, need_login=False): if self.session is not None: req = self.session.get(url) diff --git a/siriuspy/siriuspy/csdevice/pwrsupply.py b/siriuspy/siriuspy/csdevice/pwrsupply.py index bd21fee05..0602eb288 100644 --- a/siriuspy/siriuspy/csdevice/pwrsupply.py +++ b/siriuspy/siriuspy/csdevice/pwrsupply.py @@ -561,38 +561,38 @@ def get_basic_propty_database(): 'ParamCtrlSlewRateWfmRef-Cte': {'type': 'float', 'value': 0.0, 'unit': 'Ref/s'}, # --- PWM --- - 'ParamPWMFreq': + 'ParamPWMFreq-Cte': {'type': 'float', 'value': 0.0, 'unit': 'Hz'}, - 'ParamPWMDeadTime': + 'ParamPWMDeadTime-Cte': {'type': 'float', 'value': 0.0, 'unit': 'ns'}, - 'ParamPWMMaxDuty': + 'ParamPWMMaxDuty-Cte': {'type': 'float', 'value': 0.0, 'unit': '%'}, - 'ParamPWMMinDuty': + 'ParamPWMMinDuty-Cte': {'type': 'float', 'value': 0.0, 'unit': '%'}, - 'ParamPWMMaxDutyOpenLoop': + 'ParamPWMMaxDutyOpenLoop-Cte': {'type': 'float', 'value': 0.0, 'unit': '%'}, - 'ParamPWMMinDutyOpenLoop': + 'ParamPWMMinDutyOpenLoop-Cte': {'type': 'float', 'value': 0.0, 'unit': '%'}, - 'ParamPWMLimDutyShare': + 'ParamPWMLimDutyShare-Cte': {'type': 'float', 'value': 0.0, 'unit': '%'}, # --- Analog Variables --- - 'ParamAnalogMax': + 'ParamAnalogMax-Cte': {'type': 'float', 'count': 64, 'value': _np.array([0.0, ] * 64)}, - 'ParamAnalogMin': + 'ParamAnalogMin-Cte': {'type': 'float', 'count': 64, 'value': _np.array([0.0, ] * 64)}, # --- Debounce Manager --- - 'ParamHardIntlkDebounceTime': + 'ParamHardIntlkDebounceTime-Cte': {'type': 'float', 'count': 32, 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, - 'ParamHardIntlkResetTime': + 'ParamHardIntlkResetTime-Cte': {'type': 'float', 'count': 32, 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, - 'ParamSoftIntlkDebounceTime': + 'ParamSoftIntlkDebounceTime-Cte': {'type': 'float', 'count': 32, 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, - 'ParamSoftIntlkResetTime': + 'ParamSoftIntlkResetTime-Cte': {'type': 'float', 'count': 32, 'value': _np.array([0.0, ] * 32), 'unit': 'us'}, }) diff --git a/siriuspy/siriuspy/pwrsupply/psmodel.py b/siriuspy/siriuspy/pwrsupply/psmodel.py index ce5555aaf..29c808ee1 100644 --- a/siriuspy/siriuspy/pwrsupply/psmodel.py +++ b/siriuspy/siriuspy/pwrsupply/psmodel.py @@ -57,13 +57,13 @@ class _PSModel: 'ParamCtrlSlewRateSigGenOffset-Cte': _c.P_CTRL_SLEW_RATE_SIGGEN_OFFSET, # 19 'ParamCtrlSlewRateWfmRef-Cte': _c.P_CTRL_SLEW_RATE_WFMREF, # 20 # --- PWM --- - 'ParamPWMFreq': _c.P_PWM_FREQ, # 21 - 'ParamPWMDeadTime': _c.P_PWM_DEAD_TIME, # 22 - 'ParamPWMMaxDuty': _c.P_PWM_MAX_DUTY, # 23 - 'ParamPWMMinDuty': _c.P_PWM_MIN_DUTY, # 24 - 'ParamPWMMaxDutyOpenLoop': _c.P_PWM_MAX_DUTY_OPEN_LOOP, # 25 - 'ParamPWMMinDutyOpenLoop': _c.P_PWM_MIN_DUTY_OPEN_LOOP, # 26 - 'ParamPWMLimDutyShare': _c.P_PWM_LIM_DUTY_SHARE, # 27 + 'ParamPWMFreq-Cte': _c.P_PWM_FREQ, # 21 + 'ParamPWMDeadTime-Cte': _c.P_PWM_DEAD_TIME, # 22 + 'ParamPWMMaxDuty-Cte': _c.P_PWM_MAX_DUTY, # 23 + 'ParamPWMMinDuty-Cte': _c.P_PWM_MIN_DUTY, # 24 + 'ParamPWMMaxDutyOpenLoop-Cte': _c.P_PWM_MAX_DUTY_OPEN_LOOP, # 25 + 'ParamPWMMinDutyOpenLoop-Cte': _c.P_PWM_MIN_DUTY_OPEN_LOOP, # 26 + 'ParamPWMLimDutyShare-Cte': _c.P_PWM_LIM_DUTY_SHARE, # 27 # # --- HRADC --- # P_HRADC_NR_BOARDS = 28 # P_HRADC_SPI_CLK = 29 @@ -86,13 +86,13 @@ class _PSModel: # P_WFMREF_GAIN = 44 # P_WFMREF_OFFSET = 45 # --- Analog Variables --- - 'ParamAnalogMax': _c.P_ANALOG_MAX, # 46 - 'ParamAnalogMin': _c.P_ANALOG_MIN, # 47 + 'ParamAnalogMax-Cte': _c.P_ANALOG_MAX, # 46 + 'ParamAnalogMin-Cte': _c.P_ANALOG_MIN, # 47 # --- Debounce Manager --- - 'ParamHardIntlkDebounceTime': _c.P_HARD_INTLK_DEBOUNCE_TIME, # 48 - 'ParamHardIntlkResetTime': _c.P_HARD_INTLK_RESET_TIME, # 49 - 'ParamSoftIntlkDebounceTime': _c.P_SOFT_INTLK_DEBOUNCE_TIME, # 50 - 'ParamSoftIntlkResetTime': _c.P_SOFT_INTLK_RESET_TIME, # 51 + 'ParamHardIntlkDebounceTime-Cte': _c.P_HARD_INTLK_DEBOUNCE_TIME, # 48 + 'ParamHardIntlkResetTime-Cte': _c.P_HARD_INTLK_RESET_TIME, # 49 + 'ParamSoftIntlkDebounceTime-Cte': _c.P_SOFT_INTLK_DEBOUNCE_TIME, # 50 + 'ParamSoftIntlkResetTime-Cte': _c.P_SOFT_INTLK_RESET_TIME, # 51 } _variables = dict() # this will be filled in derived classes From 6a2d273d08ce80ae05909578b1885452d65a0167 Mon Sep 17 00:00:00 2001 From: ximenes Date: Thu, 20 Feb 2020 13:43:44 -0300 Subject: [PATCH 4/5] Add PVArch in clientarch --- siriuspy/siriuspy/clientarch/pvarch.py | 90 ++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 siriuspy/siriuspy/clientarch/pvarch.py diff --git a/siriuspy/siriuspy/clientarch/pvarch.py b/siriuspy/siriuspy/clientarch/pvarch.py new file mode 100644 index 000000000..ea0a697cc --- /dev/null +++ b/siriuspy/siriuspy/clientarch/pvarch.py @@ -0,0 +1,90 @@ +""".""" + +from .client import ClientArchiver as _ClientArchiver + + +class PVArch: + """PVArch.""" + + def __init__(self, pvname, client_archiver=None): + """.""" + self.pvname = pvname + self.is_scalar = None + self.nelms = None + self.units = None + self.is_paused = None + self.host_name = None + self.connected = None + self.avg_bytes_per_event = None + self.estimated_storage_rate_kb_hour = None + self.estimated_storage_rate_mb_day = None + self.estimated_storage_rate_gb_year = None + + self.connector = client_archiver + + def login(self, **kwargs): + """.""" + self.connect() + self.connector.login(**kwargs) + + def connect(self): + """.""" + if self.connector is None: + self.connector = _ClientArchiver() + + def update(self): + """.""" + self.connect() + data = self.connector.getPVDetails(self.pvname) + for datum in data: + # print(datum) + field, value = datum['name'], datum['value'] + if field == 'Is this a scalar:': + self.is_scalar = (value.lower() == 'yes') + elif field == 'Number of elements:': + self.nelms = int(value) + elif field == 'Units:': + self.units = value + elif field == 'Is this PV paused:': + self.is_paused = (value.lower() == 'yes') + elif field == 'Host name': + self.host_name = value + elif field == 'Host name': + self.host_name = value + elif field == 'Is this PV currently connected?': + self.connected = (value.lower() == 'yes') + elif field == 'Average bytes per event': + self.avg_bytes_per_event = float(value) + elif field == 'Estimated storage rate (KB/hour)': + self.estimated_storage_rate_kb_hour = float(value) + elif field == 'Estimated storage rate (MB/day)': + self.estimated_storage_rate_mb_day = float(value) + elif field == 'Estimated storage rate (GB/year)': + self.estimated_storage_rate_gb_year = float(value) + + def getData(self, timestamp_start, timestamp_stop): + """.""" + self.connect() + timestamp, value, status, severity = \ + self.connector.getData(self.pvname, timestamp_start, timestamp_stop) + return timestamp, value, status, severity + + def __str__(self): + """.""" + rst = '' + rst += '{:<30s}: {:}\n'.format('pvname', self.pvname) + rst += '{:<30s}: {:}\n'.format('is_scalar', self.is_scalar) + rst += '{:<30s}: {:}\n'.format('nelms', self.nelms) + rst += '{:<30s}: {:}\n'.format('units', self.units) + rst += '{:<30s}: {:}\n'.format('is_paused', self.is_paused) + rst += '{:<30s}: {:}\n'.format('host_name', self.host_name) + rst += '{:<30s}: {:}\n'.format('connected', self.connected) + rst += '{:<30s}: {:}\n'.format( + 'avg_bytes_per_event', self.avg_bytes_per_event) + rst += '{:<30s}: {:}\n'.format( + 'estimated_storage_rate_kb_hour', self.estimated_storage_rate_kb_hour) + rst += '{:<30s}: {:}\n'.format( + 'estimated_storage_rate_mb_day', self.estimated_storage_rate_mb_day) + rst += '{:<30s}: {:}\n'.format( + 'estimated_storage_rate_gb_year', self.estimated_storage_rate_gb_year) + return rst From 9cde127f6bd49379da57439cf8bf278308f872d3 Mon Sep 17 00:00:00 2001 From: ximenes Date: Thu, 20 Feb 2020 17:47:35 -0300 Subject: [PATCH 5/5] Update version --- siriuspy/siriuspy/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/VERSION b/siriuspy/siriuspy/VERSION index 141f2e805..15b989e39 100644 --- a/siriuspy/siriuspy/VERSION +++ b/siriuspy/siriuspy/VERSION @@ -1 +1 @@ -1.15.0 +1.16.0