Index: .idea/runConfigurations/dry_demo.xml
===================================================================
diff -u -r6e42c76925267c05e6b5e868d028bca6c2faf46c -re55ac65c47c243e4a942688ff9c94805a9cea76b
--- .idea/runConfigurations/dry_demo.xml (.../dry_demo.xml) (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c)
+++ .idea/runConfigurations/dry_demo.xml (.../dry_demo.xml) (revision e55ac65c47c243e4a942688ff9c94805a9cea76b)
@@ -13,7 +13,7 @@
-
+
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
#
Index: run.py
===================================================================
diff -u -r6e42c76925267c05e6b5e868d028bca6c2faf46c -re55ac65c47c243e4a942688ff9c94805a9cea76b
--- run.py (.../run.py) (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c)
+++ run.py (.../run.py) (revision e55ac65c47c243e4a942688ff9c94805a9cea76b)
@@ -3,6 +3,7 @@
from dialin.ui.hd_simulator import HDSimulator
from dialin.ui.dg_simulator import DGSimulator
from dialin.ui.hd_simulator_alarms import HDAlarmsSimulator
+from sys import argv
hd_auto_response=False
dg_auto_response=False
@@ -13,6 +14,16 @@
canbus = "can1"
+if __name__ == "__main__":
+ argc = len(argv)
+ if argc > 1:
+ can_chg = str(argv[1])
+ if can_chg.startswith("can"):
+ canbus = can_chg
+
+ print("can set:", canbus)
+
+
hd = HDSimulator(can_interface=canbus, console_out=hd_console_out, passive_mode=hd_passive_mode, auto_response=hd_auto_response)
dg = DGSimulator(can_interface=canbus, console_out=dg_console_out, passive_mode=dg_passive_mode, auto_response=dg_auto_response)
alarm = HDAlarmsSimulator(hd.can_interface, hd.logger)