From 196e0f7e2bbd8630a13bc752480fd46fdfba19d2 Mon Sep 17 00:00:00 2001 From: Junhan Chang Date: Fri, 26 Sep 2025 08:12:41 +0800 Subject: [PATCH] fix bioyond station and registry --- .../reaction_station_bioyond_test.json | 67 +++ .../workstation/bioyond_studio/bioyond_rpc.py | 2 +- .../workstation/bioyond_studio/station.py | 26 +- .../devices/reaction_station_bioyong.yaml | 481 ------------------ unilabos/registry/devices/work_station.yaml | 98 ++++ .../resources/bioyond/bottle_carriers.yaml | 40 +- 6 files changed, 187 insertions(+), 527 deletions(-) create mode 100644 test/experiments/reaction_station_bioyond_test.json delete mode 100644 unilabos/registry/devices/reaction_station_bioyong.yaml diff --git a/test/experiments/reaction_station_bioyond_test.json b/test/experiments/reaction_station_bioyond_test.json new file mode 100644 index 00000000..9aeda04f --- /dev/null +++ b/test/experiments/reaction_station_bioyond_test.json @@ -0,0 +1,67 @@ +{ + "nodes": [ + { + "id": "reaction_station_bioyond", + "name": "reaction_station_bioyond", + "children": [ + ], + "parent": null, + "type": "device", + "class": "workstation.bioyond", + "config": { + "bioyond_config": { + "api_key": "DE9BDDA0", + "api_host": "http://192.168.1.200:44388", + "workflow_mappings": { + "reactor_taken_out": "3a16081e-4788-ca37-eff4-ceed8d7019d1", + "reactor_taken_in": "3a160df6-76b3-0957-9eb0-cb496d5721c6", + "Solid_feeding_vials": "3a160877-87e7-7699-7bc6-ec72b05eb5e6", + "Liquid_feeding_vials(non-titration)": "3a167d99-6158-c6f0-15b5-eb030f7d8e47", + "Liquid_feeding_solvents": "3a160824-0665-01ed-285a-51ef817a9046", + "Liquid_feeding(titration)": "3a160824-0665-01ed-285a-51ef817a9046", + "Liquid_feeding_beaker": "3a16087e-124f-8ddb-8ec1-c2dff09ca784", + "Drip_back": "3a162cf9-6aac-565a-ddd7-682ba1796a4a" + } + }, + "deck": { + "_resource_child_name": "Bioyond_Deck", + "_resource_type": "unilabos.resources.bioyond.decks:BIOYOND_PolymerReactionStation_Deck" + }, + "protocol_type": [] + }, + "data": {}, + "children": [ + "Bioyond_Deck" + ] + }, + { + "id": "Bioyond_Deck", + "name": "Bioyond_Deck", + "sample_id": null, + "children": [ + ], + "parent": "reaction_station_bioyond", + "type": "deck", + "class": "OTDeck", + "position": { + "x": 0, + "y": 0, + "z": 0 + }, + "config": { + "type": "OTDeck", + "size_x": 624.3, + "size_y": 565.2, + "size_z": 900, + "with_trash": false, + "rotation": { + "x": 0, + "y": 0, + "z": 0, + "type": "Rotation" + } + }, + "data": {} + } + ] +} \ No newline at end of file diff --git a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py index 9f46dfcf..f545a2ec 100644 --- a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py +++ b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py @@ -8,7 +8,7 @@ from datetime import datetime, timezone from unilabos.device_comms.rpc import BaseRequest from typing import Optional, List, Dict, Any import json -from config import WORKFLOW_TO_SECTION_MAP, WORKFLOW_STEP_IDS, LOCATION_MAPPING +from unilabos.devices.workstation.bioyond_studio.config import WORKFLOW_TO_SECTION_MAP, WORKFLOW_STEP_IDS, LOCATION_MAPPING class SimpleLogger: diff --git a/unilabos/devices/workstation/bioyond_studio/station.py b/unilabos/devices/workstation/bioyond_studio/station.py index bb701576..16ec6302 100644 --- a/unilabos/devices/workstation/bioyond_studio/station.py +++ b/unilabos/devices/workstation/bioyond_studio/station.py @@ -12,7 +12,7 @@ from unilabos.devices.workstation.bioyond_studio.bioyond_rpc import BioyondV1RPC from unilabos.utils.log import logger from unilabos.resources.graphio import resource_bioyond_to_plr -from .config import API_CONFIG, WORKFLOW_MAPPINGS +from unilabos.devices.workstation.bioyond_studio.config import API_CONFIG, WORKFLOW_MAPPINGS class BioyondResourceSynchronizer(ResourceSynchronizer): @@ -101,7 +101,7 @@ class BioyondWorkstation(WorkstationBase): def __init__( self, bioyond_config: Optional[Dict[str, Any]] = None, - deck: Optional[str, Any] = None, + deck: Optional[Any] = None, *args, **kwargs, ): @@ -240,28 +240,6 @@ class BioyondWorkstation(WorkstationBase): "message": str(e) } - def get_bioyond_status(self) -> Dict[str, Any]: - """获取Bioyond系统状态""" - try: - material_manager = self.material_management - - return { - "bioyond_connected": material_manager.bioyond_api_client is not None, - "sync_interval": material_manager.sync_interval, - "total_resources": len(material_manager.plr_resources), - "deck_size": { - "x": material_manager.plr_deck.size_x, - "y": material_manager.plr_deck.size_y, - "z": material_manager.plr_deck.size_z - }, - "bioyond_config": self.bioyond_config - } - except Exception as e: - logger.error(f"获取Bioyond状态失败: {e}") - return { - "error": str(e) - } - def load_bioyond_data_from_file(self, file_path: str) -> bool: """从文件加载Bioyond数据(用于测试)""" try: diff --git a/unilabos/registry/devices/reaction_station_bioyong.yaml b/unilabos/registry/devices/reaction_station_bioyong.yaml deleted file mode 100644 index f14e818e..00000000 --- a/unilabos/registry/devices/reaction_station_bioyong.yaml +++ /dev/null @@ -1,481 +0,0 @@ -reaction_station_bioyong: - category: - - reaction_station_bioyong - class: - action_value_mappings: - drip_back: - feedback: {} - goal: - assign_material_name: assign_material_name - time: time - torque_variation: torque_variation - volume: volume - goal_default: - assign_material_name: '' - time: '' - torque_variation: '' - volume: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationDripBack_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - time: - type: string - torque_variation: - type: string - volume: - type: string - required: - - volume - - assign_material_name - - time - - torque_variation - title: ReactionStationDripBack_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationDripBack_Result - type: object - required: - - goal - title: ReactionStationDripBack - type: object - type: ReactionStationDripBack - liquid_feeding_beaker: - feedback: {} - goal: - assign_material_name: assign_material_name - time: time - torque_variation: torque_variation - volume: volume - goal_default: - assign_material_name: '' - time: '' - titration_type: '' - torque_variation: '' - volume: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationLiquidFeed_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - time: - type: string - titration_type: - type: string - torque_variation: - type: string - volume: - type: string - required: - - titration_type - - volume - - assign_material_name - - time - - torque_variation - title: ReactionStationLiquidFeed_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationLiquidFeed_Result - type: object - required: - - goal - title: ReactionStationLiquidFeed - type: object - type: ReactionStationLiquidFeed - liquid_feeding_solvents: - feedback: {} - goal: - assign_material_name: assign_material_name - time: time - torque_variation: torque_variation - volume: volume - goal_default: - assign_material_name: '' - time: '' - titration_type: '' - torque_variation: '' - volume: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationLiquidFeed_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - time: - type: string - titration_type: - type: string - torque_variation: - type: string - volume: - type: string - required: - - titration_type - - volume - - assign_material_name - - time - - torque_variation - title: ReactionStationLiquidFeed_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationLiquidFeed_Result - type: object - required: - - goal - title: ReactionStationLiquidFeed - type: object - type: ReactionStationLiquidFeed - liquid_feeding_titration: - feedback: {} - goal: - assign_material_name: assign_material_name - time: time - torque_variation: torque_variation - volume: volume - goal_default: - assign_material_name: '' - time: '' - titration_type: '' - torque_variation: '' - volume: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationLiquidFeed_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - time: - type: string - titration_type: - type: string - torque_variation: - type: string - volume: - type: string - required: - - titration_type - - volume - - assign_material_name - - time - - torque_variation - title: ReactionStationLiquidFeed_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationLiquidFeed_Result - type: object - required: - - goal - title: ReactionStationLiquidFeed - type: object - type: ReactionStationLiquidFeed - liquid_feeding_vials_non_titration: - feedback: {} - goal: - assign_material_name: assign_material_name - time: time - torque_variation: torque_variation - volume: volume - goal_default: - assign_material_name: '' - time: '' - titration_type: '' - torque_variation: '' - volume: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationLiquidFeed_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - time: - type: string - titration_type: - type: string - torque_variation: - type: string - volume: - type: string - required: - - titration_type - - volume - - assign_material_name - - time - - torque_variation - title: ReactionStationLiquidFeed_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationLiquidFeed_Result - type: object - required: - - goal - title: ReactionStationLiquidFeed - type: object - type: ReactionStationLiquidFeed - process_and_execute_workflow: - feedback: {} - goal: - task_name: task_name - workflow_name: workflow_name - goal_default: - task_name: '' - workflow_name: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationProExecu_Feedback - type: object - goal: - properties: - task_name: - type: string - workflow_name: - type: string - required: - - workflow_name - - task_name - title: ReactionStationProExecu_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationProExecu_Result - type: object - required: - - goal - title: ReactionStationProExecu - type: object - type: ReactionStationProExecu - reactor_taken_in: - feedback: {} - goal: - assign_material_name: assign_material_name - cutoff: cutoff - temperature: temperature - goal_default: - assign_material_name: '' - cutoff: '' - temperature: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationReaTackIn_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - cutoff: - type: string - temperature: - type: string - required: - - cutoff - - temperature - - assign_material_name - title: ReactionStationReaTackIn_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationReaTackIn_Result - type: object - required: - - goal - title: ReactionStationReaTackIn - type: object - type: ReactionStationReaTackIn - reactor_taken_out: - feedback: {} - goal: {} - goal_default: - command: '' - handles: {} - result: {} - schema: - description: '' - properties: - feedback: - properties: - status: - type: string - required: - - status - title: SendCmd_Feedback - type: object - goal: - properties: - command: - type: string - required: - - command - title: SendCmd_Goal - type: object - result: - properties: - return_info: - type: string - success: - type: boolean - required: - - return_info - - success - title: SendCmd_Result - type: object - required: - - goal - title: SendCmd - type: object - type: SendCmd - solid_feeding_vials: - feedback: {} - goal: - assign_material_name: assign_material_name - material_id: material_id - time: time - torque_variation: torque_variation - goal_default: - assign_material_name: '' - material_id: '' - time: '' - torque_variation: '' - handles: {} - result: - return_info: return_info - schema: - description: '' - properties: - feedback: - properties: {} - required: [] - title: ReactionStationSolidFeedVial_Feedback - type: object - goal: - properties: - assign_material_name: - type: string - material_id: - type: string - time: - type: string - torque_variation: - type: string - required: - - assign_material_name - - material_id - - time - - torque_variation - title: ReactionStationSolidFeedVial_Goal - type: object - result: - properties: - return_info: - type: string - required: - - return_info - title: ReactionStationSolidFeedVial_Result - type: object - required: - - goal - title: ReactionStationSolidFeedVial - type: object - type: ReactionStationSolidFeedVial - module: unilabos.devices.reaction_station.reaction_station_bioyong:BioyongV1RPC - status_types: {} - type: python - config_info: [] - description: reaction_station_bioyong Device - handles: [] - icon: '' - init_param_schema: {} - version: 1.0.0 diff --git a/unilabos/registry/devices/work_station.yaml b/unilabos/registry/devices/work_station.yaml index 74987ee0..48054810 100644 --- a/unilabos/registry/devices/work_station.yaml +++ b/unilabos/registry/devices/work_station.yaml @@ -6044,3 +6044,101 @@ workstation: required: [] type: object version: 1.0.0 +workstation.bioyond: + category: + - work_station + class: + action_value_mappings: + auto-execute_bioyond_sync_workflow: + feedback: {} + goal: {} + goal_default: + parameters: null + handles: {} + result: {} + schema: + description: '' + properties: + feedback: {} + goal: + properties: + parameters: + type: object + required: + - parameters + type: object + result: {} + required: + - goal + title: execute_bioyond_sync_workflow参数 + type: object + type: UniLabJsonCommandAsync + auto-execute_bioyond_update_workflow: + feedback: {} + goal: {} + goal_default: + parameters: null + handles: {} + result: {} + schema: + description: '' + properties: + feedback: {} + goal: + properties: + parameters: + type: object + required: + - parameters + type: object + result: {} + required: + - goal + title: execute_bioyond_update_workflow参数 + type: object + type: UniLabJsonCommandAsync + auto-load_bioyond_data_from_file: + feedback: {} + goal: {} + goal_default: + file_path: null + handles: {} + result: {} + schema: + description: '' + properties: + feedback: {} + goal: + properties: + file_path: + type: string + required: + - file_path + type: object + result: {} + required: + - goal + title: load_bioyond_data_from_file参数 + type: object + type: UniLabJsonCommand + module: unilabos.devices.workstation.bioyond_studio.station:BioyondWorkstation + status_types: {} + type: python + config_info: [] + description: '' + handles: [] + icon: 反应站.webp + init_param_schema: + config: + properties: + bioyond_config: + type: string + deck: + type: string + required: [] + type: object + data: + properties: {} + required: [] + type: object + version: 1.0.0 diff --git a/unilabos/registry/resources/bioyond/bottle_carriers.yaml b/unilabos/registry/resources/bioyond/bottle_carriers.yaml index 221e6c74..0eaba1e3 100644 --- a/unilabos/registry/resources/bioyond/bottle_carriers.yaml +++ b/unilabos/registry/resources/bioyond/bottle_carriers.yaml @@ -1,38 +1,36 @@ -BIOYOND_PolymerStation_6VialCarrier: - category: - - bottle_carriers - class: - module: unilabos.resources.bioyond.bottle_carriers:BIOYOND_PolymerStation_6VialCarrier - type: pylabrobot - description: BIOYOND_PolymerStation_6VialCarrier - handles: [ ] - icon: '' - init_param_schema: { } - registry_type: resource - version: 1.0.0 - BIOYOND_PolymerStation_1BottleCarrier: category: - - bottle_carriers + - bottle_carriers class: module: unilabos.resources.bioyond.bottle_carriers:BIOYOND_PolymerStation_1BottleCarrier type: pylabrobot description: BIOYOND_PolymerStation_1BottleCarrier - handles: [ ] + handles: [] icon: '' - init_param_schema: { } + init_param_schema: {} registry_type: resource version: 1.0.0 - BIOYOND_PolymerStation_1FlaskCarrier: category: - - bottle_carriers + - bottle_carriers class: module: unilabos.resources.bioyond.bottle_carriers:BIOYOND_PolymerStation_1FlaskCarrier type: pylabrobot description: BIOYOND_PolymerStation_1FlaskCarrier - handles: [ ] + handles: [] icon: '' - init_param_schema: { } + init_param_schema: {} registry_type: resource - version: 1.0.0 \ No newline at end of file + version: 1.0.0 +BIOYOND_PolymerStation_6VialCarrier: + category: + - bottle_carriers + class: + module: unilabos.resources.bioyond.bottle_carriers:BIOYOND_PolymerStation_6VialCarrier + type: pylabrobot + description: BIOYOND_PolymerStation_6VialCarrier + handles: [] + icon: '' + init_param_schema: {} + registry_type: resource + version: 1.0.0