mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-05 22:15:04 +00:00
fix: Protocol node resource run (#65)
* stir和adjustph的中的bug修不好 * fix sub-resource query in protocol node compiling * add resource placeholder to vessels * add the rest yaml * Update work_station.yaml --------- Co-authored-by: KCFeng425 <2100011801@stu.pku.edu.cn>
This commit is contained in:
@@ -70,11 +70,32 @@ class VirtualMultiwayValve:
|
||||
command: 目标位置 (0-8) 或位置字符串
|
||||
0: transfer pump位置
|
||||
1-8: 其他设备位置
|
||||
'default': 默认位置(0号位)
|
||||
"""
|
||||
try:
|
||||
# 如果是字符串形式的位置,先转换为数字
|
||||
# 🔧 处理特殊字符串命令
|
||||
if isinstance(command, str):
|
||||
pos = int(command)
|
||||
command_lower = command.lower().strip()
|
||||
|
||||
# 处理特殊命令
|
||||
if command_lower in ['default', 'pump', 'transfer_pump', 'home']:
|
||||
pos = 0 # 默认位置为0号位(transfer pump)
|
||||
self.logger.info(f"🔧 特殊命令 '{command}' 映射到位置 {pos}")
|
||||
elif command_lower in ['open']:
|
||||
pos = 0 # open命令也映射到0号位
|
||||
self.logger.info(f"🔧 OPEN命令映射到位置 {pos}")
|
||||
elif command_lower in ['close', 'closed']:
|
||||
# 关闭命令保持当前位置
|
||||
pos = self._current_position
|
||||
self.logger.info(f"🔧 CLOSE命令保持当前位置 {pos}")
|
||||
else:
|
||||
# 尝试转换为数字
|
||||
try:
|
||||
pos = int(command)
|
||||
except ValueError:
|
||||
error_msg = f"无法识别的命令: '{command}'"
|
||||
self.logger.error(f"❌ {error_msg}")
|
||||
raise ValueError(error_msg)
|
||||
else:
|
||||
pos = int(command)
|
||||
|
||||
|
||||
@@ -88,6 +88,20 @@ class VirtualRotavap:
|
||||
) -> bool:
|
||||
"""Execute evaporate action - 简化版 🌪️"""
|
||||
|
||||
# 🔧 新增:确保time参数是数值类型
|
||||
if isinstance(time, str):
|
||||
try:
|
||||
time = float(time)
|
||||
except ValueError:
|
||||
self.logger.error(f"❌ 无法转换时间参数 '{time}' 为数值,使用默认值180.0秒")
|
||||
time = 180.0
|
||||
elif not isinstance(time, (int, float)):
|
||||
self.logger.error(f"❌ 时间参数类型无效: {type(time)},使用默认值180.0秒")
|
||||
time = 180.0
|
||||
|
||||
# 确保time是float类型
|
||||
time = float(time)
|
||||
|
||||
# 🔧 简化处理:如果vessel就是设备自己,直接操作
|
||||
if vessel == self.device_id:
|
||||
debug_print(f"🎯 在设备 {self.device_id} 上直接执行蒸发操作")
|
||||
@@ -158,7 +172,7 @@ class VirtualRotavap:
|
||||
})
|
||||
return False
|
||||
|
||||
# 开始蒸发
|
||||
# 开始蒸发 - 🔧 现在time已经确保是float类型
|
||||
self.logger.info(f"🚀 启动蒸发程序! 预计用时 {time/60:.1f}分钟 ⏱️")
|
||||
|
||||
self.data.update({
|
||||
|
||||
Reference in New Issue
Block a user