alicat


Namealicat JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttps://github.com/numat/alicat/
SummaryPython driver for Alicat mass flow controllers.
upload_time2023-11-15 17:41:56
maintainerAlex Ruddick
docs_urlNone
authorPatrick Fuller
requires_python
licenseGPLv2
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            alicat
======

TCP/Serial driver and command line tool for
[Alicat mass flow controllers](http://www.alicat.com/products/mass-flow-meters-and-controllers/mass-flow-controllers/).

<p align="center">
  <img src="http://www.alicat.com/wpinstall/wp-content/uploads/2012/01/gas-mass-flow-controller1.jpg" height="400" />
</p>

*If you are using Analyt-MTC flow controllers, go to [this repository](https://github.com/schlenzmeister/AnalytMTC/wiki) for more info.*

Example Connections
===================

| Type | Usage |
| --- | --- |
| The standard [DB9 cable](http://www.alicat.com/wpinstall/wp-content/uploads/2013/07/MD8DB9.jpg) connected directly to a computer (unix: `/dev/ttyS0`, windows: `COM1`). | Good with older computers that still have the connector. |
| The cable connected to a computer through a [USB converter](https://www.amazon.com/gp/product/B0007T27H8) (unix: `/dev/ttyUSB0`, windows: `COM1`). | Good for newer computers and maker boards such as Raspberry Pis. |
| Multiple cables connected to one port via a [splitter](https://www.amazon.com/gp/product/B007F2E188) and Alicat's addressing (`A`-`Z`). | Good when number of ports is limited. |
| Cables routed through a [TCP device server](https://www.usconverters.com/serial-rs232-ethernet-converter) (`192.168.1.100:23`).

Installation
============

```
pip install alicat
```

Usage
=====

## Command Line

For basic tasks, this driver includes a command-line interface. Read the help
for more.

```
alicat --help
```

## Python
This uses Python ≥3.5's async/await syntax to asynchronously communicate with an Alicat. For example:

```python
import asyncio
from alicat import FlowController

async def get():
    async with FlowController('ip-address:port') as flow_controller:
        print(await flow_controller.get())

asyncio.run(get())
```

If the flow controller is communicating on the specified port, this should
return a dictionary of the form:

```python
{
  'setpoint': 0.0,         # Setpoint, either mass flow rate or pressure
  'control_point': 'flow', # Either 'flow' or 'pressure'
  'gas': 'Air',            # Can be any option in `flow_controller.gases`
  'mass_flow': 0.0,        # Mass flow (in units specified at time of purchase)
  'pressure': 25.46,       # Pressure (normally in psia)
  'temperature': 23.62,    # Temperature (normally in C)
  'total_flow': 0.0,       # Optional. If totalizer function purchased, will be included
  'volumetric_flow': 0.0   # Volumetric flow (in units specified at time of purchase)
}
```

On flow controllers, you can set the flow or pressure setpoints.

```python
await flow_controller.set_flow_rate(1.0)
await flow_controller.set_pressure(20)
```

### Gas Type

You can set the gas type by name or by index. For more on setting by index, see the gas table in your Alicat's manual.

```python
await flow_controller.set_gas('N2')
await flow_controller.set_gas(8)
```

For firmware 5v and greater, you can create and set gas mixes. Mixes can contain up to five gases and are stored in gas indices 236-255.

```python
await flow_controller.create_mix(mix_no=236, name="Mix1", gases={'N2': 50, 'O2': 30, 'CO2': 20})
await flow_controller.set_gas(236)
await flow_controller.delete_mix(236)
```

### PID Parameters

For flow controllers, read and write PID loop settings for device tuning.

```python
await flow_controller.set_pid(p=4000, i=4000, d=10, loop_type='PD2I')
print(await flow_controller.get_pid())
{
    'loop_type': 'PD2I',
    'P': '4000',
    'I': '4000',
    'D': '10',
}
```

### Other Features

Additional features include override commands to increase device functionality.

```python
await flow_controller.lock()            # Lock the front display.
await flow_controller.unlock()          # Unlock the front display.
await flow_controller.hold()            # Hold the valve in its current position.
await flow_controller.cancel_hold()     # Cancel the valve hold.
await flow_controller.tare_volumetric() # Tare volumetric flow.
await flow_controller.tare_pressure()   # Tare pressure.
await flow_controller.reset_totalizer() # Reset totalizer, if totalizer functionality included.
```

### Addressing

You can have multiple controllers on the same port by using Alicat's `A`-`Z` addresses
and an [RS-232 splitter](https://www.amazon.com/gp/product/B007F2E188).

```python
flow_controller_1 = FlowController(address='A')
flow_controller_2 = FlowController(address='B')

await flow_controller_1.set_flow_rate(1.0)
await flow_controller_2.set_flow_rate(0.5)

await flow_controller_1.close() # /dev/ttyUSB0 is still open!
await flow_controller_2.close()
```

### Breaking changes

`0.5.0`
- Support only `asyncio`.  The last version with synchronous code was `0.4.1`.
- Rename `address`/`-a` to `unit`/`-u` to match Alicat's documentation
- Rename `-u` to `-ul` (for `--unlock`)

`0.4.1`
Remove TCP support.  Use `pip install alicat==0.3.1` if needed

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/numat/alicat/",
    "name": "alicat",
    "maintainer": "Alex Ruddick",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "alex@numat-tech.com",
    "keywords": "",
    "author": "Patrick Fuller",
    "author_email": "pat@numat-tech.com",
    "download_url": "https://files.pythonhosted.org/packages/96/86/5a86e867d7de3f4aa9a80cdacff84c8bc59a1ffd5d9731b1d9fc056e41ae/alicat-0.6.1.tar.gz",
    "platform": null,
    "description": "alicat\n======\n\nTCP/Serial driver and command line tool for\n[Alicat mass flow controllers](http://www.alicat.com/products/mass-flow-meters-and-controllers/mass-flow-controllers/).\n\n<p align=\"center\">\n  <img src=\"http://www.alicat.com/wpinstall/wp-content/uploads/2012/01/gas-mass-flow-controller1.jpg\" height=\"400\" />\n</p>\n\n*If you are using Analyt-MTC flow controllers, go to [this repository](https://github.com/schlenzmeister/AnalytMTC/wiki) for more info.*\n\nExample Connections\n===================\n\n| Type | Usage |\n| --- | --- |\n| The standard [DB9 cable](http://www.alicat.com/wpinstall/wp-content/uploads/2013/07/MD8DB9.jpg) connected directly to a computer (unix: `/dev/ttyS0`, windows: `COM1`). | Good with older computers that still have the connector. |\n| The cable connected to a computer through a [USB converter](https://www.amazon.com/gp/product/B0007T27H8) (unix: `/dev/ttyUSB0`, windows: `COM1`). | Good for newer computers and maker boards such as Raspberry Pis. |\n| Multiple cables connected to one port via a [splitter](https://www.amazon.com/gp/product/B007F2E188) and Alicat's addressing (`A`-`Z`). | Good when number of ports is limited. |\n| Cables routed through a [TCP device server](https://www.usconverters.com/serial-rs232-ethernet-converter) (`192.168.1.100:23`).\n\nInstallation\n============\n\n```\npip install alicat\n```\n\nUsage\n=====\n\n## Command Line\n\nFor basic tasks, this driver includes a command-line interface. Read the help\nfor more.\n\n```\nalicat --help\n```\n\n## Python\nThis uses Python \u22653.5's async/await syntax to asynchronously communicate with an Alicat. For example:\n\n```python\nimport asyncio\nfrom alicat import FlowController\n\nasync def get():\n    async with FlowController('ip-address:port') as flow_controller:\n        print(await flow_controller.get())\n\nasyncio.run(get())\n```\n\nIf the flow controller is communicating on the specified port, this should\nreturn a dictionary of the form:\n\n```python\n{\n  'setpoint': 0.0,         # Setpoint, either mass flow rate or pressure\n  'control_point': 'flow', # Either 'flow' or 'pressure'\n  'gas': 'Air',            # Can be any option in `flow_controller.gases`\n  'mass_flow': 0.0,        # Mass flow (in units specified at time of purchase)\n  'pressure': 25.46,       # Pressure (normally in psia)\n  'temperature': 23.62,    # Temperature (normally in C)\n  'total_flow': 0.0,       # Optional. If totalizer function purchased, will be included\n  'volumetric_flow': 0.0   # Volumetric flow (in units specified at time of purchase)\n}\n```\n\nOn flow controllers, you can set the flow or pressure setpoints.\n\n```python\nawait flow_controller.set_flow_rate(1.0)\nawait flow_controller.set_pressure(20)\n```\n\n### Gas Type\n\nYou can set the gas type by name or by index. For more on setting by index, see the gas table in your Alicat's manual.\n\n```python\nawait flow_controller.set_gas('N2')\nawait flow_controller.set_gas(8)\n```\n\nFor firmware 5v and greater, you can create and set gas mixes. Mixes can contain up to five gases and are stored in gas indices 236-255.\n\n```python\nawait flow_controller.create_mix(mix_no=236, name=\"Mix1\", gases={'N2': 50, 'O2': 30, 'CO2': 20})\nawait flow_controller.set_gas(236)\nawait flow_controller.delete_mix(236)\n```\n\n### PID Parameters\n\nFor flow controllers, read and write PID loop settings for device tuning.\n\n```python\nawait flow_controller.set_pid(p=4000, i=4000, d=10, loop_type='PD2I')\nprint(await flow_controller.get_pid())\n{\n    'loop_type': 'PD2I',\n    'P': '4000',\n    'I': '4000',\n    'D': '10',\n}\n```\n\n### Other Features\n\nAdditional features include override commands to increase device functionality.\n\n```python\nawait flow_controller.lock()            # Lock the front display.\nawait flow_controller.unlock()          # Unlock the front display.\nawait flow_controller.hold()            # Hold the valve in its current position.\nawait flow_controller.cancel_hold()     # Cancel the valve hold.\nawait flow_controller.tare_volumetric() # Tare volumetric flow.\nawait flow_controller.tare_pressure()   # Tare pressure.\nawait flow_controller.reset_totalizer() # Reset totalizer, if totalizer functionality included.\n```\n\n### Addressing\n\nYou can have multiple controllers on the same port by using Alicat's `A`-`Z` addresses\nand an [RS-232 splitter](https://www.amazon.com/gp/product/B007F2E188).\n\n```python\nflow_controller_1 = FlowController(address='A')\nflow_controller_2 = FlowController(address='B')\n\nawait flow_controller_1.set_flow_rate(1.0)\nawait flow_controller_2.set_flow_rate(0.5)\n\nawait flow_controller_1.close() # /dev/ttyUSB0 is still open!\nawait flow_controller_2.close()\n```\n\n### Breaking changes\n\n`0.5.0`\n- Support only `asyncio`.  The last version with synchronous code was `0.4.1`.\n- Rename `address`/`-a` to `unit`/`-u` to match Alicat's documentation\n- Rename `-u` to `-ul` (for `--unlock`)\n\n`0.4.1`\nRemove TCP support.  Use `pip install alicat==0.3.1` if needed\n",
    "bugtrack_url": null,
    "license": "GPLv2",
    "summary": "Python driver for Alicat mass flow controllers.",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "https://github.com/numat/alicat/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b80fc8b529d5159de3d7c7ad263c66d78ecd31b24398a0a8b9596fad203b2ec9",
                "md5": "0d626618d82fb610a669518a8ae50f1c",
                "sha256": "713111d3522e7161f3abbdb7d2114c860064944cdd62fb231d25e5ff1e0d13c5"
            },
            "downloads": -1,
            "filename": "alicat-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d626618d82fb610a669518a8ae50f1c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 20605,
            "upload_time": "2023-11-15T17:41:54",
            "upload_time_iso_8601": "2023-11-15T17:41:54.320251Z",
            "url": "https://files.pythonhosted.org/packages/b8/0f/c8b529d5159de3d7c7ad263c66d78ecd31b24398a0a8b9596fad203b2ec9/alicat-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96865a86e867d7de3f4aa9a80cdacff84c8bc59a1ffd5d9731b1d9fc056e41ae",
                "md5": "5937fbd01b2433bc7dce9d3dff186855",
                "sha256": "a99e545bb13629fe3a0f7c404a80ea84937ed3ffa49a0bb3571471acd710dce8"
            },
            "downloads": -1,
            "filename": "alicat-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5937fbd01b2433bc7dce9d3dff186855",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21622,
            "upload_time": "2023-11-15T17:41:56",
            "upload_time_iso_8601": "2023-11-15T17:41:56.412652Z",
            "url": "https://files.pythonhosted.org/packages/96/86/5a86e867d7de3f4aa9a80cdacff84c8bc59a1ffd5d9731b1d9fc056e41ae/alicat-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-15 17:41:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "numat",
    "github_project": "alicat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "alicat"
}
        
Elapsed time: 0.16776s