mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-04 21:35:09 +00:00
大图的问题都修复好了,添加了gassource和vacuum pump的驱动以及注册表
This commit is contained in:
@@ -486,8 +486,8 @@
|
||||
"name": "气源",
|
||||
"children": [],
|
||||
"parent": "ComprehensiveProtocolStation",
|
||||
"type": "container",
|
||||
"class": "container",
|
||||
"type": "device",
|
||||
"class": "virtual_gas_source",
|
||||
"position": {
|
||||
"x": 650,
|
||||
"y": 150,
|
||||
|
||||
46
unilabos/devices/virtual/virtual_gas_source.py
Normal file
46
unilabos/devices/virtual/virtual_gas_source.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import time
|
||||
from typing import Dict, Any, Optional
|
||||
|
||||
|
||||
class VirtualGasSource:
|
||||
"""Virtual gas source for testing"""
|
||||
|
||||
def __init__(self, device_id: Optional[str] = None, config: Optional[Dict[str, Any]] = None, **kwargs):
|
||||
self.device_id = device_id or "unknown_gas_source"
|
||||
self.config = config or {}
|
||||
self.data = {}
|
||||
self._status = "OPEN"
|
||||
|
||||
async def initialize(self) -> bool:
|
||||
"""Initialize virtual gas source"""
|
||||
self.data.update({
|
||||
"status": self._status
|
||||
})
|
||||
return True
|
||||
|
||||
async def cleanup(self) -> bool:
|
||||
"""Cleanup virtual gas source"""
|
||||
return True
|
||||
|
||||
@property
|
||||
def status(self) -> str:
|
||||
return self._status
|
||||
|
||||
def get_status(self) -> str:
|
||||
return self._status
|
||||
|
||||
def set_status(self, string):
|
||||
self._status = string
|
||||
time.sleep(5)
|
||||
|
||||
def open(self):
|
||||
self._status = "OPEN"
|
||||
|
||||
def close(self):
|
||||
self._status = "CLOSED"
|
||||
|
||||
def is_open(self):
|
||||
return self._status
|
||||
|
||||
def is_closed(self):
|
||||
return not self._status
|
||||
47
unilabos/devices/virtual/virtual_vacuum_pump.py
Normal file
47
unilabos/devices/virtual/virtual_vacuum_pump.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import asyncio
|
||||
import time
|
||||
from typing import Dict, Any, Optional
|
||||
|
||||
|
||||
class VirtualVacuumPump:
|
||||
"""Virtual vacuum pump for testing"""
|
||||
|
||||
def __init__(self, device_id: Optional[str] = None, config: Optional[Dict[str, Any]] = None, **kwargs):
|
||||
self.device_id = device_id or "unknown_vacuum_pump"
|
||||
self.config = config or {}
|
||||
self.data = {}
|
||||
self._status = "OPEN"
|
||||
|
||||
async def initialize(self) -> bool:
|
||||
"""Initialize virtual vacuum pump"""
|
||||
self.data.update({
|
||||
"status": self._status
|
||||
})
|
||||
return True
|
||||
|
||||
async def cleanup(self) -> bool:
|
||||
"""Cleanup virtual vacuum pump"""
|
||||
return True
|
||||
|
||||
@property
|
||||
def status(self) -> str:
|
||||
return self._status
|
||||
|
||||
def get_status(self) -> str:
|
||||
return self._status
|
||||
|
||||
def set_status(self, string):
|
||||
self._status = string
|
||||
time.sleep(5)
|
||||
|
||||
def open(self):
|
||||
self._status = "OPEN"
|
||||
|
||||
def close(self):
|
||||
self._status = "CLOSED"
|
||||
|
||||
def is_open(self):
|
||||
return self._status
|
||||
|
||||
def is_closed(self):
|
||||
return not self._status
|
||||
@@ -802,3 +802,85 @@ virtual_separator:
|
||||
type: boolean
|
||||
default: true
|
||||
additionalProperties: false
|
||||
|
||||
virtual_vacuum_pump:
|
||||
description: Virtual vacuum pump
|
||||
class:
|
||||
module: unilabos.devices.virtual.virtual_vacuum_pump:VirtualVacuumPump
|
||||
type: python
|
||||
status_types:
|
||||
status: String
|
||||
action_value_mappings:
|
||||
open:
|
||||
type: EmptyIn
|
||||
goal: {}
|
||||
feedback: {}
|
||||
result: {}
|
||||
close:
|
||||
type: EmptyIn
|
||||
goal: {}
|
||||
feedback: {}
|
||||
result: {}
|
||||
set_status:
|
||||
type: StrSingleInput
|
||||
goal:
|
||||
string: string
|
||||
feedback: {}
|
||||
result: {}
|
||||
handles:
|
||||
- handler_key: out
|
||||
label: out
|
||||
data_type: fluid
|
||||
io_type: target
|
||||
data_source: handle
|
||||
data_key: fluid_in
|
||||
init_param_schema:
|
||||
type: object
|
||||
properties:
|
||||
port:
|
||||
type: string
|
||||
description: "通信端口"
|
||||
default: "VIRTUAL"
|
||||
required:
|
||||
- port
|
||||
|
||||
virtual_gas_source:
|
||||
description: Virtual gas source
|
||||
class:
|
||||
module: unilabos.devices.virtual.virtual_gas_source:VirtualGasSource
|
||||
type: python
|
||||
status_types:
|
||||
status: String
|
||||
action_value_mappings:
|
||||
open:
|
||||
type: EmptyIn
|
||||
goal: {}
|
||||
feedback: {}
|
||||
result: {}
|
||||
close:
|
||||
type: EmptyIn
|
||||
goal: {}
|
||||
feedback: {}
|
||||
result: {}
|
||||
set_status:
|
||||
type: StrSingleInput
|
||||
goal:
|
||||
string: string
|
||||
feedback: {}
|
||||
result: {}
|
||||
handles:
|
||||
- handler_key: out
|
||||
label: out
|
||||
data_type: fluid
|
||||
io_type: source
|
||||
data_source: executor
|
||||
data_key: fluid_out
|
||||
init_param_schema:
|
||||
type: object
|
||||
properties:
|
||||
port:
|
||||
type: string
|
||||
description: "通信端口"
|
||||
default: "VIRTUAL"
|
||||
required:
|
||||
- port
|
||||
|
||||
Reference in New Issue
Block a user