DIGITIZED_TIME_DMM7510
Measures digitized data vs time. Requires a CONNECT_DMM7510 block to create the connection. Params: 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: out : OrderedPair x: time
y: measurements
Python Code
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)
Example
Having problems with this example app? Join our Discord community and we will help you out!
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.