Commit d233eb9d authored by Daniel Friesel's avatar Daniel Friesel
Browse files

add --voltage-only, --current-only. Up to 24 Hz sample rate now!

parent 3b9c08c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -12,7 +12,7 @@ through voltage/current slopes for automated I-V curve measurements.
It has been successfully used with "RND 320-KA3005P" (single-channel) and "RND
It has been successfully used with "RND 320-KA3005P" (single-channel) and "RND
320-KA3305P" (dual-channel) supplies. Observed attributes:
320-KA3305P" (dual-channel) supplies. Observed attributes:


* Time resolution: **a few Hz**
* Time resolution: 10 .. 24 Hz
* Voltage range: 0 .. 30 V
* Voltage range: 0 .. 30 V
* Voltage resolution: 10 mV
* Voltage resolution: 10 mV
* Current range: 0 .. 5 A
* Current range: 0 .. 5 A
+23 −3
Original line number Original line Diff line number Diff line
@@ -253,6 +253,8 @@ def measure_data(
    voltage_range=(None, None, None),
    voltage_range=(None, None, None),
    current_range=(None, None, None),
    current_range=(None, None, None),
    on_off=False,
    on_off=False,
    log_voltage=True,
    log_current=True,
):
):
    global terminate_measurement
    global terminate_measurement


@@ -311,12 +313,18 @@ def measure_data(
    print("# Timestamp Voltage Current", file=output_handle)
    print("# Timestamp Voltage Current", file=output_handle)
    while not terminate_measurement:
    while not terminate_measurement:
        ts = time.time()
        ts = time.time()
        current = korad.get_current()
        if log_current:
        voltage = korad.get_voltage()
            current = korad.get_current()
        else:
            current = None
        if log_voltage:
            voltage = korad.get_voltage()
        else:
            voltage = None
        if voltage is not None and current is not None:
        if voltage is not None and current is not None:
            print(f"{ts:.3f} {voltage:5.2f} {current:5.3f}", file=output_handle)
            print(f"{ts:.3f} {voltage:5.2f} {current:5.3f}", file=output_handle)
        elif voltage is not None:
        elif voltage is not None:
            print(f"{ts:.3f}   {voltage:5.2f}   NaN", file=output_handle)
            print(f"{ts:.3f} {voltage:5.2f}   NaN", file=output_handle)
        elif current is not None:
        elif current is not None:
            print(f"{ts:.3f}   NaN {current:5.3f}", file=output_handle)
            print(f"{ts:.3f}   NaN {current:5.3f}", file=output_handle)
        else:
        else:
@@ -527,6 +535,11 @@ def main():
        metavar="START STOP STEP",
        metavar="START STOP STEP",
        help="Vary voltage limit from START to STOP over the course of the measurement. Adjust by STEP V per second.",
        help="Vary voltage limit from START to STOP over the course of the measurement. Adjust by STEP V per second.",
    )
    )
    parser.add_argument(
        "--voltage-only",
        action="store_true",
        help="Log voltage only (ignore current readings). Useful to increase sample rate for CC measurements.",
    )
    parser.add_argument(
    parser.add_argument(
        "--current-limit",
        "--current-limit",
        type=float,
        type=float,
@@ -538,6 +551,11 @@ def main():
        metavar="START STOP STEP",
        metavar="START STOP STEP",
        help="Vary current limit from START to STOP over the course of the measurement. Adjust by STEP A per second.",
        help="Vary current limit from START to STOP over the course of the measurement. Adjust by STEP A per second.",
    )
    )
    parser.add_argument(
        "--current-only",
        action="store_true",
        help="Log current only (ignore current readings). Useful to increase sample rate for CV measurements.",
    )
    parser.add_argument(
    parser.add_argument(
        "--on-off",
        "--on-off",
        action="store_true",
        action="store_true",
@@ -600,6 +618,8 @@ def main():
            voltage_range=voltage_range,
            voltage_range=voltage_range,
            current_range=current_range,
            current_range=current_range,
            on_off=args.on_off,
            on_off=args.on_off,
            log_voltage=not args.current_only,
            log_current=not args.voltage_only,
        )
        )


    data = parse_data(log_data, skip=args.skip, limit=args.limit)
    data = parse_data(log_data, skip=args.skip, limit=args.limit)