From 5a2cc2d7097c61c4626d5e2eb8594f919c4d1f38 Mon Sep 17 00:00:00 2001 From: Guangxin Zhang Date: Fri, 11 Jul 2025 16:00:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0PRCXI=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BB=E6=9C=BA=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=92=8C=E8=AE=BE=E7=BD=AE=E7=8A=B6=E6=80=81=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A4=BA=E4=BE=8B=E7=94=A8=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + test/experiments/prcxi.json | 4 +- .../devices/liquid_handling/prcxi/prcxi.py | 63 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b6ca0d4..9ba3b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +configs/ ## Python # Byte-compiled / optimized / DLL files diff --git a/test/experiments/prcxi.json b/test/experiments/prcxi.json index 7a26531..4078756 100644 --- a/test/experiments/prcxi.json +++ b/test/experiments/prcxi.json @@ -16,10 +16,10 @@ "_resource_child_name": "deck", "_resource_type": "unilabos.devices.liquid_handling.prcxi.prcxi:PRCXI9300Deck" }, - "host": "127.0.0.1", + "host": "192.168.3.9", "port": 9999, "timeout": 10.0, - "setup": false + "setup": true }, "data": {}, "children": [ diff --git a/unilabos/devices/liquid_handling/prcxi/prcxi.py b/unilabos/devices/liquid_handling/prcxi/prcxi.py index 25180cf..e7e3129 100644 --- a/unilabos/devices/liquid_handling/prcxi/prcxi.py +++ b/unilabos/devices/liquid_handling/prcxi/prcxi.py @@ -1,3 +1,4 @@ +import asyncio import collections import contextlib import json @@ -742,3 +743,65 @@ class PRCXI9300Api: "HoleNumbers": hole_numbers, "LiquidDispensingMethod": liquid_method, } + + +if __name__ == "__main__": + # Example usage + deck = PRCXI9300Deck(name="PRCXI Deck", size_x=100, size_y=100, size_z=100) + plate1 = PRCXI9300Container(name="rackT1", size_x=50, size_y=50, size_z=10, category="plate") + plate1.load_state({ + "Material": { + "uuid": "80652665f6a54402b2408d50b40398df", + "Code": "ZX-001-1000", + "Name": "1000μL Tip头", + "SummaryName": "1000μL Tip头", + "PipetteHeight": 100, + "materialEnum": 1 + } + }) + + plate2 = PRCXI9300Container(name="plateT2", size_x=50, size_y=50, size_z=10, category="plate") + plate2.load_state({ + "Material": { + "uuid": "57b1e4711e9e4a32b529f3132fc5931f", + } + }) + + plate3 = PRCXI9300Container(name="plateT3", size_x=50, size_y=50, size_z=10, category="plate") + plate3.load_state({ + "Material": { + "uuid": "57b1e4711e9e4a32b529f3132fc5931f", + } + }) + + plate4 = PRCXI9300Container(name="rackT4", size_x=50, size_y=50, size_z=10, category="plate") + plate4.load_state({ + "Material": { + "uuid": "80652665f6a54402b2408d50b40398df", + "Code": "ZX-001-1000", + "Name": "1000μL Tip头", + "SummaryName": "1000μL Tip头", + "PipetteHeight": 100, + "materialEnum": 1 + } + }) + + plate5 = PRCXI9300Container(name="plateT5", size_x=50, size_y=50, size_z=10, category="plate") + plate5.load_state({ + "Material": { + "uuid": "57b1e4711e9e4a32b529f3132fc5931f", + } + }) + deck.assign_child_resource(plate1, location=Coordinate(0, 0, 0)) + deck.assign_child_resource(plate2, location=Coordinate(0, 0, 0)) + deck.assign_child_resource(plate3, location=Coordinate(0, 0, 0)) + deck.assign_child_resource(plate4, location=Coordinate(0, 0, 0)) + deck.assign_child_resource(plate5, location=Coordinate(0, 0, 0)) + + handler = PRCXI9300Handler(deck=deck, host="192.168.3.9", port=9999, timeout=10.0, setup=True) + asyncio.run(handler.setup()) # Initialize the handler and setup the connection + + + + input("Press Enter to continue...") # Wait for user input before proceeding + print("PRCXI9300Handler initialized with deck and host settings.")