mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
更新液体投料方法,支持通过溶剂信息自动计算体积,添加solvents参数并更新文档描述
This commit is contained in:
@@ -208,7 +208,8 @@ class BioyondReactionStation(BioyondWorkstation):
|
|||||||
def liquid_feeding_solvents(
|
def liquid_feeding_solvents(
|
||||||
self,
|
self,
|
||||||
assign_material_name: str,
|
assign_material_name: str,
|
||||||
volume: str,
|
volume: str = None,
|
||||||
|
solvents = None,
|
||||||
titration_type: str = "1",
|
titration_type: str = "1",
|
||||||
time: str = "360",
|
time: str = "360",
|
||||||
torque_variation: int = 2,
|
torque_variation: int = 2,
|
||||||
@@ -218,12 +219,41 @@ class BioyondReactionStation(BioyondWorkstation):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
assign_material_name: 物料名称
|
assign_material_name: 物料名称
|
||||||
volume: 分液量(μL)
|
volume: 分液量(μL),直接指定体积(可选,如果提供solvents则自动计算)
|
||||||
|
solvents: 溶剂信息的字典或JSON字符串(可选),格式如下:
|
||||||
|
{
|
||||||
|
"additional_solvent": 33.55092503597727, # 溶剂体积(mL)
|
||||||
|
"total_liquid_volume": 48.00916988195499
|
||||||
|
}
|
||||||
|
如果提供solvents,则从中提取additional_solvent并转换为μL
|
||||||
titration_type: 是否滴定(1=否, 2=是)
|
titration_type: 是否滴定(1=否, 2=是)
|
||||||
time: 观察时间(分钟)
|
time: 观察时间(分钟)
|
||||||
torque_variation: 是否观察(int类型, 1=否, 2=是)
|
torque_variation: 是否观察(int类型, 1=否, 2=是)
|
||||||
temperature: 温度设定(°C)
|
temperature: 温度设定(°C)
|
||||||
"""
|
"""
|
||||||
|
# 处理 volume 参数:优先使用直接传入的 volume,否则从 solvents 中提取
|
||||||
|
if volume is None and solvents is not None:
|
||||||
|
# 参数类型转换:如果是字符串则解析为字典
|
||||||
|
if isinstance(solvents, str):
|
||||||
|
try:
|
||||||
|
solvents = json.loads(solvents)
|
||||||
|
except json.JSONDecodeError as e:
|
||||||
|
raise ValueError(f"solvents参数JSON解析失败: {str(e)}")
|
||||||
|
|
||||||
|
# 参数验证
|
||||||
|
if not isinstance(solvents, dict):
|
||||||
|
raise ValueError("solvents 必须是字典类型或有效的JSON字符串")
|
||||||
|
|
||||||
|
# 提取 additional_solvent 值
|
||||||
|
additional_solvent = solvents.get("additional_solvent")
|
||||||
|
if additional_solvent is None:
|
||||||
|
raise ValueError("solvents 中没有找到 additional_solvent 字段")
|
||||||
|
|
||||||
|
# 转换为微升(μL) - 从毫升(mL)转换
|
||||||
|
volume = str(float(additional_solvent) * 1000)
|
||||||
|
elif volume is None:
|
||||||
|
raise ValueError("必须提供 volume 或 solvents 参数之一")
|
||||||
|
|
||||||
self.append_to_workflow_sequence('{"web_workflow_name": "Liquid_feeding_solvents"}')
|
self.append_to_workflow_sequence('{"web_workflow_name": "Liquid_feeding_solvents"}')
|
||||||
material_id = self.hardware_interface._get_material_id_by_name(assign_material_name)
|
material_id = self.hardware_interface._get_material_id_by_name(assign_material_name)
|
||||||
if material_id is None:
|
if material_id is None:
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ reaction_station.bioyond:
|
|||||||
feedback: {}
|
feedback: {}
|
||||||
goal:
|
goal:
|
||||||
assign_material_name: assign_material_name
|
assign_material_name: assign_material_name
|
||||||
|
solvents: solvents
|
||||||
temperature: temperature
|
temperature: temperature
|
||||||
time: time
|
time: time
|
||||||
titration_type: titration_type
|
titration_type: titration_type
|
||||||
@@ -127,15 +128,23 @@ reaction_station.bioyond:
|
|||||||
volume: volume
|
volume: volume
|
||||||
goal_default:
|
goal_default:
|
||||||
assign_material_name: ''
|
assign_material_name: ''
|
||||||
temperature: ''
|
solvents: ''
|
||||||
time: ''
|
temperature: '25.00'
|
||||||
titration_type: ''
|
time: '360'
|
||||||
torque_variation: ''
|
titration_type: '1'
|
||||||
|
torque_variation: '2'
|
||||||
volume: ''
|
volume: ''
|
||||||
handles: {}
|
handles:
|
||||||
|
input:
|
||||||
|
- data_key: solvents
|
||||||
|
data_source: handle
|
||||||
|
data_type: object
|
||||||
|
handler_key: solvents
|
||||||
|
io_type: source
|
||||||
|
label: Solvents Data From Calculation Node
|
||||||
result: {}
|
result: {}
|
||||||
schema:
|
schema:
|
||||||
description: 液体投料-溶剂
|
description: 液体投料-溶剂。可以直接提供volume(μL),或通过solvents对象自动从additional_solvent(mL)计算volume。
|
||||||
properties:
|
properties:
|
||||||
feedback: {}
|
feedback: {}
|
||||||
goal:
|
goal:
|
||||||
@@ -143,28 +152,30 @@ reaction_station.bioyond:
|
|||||||
assign_material_name:
|
assign_material_name:
|
||||||
description: 物料名称
|
description: 物料名称
|
||||||
type: string
|
type: string
|
||||||
|
solvents:
|
||||||
|
description: '溶剂信息对象(可选),包含: additional_solvent(溶剂体积mL), total_liquid_volume(总液体体积mL)。如果提供,将自动计算volume'
|
||||||
|
type: string
|
||||||
temperature:
|
temperature:
|
||||||
description: 温度设定(°C)
|
default: '25.00'
|
||||||
|
description: 温度设定(°C),默认25.00
|
||||||
type: string
|
type: string
|
||||||
time:
|
time:
|
||||||
description: 观察时间(分钟)
|
default: '360'
|
||||||
|
description: 观察时间(分钟),默认360
|
||||||
type: string
|
type: string
|
||||||
titration_type:
|
titration_type:
|
||||||
description: 是否滴定(1=否, 2=是)
|
default: '1'
|
||||||
|
description: 是否滴定(1=否, 2=是),默认1
|
||||||
type: string
|
type: string
|
||||||
torque_variation:
|
torque_variation:
|
||||||
description: 是否观察 (1=否, 2=是)
|
default: '2'
|
||||||
|
description: 是否观察 (1=否, 2=是),默认2
|
||||||
type: string
|
type: string
|
||||||
volume:
|
volume:
|
||||||
description: 分液公式(μL)
|
description: 分液量(μL)。可直接提供,或通过solvents参数自动计算
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- volume
|
|
||||||
- assign_material_name
|
- assign_material_name
|
||||||
- time
|
|
||||||
- torque_variation
|
|
||||||
- titration_type
|
|
||||||
- temperature
|
|
||||||
type: object
|
type: object
|
||||||
result: {}
|
result: {}
|
||||||
required:
|
required:
|
||||||
|
|||||||
Reference in New Issue
Block a user