Add CP load mode to 2D sweep and supply sanity checks
- 2D sweep now supports CC (constant current) and CP (constant power) load modes via --load-mode flag (CLI) and combobox (GUI) - Supply capability check before all sweeps: validates max voltage against supply range and prints V/I/P summary - Renamed sweep-vi args from --i-start/stop/step to --l-start/stop/step to reflect that the load setpoint can be current or power - GUI labels update dynamically based on selected load mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -439,10 +439,12 @@ def cmd_efficiency(bench: MPPTTestbench, args: argparse.Namespace) -> None:
|
||||
|
||||
|
||||
def cmd_sweep_vi(bench: MPPTTestbench, args: argparse.Namespace) -> None:
|
||||
"""Run a 2D voltage × load current sweep."""
|
||||
"""Run a 2D voltage × load sweep."""
|
||||
mode = args.load_mode
|
||||
unit = "A" if mode == "CC" else "W"
|
||||
print(
|
||||
f"2D sweep: V={args.v_start:.1f}-{args.v_stop:.1f}V (step {args.v_step:.1f}), "
|
||||
f"I_load={args.i_start:.2f}-{args.i_stop:.2f}A (step {args.i_step:.2f}), "
|
||||
f"{mode}={args.l_start:.2f}-{args.l_stop:.2f}{unit} (step {args.l_step:.2f}), "
|
||||
f"I_limit={args.current_limit:.1f}A, settle={args.settle:.1f}s"
|
||||
)
|
||||
print()
|
||||
@@ -451,11 +453,12 @@ def cmd_sweep_vi(bench: MPPTTestbench, args: argparse.Namespace) -> None:
|
||||
v_start=args.v_start,
|
||||
v_stop=args.v_stop,
|
||||
v_step=args.v_step,
|
||||
i_start=args.i_start,
|
||||
i_stop=args.i_stop,
|
||||
i_step=args.i_step,
|
||||
l_start=args.l_start,
|
||||
l_stop=args.l_stop,
|
||||
l_step=args.l_step,
|
||||
current_limit=args.current_limit,
|
||||
settle_time=args.settle,
|
||||
load_mode=mode,
|
||||
)
|
||||
|
||||
_write_sweep_csv(results, args.output)
|
||||
@@ -564,7 +567,8 @@ examples:
|
||||
%(prog)s sweep --v-start 10 --v-stop 50 --v-step 1 --current-limit 10 -o sweep.csv
|
||||
%(prog)s sweep-load --voltage 75 --current-limit 10 --i-start 1 --i-stop 20 --i-step 1 -o load.csv
|
||||
%(prog)s efficiency --voltage 36 --current-limit 10 --samples 10
|
||||
%(prog)s sweep-vi --v-start 35 --v-stop 100 --v-step 5 --i-start 0.5 --i-stop 30 --i-step 1 --current-limit 35 -o map.csv
|
||||
%(prog)s sweep-vi --v-start 35 --v-stop 100 --v-step 5 --l-start 0.5 --l-stop 30 --l-step 1 --current-limit 35 -o map.csv
|
||||
%(prog)s sweep-vi --v-start 35 --v-stop 100 --v-step 5 --l-start 50 --l-stop 500 --l-step 50 --load-mode CP --current-limit 35 -o map_cp.csv
|
||||
%(prog)s shade-profile --profile cloud_pass.csv --settle 2.0 -o shade_results.csv
|
||||
%(prog)s supply set --voltage 24 --current 10
|
||||
%(prog)s supply on
|
||||
@@ -651,13 +655,14 @@ examples:
|
||||
p_eff.add_argument("--load-value", type=float)
|
||||
|
||||
# sweep-vi (2D)
|
||||
p_svi = sub.add_parser("sweep-vi", help="2D voltage × load current sweep (efficiency map)")
|
||||
p_svi = sub.add_parser("sweep-vi", help="2D voltage × load sweep (efficiency map)")
|
||||
p_svi.add_argument("--v-start", type=float, required=True, help="Start voltage (V)")
|
||||
p_svi.add_argument("--v-stop", type=float, required=True, help="Stop voltage (V)")
|
||||
p_svi.add_argument("--v-step", type=float, required=True, help="Voltage step (V)")
|
||||
p_svi.add_argument("--i-start", type=float, required=True, help="Start load current (A)")
|
||||
p_svi.add_argument("--i-stop", type=float, required=True, help="Stop load current (A)")
|
||||
p_svi.add_argument("--i-step", type=float, required=True, help="Current step (A)")
|
||||
p_svi.add_argument("--l-start", type=float, required=True, help="Start load setpoint (A for CC, W for CP)")
|
||||
p_svi.add_argument("--l-stop", type=float, required=True, help="Stop load setpoint")
|
||||
p_svi.add_argument("--l-step", type=float, required=True, help="Load step size")
|
||||
p_svi.add_argument("--load-mode", choices=["CC", "CP"], default="CC", help="Load mode: CC (current) or CP (power)")
|
||||
p_svi.add_argument("--current-limit", type=float, required=True, help="Supply current limit (A)")
|
||||
p_svi.add_argument("--settle", type=float, default=2.0, help="Settle time per step (s)")
|
||||
p_svi.add_argument("-o", "--output", help="CSV output file")
|
||||
|
||||
Reference in New Issue
Block a user