Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoAldea committed Feb 19, 2024
1 parent 9146168 commit b2911c6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions code/cycler/src/wattrex_battery_cycler/mid/mid_dabs/mid_dabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def __init__(self, device: CyclerDataDeviceC) -> None:
self.device : DrvBmsDeviceC = DrvBmsDeviceC(can_id= can_id)
elif device.device_type is CyclerDataDeviceTypeE.FLOW:
self.device : DrvFlowDeviceC = DrvFlowDeviceC(
config= DrvScpiSerialConfC(port= device.iface_name,
**device.link_conf.__dict__),
rx_chan_name= "RX_SCPI_"+str(self._dev_db_id))
config= DrvScpiSerialConfC(port= device.iface_name,
**device.link_conf.__dict__),
rx_chan_name= "RX_SCPI_"+str(self._dev_db_id))
elif device.device_type is CyclerDataDeviceTypeE.BK:
self.device : DrvBkDeviceC = DrvBkDeviceC(
DrvScpiSerialConfC(port= device.iface_name,
**device.link_conf.__dict__))
DrvScpiSerialConfC(port= device.iface_name,
**device.link_conf.__dict__))

def update(self, ext_meas: CyclerDataExtMeasC, status: CyclerDataAllStatusC) -> None:
"""Update the external measurements from bms or bk data.
Expand Down Expand Up @@ -144,19 +144,19 @@ def __init__(self, device: list [CyclerDataDeviceC]) -> None: #pylint: disable=
temp_en = True, temp_period = DEFAULT_PERIOD_TEMP_MEAS)
elif dev.device_type is CyclerDataDeviceTypeE.SOURCE:
self.source : DrvEaDeviceC = DrvEaDeviceC(
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
self.mapping_source = dev.mapping_names
elif dev.device_type is CyclerDataDeviceTypeE.LOAD:
# TODO: Update SCPI not needing handler
self.load : DrvRsDeviceC = DrvRsDeviceC(
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
self.mapping_load = dev.mapping_names
elif self.device_type is CyclerDataDeviceTypeE.BISOURCE:
self.bisource : DrvEaDeviceC = DrvEaDeviceC(
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
DrvScpiSerialConfC(port= dev.iface_name,
**dev.link_conf.__dict__))
self.mapping_bisource = dev.mapping_names
else:
log.error(f"The dessire device doesn't have type {self.device_type}")
Expand Down Expand Up @@ -291,7 +291,7 @@ def set_cv_mode(self,volt_ref: int, limit_ref: int|None = None,
except ValueError as err:
res = CyclerDataDeviceStatusE.INTERNAL_ERROR
elif self.device_type in (CyclerDataDeviceTypeE.SOURCE, CyclerDataDeviceTypeE.LOAD):
if ((actual_voltage is not None and actual_voltage<volt_ref) and
if ((actual_voltage is not None and actual_voltage<volt_ref*1.1) and
(actual_current is not None and actual_current>=0)):
self.load.disable()
try:
Expand Down

0 comments on commit b2911c6

Please sign in to comment.