Index: dialin/ui/hd_simulator.py =================================================================== diff -u -rd43342d306686299b04c45c78f9a8636ab0062fa -re55ac65c47c243e4a942688ff9c94805a9cea76b --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision d43342d306686299b04c45c78f9a8636ab0062fa) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision e55ac65c47c243e4a942688ff9c94805a9cea76b) @@ -24,17 +24,16 @@ from threading import Semaphore from random import random from copy import deepcopy -import threading as threadsHere +import threading as threads_here from time import time, sleep -#from math import isclose def catch_exception(f): @functools.wraps(f) def func(*args, **kwargs): try: return f(*args, **kwargs) except Exception as e: - print('Caught an exception in', f.__name__) + print('Caught an exception in', f.__name__, e) return func class ErrorCatcher(type): @@ -166,7 +165,7 @@ self.ui_version = None # start timer handler - self.demoTimer = threadsHere.Timer(1.0, self.run_demoTimer_timeout) + self.demoTimer = threads_here.Timer(1.0, self.run_demoTimer_timeout) self.demoTimer.start() def set_ui_all_publication(self, function_ptr: Callable) -> None: @@ -334,6 +333,10 @@ arterial_high=self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_ARTERIAL_PRESSURE_HIGH_LIMIT_MMHG.value], venous_low=self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_VENOUS_PRESSURE_LOW_LIMIT_MMHG.value], venous_high=self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_VENOUS_PRESSURE_HIGH_LIMIT_MMHG.value] ) + self.arterial_pressure_mid_mmHg = (self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_ARTERIAL_PRESSURE_LOW_LIMIT_MMHG.value] + + self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_ARTERIAL_PRESSURE_HIGH_LIMIT_MMHG.value]) / 2 + self.venous_pressure_mid_mmHg = (self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_VENOUS_PRESSURE_LOW_LIMIT_MMHG.value] + + self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_VENOUS_PRESSURE_HIGH_LIMIT_MMHG.value]) / 2 # Rinseback self.rinseback_volume_set_ml = 80 + 120 # TBD! 80 + should be based on dialyzer blood volume? self.rinsebackVelocity_ml_per_sec = params.data_int[TreatmentParameters.TREATMENT_PARAM_RINSEBACK_FLOW_RATE_ML_MIN.value] / 60.0 @@ -635,7 +638,7 @@ target_uf_rate = self.uf_volume_set_l / self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_TREATMENT_DURATION_MIN.value], # float actual_uf_rate = self.uf_volume_out_l / tx_time_s * 60.0, # float saline_bolus_volume = int(self.salineVolCum_ml), # int - heparin_bolus_volume = self.heparin_out_ml, # float + heparin_bolus_volume = self.heparin_bolus_ml, # float heparin_dispense_rate = self.heparin_rate_ml_per_hr, # float heparin_pre_stop = self.demo_treatment_params.data_int[TreatmentParameters.TREATMENT_PARAM_HEPARIN_PRESTOP_MIN.value], # int heparin_delivered_volume = self.heparin_out_ml, # float @@ -651,7 +654,7 @@ rsp_id = MsgIds.MSG_ID_HD_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE rsp_payload = integer_to_bytearray(EResponse.Accepted) rsp_payload += integer_to_bytearray(RequestRejectReasons.REQUEST_REJECT_REASON_NONE.value) - self.demoSelection = 50 + self.demoSelection = 1 # Reset to beginning (rather than Disinfect choices '= 50') self.demoCount = 0 # immediately #