Add degauss command for demagnetizing current sensor cores

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 13:37:21 +07:00
parent 62f3a3690e
commit d1486e9df1

View File

@@ -368,6 +368,15 @@ def cmd_integration(meter: Hioki3193, args: argparse.Namespace) -> None:
print(f"Integrating channels: {status}")
def cmd_degauss(meter: Hioki3193, args: argparse.Namespace) -> None:
"""Degauss (demagnetize) current sensor cores."""
channels = args.channels if args.channels else [5, 6]
items = ",".join(f"I{ch}" for ch in channels)
print(f"Degaussing: {items}")
meter.write(f":DEMAg {items}")
print("Degauss command sent. Wait for the instrument to finish.")
def main() -> None:
parser = argparse.ArgumentParser(
description="HIOKI 3193-10 Power Analyzer GPIB Tool",
@@ -439,6 +448,10 @@ examples:
p_int = sub.add_parser("integration", help="Integration control")
p_int.add_argument("action", choices=["start", "stop", "reset", "status"])
# degauss
p_demag = sub.add_parser("degauss", help="Degauss (demagnetize) current sensor cores")
p_demag.add_argument("channels", nargs="*", type=int, help="Channel numbers (default: 5 6)")
# send
p_send = sub.add_parser("send", help="Send raw SCPI/GPIB command")
p_send.add_argument("raw_command", nargs="+", help="Command string (queries auto-detected by '?')")
@@ -455,6 +468,7 @@ examples:
"efficiency": cmd_efficiency_setup,
"setup-mppt": cmd_setup_mppt,
"integration": cmd_integration,
"degauss": cmd_degauss,
"send": cmd_send,
}