======================== Tecan Fluent Driver Page ======================== This page has all the information specific to the Tecan Fluent driver and adapter. Supported Tecan Fluent versions ------------------------------- Tecan Fluent 2.7, 3.1.11, 3.3, 3.6 with DeckCheck Tecan Fluent Installer ---------------------- You can download the latest installer `here `_. Tecan Fluent Adapter :file:`config.yaml` File --------------------------------------------- .. code-block:: yaml :caption: :file:`config.yaml` log: level: "DEBUG" loggerLevels: - logger: "tutorial" level: "DEBUG" artificial: host: your-instance.artificial.com lab: lab_1a2b3c-4d5e-6f7g-8h9i-123456abcdef adapter: name: FluentTutorialAdapter remoteConfig: False allowAnySequenceId: True # Useful when running in a local dev container plugin: # all resources this adapter can connect to resource: name: "My Fluent" # user friendly name, unique in the adapter id: "asset_name" driver: name: "tecan" # Driver name, this is a non-configurable string that needs to match the driver identity url: "http://fluent.webaddress.com:49835" # URL of the hardware and driver resource_simulation: false # Set to true to run simulation without hardware driver_simulation: false # Set to true to run simulation without a driver cert_file: "adapter/certs/ca.crt" user_name: "" # user name if needed for the fluent software login user_password: "" # password if needed for fluent software login asset_sync: devices: # device string names/prefix must match resource id above "asset_name": { rid: "d1234567-34d0-4391-be64-7aef4e0b28be" } #. Fill in the correct URL and port for the Fluent device. (The IPv4 URL can be obtained on the device by running ipconfig in a command window. The port is listed in the running driver server window.) #. You may update the resource name above if you wish (any unique string will work). #. Fill in the user_name and password if needed. #. If you wish to run in simulation without hardware or without a driver, change resource_simulation or driver_simulation to true, respectively. #. Under asset_sync, match at least one of your devices to a Digital Twin asset ID. You can fill out the rest of the devices later. Consult the corresponding step in :doc:`tutorial_adapter_hardware_setup`. #. Update the artificial section to the correct host and lab. Consult the corresponding step in :doc:`tutorial_adapter_hardware_setup` for how to do this. Tecan Fluent Adapter :file:`adapter/main/plugin.py` File -------------------------------------------------------- .. code-block:: python :caption: :file:`adapter/main/plugin.py` file from artificial.adapter_common import ActionModulePlugin, action_modules from artificial.adapter_common.plugin import PluginContext, plugin_config from artificial.fluent.actions import FluentActions from artificial.fluent.core import FluentResource from artificial.fluent.driver_client_simulator import FluentDriverMock from artificial.fluent.event_handler import FluentEventHandler from artificial.fluent.models import FluentPluginConfig from artificial.logging import get_logger from artificial.resource_base.asset_syncer import ResourceAssetSyncer from artificial.resource_base.models import SyncConfig logger = get_logger(__name__) @action_modules(FluentActions) class AdapterPlugin(ActionModulePlugin): # Register the config to be used by the adapter _cfg = plugin_config(FluentPluginConfig) async def setup(self, pctx: PluginContext) -> None: prog_config = pctx.config plugin_conf = self._cfg sync_config: SyncConfig = pctx.raw_config.to_dataclass(SyncConfig, 'adapter.asset_sync') logger.debug(f'sync_config loaded: {sync_config}') # all resources in the adapter use the same res_syncer syncer = pctx.asset_sync_manager_v1(f'ResourceSyncer-{prog_config.adapter.name}') res_syncer = ResourceAssetSyncer(syncer, sync_config) await res_syncer.initialize() # create instances of resources for this adapter resource = FluentResource( pctx.alabPyBase, lab_id=prog_config.artificial.labId, adapter_id=prog_config.adapter.name, resource_id=plugin_conf.resource.id, name=plugin_conf.resource.name, res_syncer=res_syncer, ) if resource: # hook up action modules and event handlers resource.set_driver(driver_config=plugin_conf.resource.driver, simulator=FluentDriverMock()) await resource.set_health_monitors(pctx.lab.health) # register custom action module module = FluentActions(resource) self.add_module(module) logger.debug('Fluent Action module added.') # subscribe to the events event_handler = FluentEventHandler(resource) resource.add_event_handler(event_handler) Tecan Fluent Adapter :file:`adapter/main/__main__.py` File ---------------------------------------------------------- Copy the following list of actors into the file in place of the example actors. .. code-block:: python actors = [ ActorConfig(id='tecan', abilities={'tecan': 1, 'substrate': 1, 'fluent': 1}), ActorConfig(id='fluent', abilities={'exclusive_locks_global': 1, 'exclusive_locks_fluent': 1}), ] Tecan Fluent Adapter :file:`pyproject.toml` Dependencies -------------------------------------------------------- | Add to the :code:`[project]` section the following packages. By running | ```uv add artificial-fluent-resource-library==1.0.*``` Resulting :file:`pyproject.toml` file .. code-block:: python [project] dependencies = [ "artificial-fluent-resource-library==1.0.*", ] Tecan Fluent Simple Connectivity Workflow ----------------------------------------- This workflow will run a method of your choosing and log a message in the UI upon successful completion. You will define which method to run in the request UI by inputting the method name with its full path (e.g., C://Methods//mymethod.med). After copying this code into a file, remember to replace the lab_guid in the workflow heading with the one from your Lab (most easily found by opening the Lab in Artificial and looking in the browser address bar). Consult :doc:`tutorial_adding_tutorial_workflow` for more info. .. code-block:: python from typing import List from artificial.workflows.decorators import parameter, workflow from artificial.workflows.runtime import show_info from artificial.workflows.util import actor_reference, reserve from stubs.stubs_actions import SetRunVariable, VariableType, prepare_and_set_variable, run_method_to_completion class InstrumentActor: pass fluent = actor_reference('fluent', [('fluent', InstrumentActor)], 'Fluent') @parameter('samples', {'uiTitle': 'Samples', 'required': True, 'uiWidget': 'numeric'}) @parameter('protocol_name', {'uiTitle': 'ProtocolName', 'required': True, 'uiWidget': 'text'}) @workflow( 'Simple Fluent Connectivity Test Workflow', 'simple_fluent_connectivity_test_workflow', 'lab_c4d10630-20db-49a4-85dc-f90c1eb30228', interactive=True, ) async def simple_fluent_connectivity_test_workflow( protocol_name: str = '', samples: int = 2, ) -> None: protocol_full_name = protocol_name # used for testing set variables params: List[VariableType] = [ VariableType(var_name='samples', var_value=str(samples), var_type='string'), ] with reserve(fluent, InstrumentActor, runtime_only=True): # type: ignore run_variable: SetRunVariable = await prepare_and_set_variable(protocol_full_name=protocol_full_name, parameters=params) await run_method_to_completion(protocol_full_name=protocol_full_name, run_id=run_variable.run_id, parameters=params) await show_info('Congratulations, you successfully ran your hardware!', 'Hardware Success')