This repository was archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jeff/prologix-startech-stubs
- Loading branch information
Showing
86 changed files
with
15,285 additions
and
327 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
blocks/HARDWARE/MULTIMETERS/KEITHLEY/DMM7510/CONNECT_DMM7510/CONNECT_DMM7510.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from flojoy import VisaDevice, flojoy, TextBlob | ||
from flojoy.connection_manager import DeviceConnectionManager | ||
|
||
|
||
@flojoy | ||
def CONNECT_DMM7510( | ||
device: VisaDevice, | ||
) -> TextBlob: | ||
"""Open a VISA connection to a Keithley DMM7510. | ||
Also sets the communication language to TSP. | ||
Parameters | ||
---------- | ||
device: VisaDevice | ||
The connected VISA device. | ||
Returns | ||
------- | ||
device_addr: TextBlob | ||
The IP or VISA address of the VISA device. | ||
""" | ||
|
||
device_addr = device.get_address() | ||
|
||
dmm = DeviceConnectionManager.tm.add_dmm(device_addr) | ||
dmm.write("*LANG TSP") | ||
lang = dmm.query("*LANG?") | ||
if lang != "TSP": | ||
raise ValueError( | ||
"Command set language not set correctly. Try setting to 'TSP' manually." | ||
) | ||
|
||
DeviceConnectionManager.register_connection(device, dmm) | ||
|
||
return TextBlob(text_blob=device_addr) |
643 changes: 643 additions & 0 deletions
643
blocks/HARDWARE/MULTIMETERS/KEITHLEY/DMM7510/CONNECT_DMM7510/app.json
Large diffs are not rendered by default.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
blocks/HARDWARE/MULTIMETERS/KEITHLEY/DMM7510/CONNECT_DMM7510/block_data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"docstring": { | ||
"long_description": "Also sets the communication language to TSP.", | ||
"short_description": "Open a VISA connection to a Keithley DMM7510.", | ||
"parameters": [ | ||
{ | ||
"name": "device", | ||
"type": "VisaDevice", | ||
"description": "The connected VISA device." | ||
} | ||
], | ||
"returns": [ | ||
{ | ||
"name": "device_addr", | ||
"type": "TextBlob", | ||
"description": "The IP or VISA address of the VISA device." | ||
} | ||
] | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
blocks/HARDWARE/MULTIMETERS/KEITHLEY/DMM7510/CONNECT_DMM7510/example.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
In this example, a DC voltage measurement was extracted from a Keithley DMM7510. | ||
|
||
First the necessary blocks were added: | ||
|
||
- `CONNECT_DMM7510` | ||
- `RESET_DMM7510` | ||
- `FUNCTION_DMM7510` | ||
- `DIGITS_DMM7510` | ||
- `MEASUREMENT_PARAMS_DMM7510` | ||
- `MEASUREMENT_FILTER_DMM7510` | ||
- `READ_DMM7510` | ||
- `BIG_NUMBER` | ||
|
||
The instrument address was set for each `DMM7510` block. The `FUNCTION_DMM7510` block was changed in order to extract the correct measurement. The parameters in `DIGITS_DMM7510`, `MEASUREMENT_PARAMS_DMM7510`, and `MEASUREMENT_FILTER_DMM7510` blocks were changed as necessary. The `READ_DMM7510` block was connected to the `BIG_NUMBER` block in order to view the reading. | ||
|
||
The blocks were connected as shown and the app was run. |
67 changes: 67 additions & 0 deletions
67
...ks/HARDWARE/MULTIMETERS/KEITHLEY/DMM7510/DIGITIZED_TIME_DMM7510/DIGITIZED_TIME_DMM7510.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from typing import Optional, Literal | ||
from flojoy import VisaConnection, flojoy, DataContainer, OrderedPair | ||
|
||
|
||
@flojoy(inject_connection=True) | ||
def DIGITIZED_TIME_DMM7510( | ||
connection: VisaConnection, | ||
input: Optional[DataContainer] = None, | ||
function: Literal[ | ||
"Digitize voltage", | ||
"Digitize current", | ||
] = "Digitize voltage", | ||
num_samples: int = 100, | ||
sample_rate: float = 1e3, | ||
range: float = 1, | ||
) -> OrderedPair: | ||
"""Measures digitized data vs time. | ||
Requires a CONNECT_DMM7510 block to create the connection. | ||
Parameters | ||
---------- | ||
connection : VisaConnection | ||
The VISA address (requires the CONNECTION_DMM7510 block). | ||
function : select, default=Digitize voltage | ||
Select the measurement function | ||
num_samples : int, default=100 | ||
The number of points/samples to measure. | ||
sample_rate : float, default=1000 | ||
The number of samples per second. | ||
range : float, default=1 | ||
The range of the function measurement. | ||
Returns | ||
------- | ||
OrderedPair | ||
x: time | ||
y: measurements | ||
""" | ||
|
||
dmm = connection.get_handle() | ||
|
||
if function == "Digitize voltage": | ||
dmm.write("dmm.digitize.func = dmm.FUNC_DIGITIZE_VOLTAGE") | ||
else: | ||
dmm.write("dmm.digitize.func = dmm.FUNC_DIGITIZE_CURRENT") | ||
|
||
dmm.write(f"dmm.digitize.range = {range}") | ||
dmm.write(f"dmm.digitize.samplerate = {sample_rate}") | ||
dmm.write(f"dmm.digitize.count = {num_samples}") | ||
|
||
dmm.write("dmm.digitize.aperture = dmm.APERTURE_AUTO") | ||
dmm.commands.dmm.digitize.inputimpedance = "dmm.IMPEDANCE_AUTO" | ||
|
||
dmm.commands.buffer_var["defbuffer1"].capacity = num_samples | ||
dmm.write("defbuffer1.clear()") | ||
dmm.write("dmm.digitize.read()") | ||
|
||
time = [] | ||
y = [] | ||
for cnt in range(1, num_samples + 1): | ||
y.append(float(dmm.commands.buffer_var["defbuffer1"].readings[cnt])) | ||
time.append( | ||
float(dmm.commands.buffer_var["defbuffer1"].relativetimestamps[cnt]) | ||
) | ||
|
||
return OrderedPair(x=time, y=y) |
Oops, something went wrong.