-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pull request for Alicat Python Library #15
Changes from 16 commits
16b8bbb
02543a4
73c7eb6
8e45ec1
ba4824a
205bae3
e622141
fe3006a
600de27
a53d044
c184e3c
35cb352
d4a4a0e
ce11b04
590e69d
dcbf2e3
d486169
3d791c1
26adb66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,13 +24,10 @@ Example Connections | |
|
||
Installation | ||
============ | ||
|
||
``` | ||
pip install alicat | ||
``` | ||
|
||
If you don't like pip, you can also install from source: | ||
|
||
``` | ||
git clone https://github.com/numat/alicat.git | ||
cd alicat | ||
|
@@ -80,10 +77,48 @@ You can also set the gas type and flow rate / pressure. | |
|
||
```python | ||
flow_controller.set_gas('N2') | ||
flow_controller.set_gas(8) # Optionally set a gas by its number; find the full gas table in the Alicat manual. | ||
flow_controller.set_flow_rate(1.0) | ||
flow_controller.set_pressure(20) | ||
``` | ||
|
||
For firmware 5v and greater, create and set gas mixes using COMPOSER software loaded into the device. Mixes can contain up to five gases, and are stored in gas indices 236-255. | ||
|
||
```python | ||
flow_controller.create_mix(mix_no=236, name="Mix1", gases={'N2': 50, 'O2': 30, 'CO2': 20}) | ||
flow_controller.set_gas(236) | ||
flow_controller.delete_mix(236) | ||
``` | ||
|
||
Additional features include override commands to increase device functionality. | ||
|
||
```python | ||
flow_controller.lock() # Lock the front display. | ||
flow_controller.unlock() # Unlock the front display. | ||
flow_controller.hold() # Hold the valve in its current position. | ||
flow_controller.cancel_hold() # Cancel the valve hold. | ||
flow_controller.tare_volumetric() # Tare volumetric hold. | ||
flow_controller.tare_pressure() # Tare pressure. | ||
flow_controller.reset_tot() # Reset totalizer, if totalizer functionality included. | ||
``` | ||
|
||
For flow controllers, read and write PID loop settings for device tuning. | ||
|
||
```python | ||
flow_controller.write_PID_looptype("PD2I") | ||
flow_controller.write_PID_P(4000) | ||
flow_controller.write_PID_D(10) | ||
flow_controller.write_PID_I(4000) | ||
print(flow_controller.read_PID()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also cool! I've been meaning to add PID tweaking to this code since day 1, so it's great to see it here. |
||
|
||
>>>{ | ||
'loop_type': 'PD2I', | ||
'P': '4000', | ||
'D': '10', | ||
'I': '4000' | ||
} | ||
``` | ||
|
||
### Alicat Addressing | ||
|
||
You can have multiple controllers on the same port by using Alicat's `A`-`D` addresses | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ def command_line(): | |
"to read devices routed through a converter.") | ||
parser.add_argument('--address', '-a', default='A', type=str, help="The " | ||
"device address, A-D. Should only be used if multiple " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was there all along, but might as well fix it now. I believe they go A-Z not A-D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup it is A-Z! I changed it. |
||
"flow controllers are connected to one port.") | ||
"flow controllers are connected to one port or if" | ||
"device ID is not A.") | ||
parser.add_argument('--set-gas', '-g', default=None, type=str, | ||
help="Sets the gas type. Supported gas types are: " | ||
"'Air', 'Ar', 'CH4', 'CO', 'CO2', 'C2H6', 'H2', " | ||
|
@@ -35,6 +36,16 @@ def command_line(): | |
parser.add_argument('--stream', '-s', action='store_true', | ||
help="Sends a constant stream of flow controller " | ||
"data, formatted as a tab-separated table.") | ||
parser.add_argument("--lock", "-l", action="store_true", | ||
help="Locks device display.") | ||
parser.add_argument("--unlock", "-u", action="store_true", | ||
help="Unlocks device display.") | ||
parser.add_argument("--hold", "-hd", action="store_true", | ||
help="Holds the valve at the present value.") | ||
parser.add_argument("--cancel-hold", "-c", action="store_true", | ||
help="Cancel valve hold.") | ||
parser.add_argument("--reset-totalizer", "-r", action="store_true", | ||
help="Reset current value of totalizer to zero.") | ||
args = parser.parse_args() | ||
|
||
if args.port.startswith('tcp://'): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool!!