print('stopped on maximum number of steps reached')
print(f'Selected Vab: {vab:.2f}')
vab=np.min(vabs)
print(f'Selected Vab: {vab:.2f}')
vab=np.min(vabs)
print(f'Selected Vab: {vab:.2f}')
# if strategy == 'vmax':
# # implement different strategies
# if vab < vab_max and iab < current_max:
# vab = vab * np.min([0.9 * vab_max / vab, 0.9 * current_max / iab]) # TODO: check if setting at 90% of max as a safety margin is OK
# self.tx.exec_logger.debug(f'vmax strategy: setting VAB to {vab} V.')
# elif strategy == 'vmin':
# if vab <= vab_max and iab < current_max:
# vab = vab * np.min([0.9 * vab_max / vab, vmn_min / np.abs(vmn), 0.9 * current_max / iab]) # TODO: check if setting at 90% of max as a safety margin is OK
# elif strategy != 'constant':
# self.tx.exec_logger.warning(f'Unknown strategy {strategy} for setting VAB! Using {vab} V')
# else:
# self.tx.exec_logger.debug(f'Constant strategy for setting VAB, using {vab} V')
# # self.tx.turn_off()
# if switch_pwr_off:
# self.tx.pwr.pwr_state = 'off'
# if switch_tx_pwr_off:
# self.tx.pwr_state = 'off'
# rab = (np.abs(vab) * 1000.) / iab
# self.exec_logger.debug(f'RAB = {rab:.2f} Ohms')
# if vmn < 0:
# polarity = -1 # TODO: check if we really need to return polarity
# else:
# polarity = 1
returnvab,None,None
# if strategy == 'vmax':
# # implement different strategies
# if vab < vab_max and iab < current_max:
# vab = vab * np.min([0.9 * vab_max / vab, 0.9 * current_max / iab]) # TODO: check if setting at 90% of max as a safety margin is OK
# self.tx.exec_logger.debug(f'vmax strategy: setting VAB to {vab} V.')
# elif strategy == 'vmin':
# if vab <= vab_max and iab < current_max:
# vab = vab * np.min([0.9 * vab_max / vab, vmn_min / np.abs(vmn), 0.9 * current_max / iab]) # TODO: check if setting at 90% of max as a safety margin is OK
# elif strategy != 'constant':
# self.tx.exec_logger.warning(f'Unknown strategy {strategy} for setting VAB! Using {vab} V')
# else:
# self.tx.exec_logger.debug(f'Constant strategy for setting VAB, using {vab} V')
# # self.tx.turn_off()
# if switch_pwr_off:
# self.tx.pwr.pwr_state = 'off'
# if switch_tx_pwr_off:
# self.tx.pwr_state = 'off'
# rab = (np.abs(vab) * 1000.) / iab
# self.exec_logger.debug(f'RAB = {rab:.2f} Ohms')
# if vmn < 0:
# polarity = -1 # TODO: check if we really need to return polarity