Skip to content

Add multidimensional sweep coordinates and measurement results - #687

Draft
Abse2001 wants to merge 1 commit into
tscircuit:mainfrom
Abse2001:codex/analog-measurement-results
Draft

Add multidimensional sweep coordinates and measurement results#687
Abse2001 wants to merge 1 commit into
tscircuit:mainfrom
Abse2001:codex/analog-measurement-results

Conversation

@Abse2001

@Abse2001 Abse2001 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add ordered simulation_parameter_sweep_coordinates for multidimensional analysis results while retaining the singular coordinate for one-dimensional compatibility
  • add the RFC-defined aggregated simulation_measurement_result element
  • validate coordinate uniqueness, consistent sweep ordering, aligned measurement values, and finite scalar outputs
  • expose the new result through the simulation exports and AnyCircuitElement
  • regenerate the Circuit JSON documentation and add focused schema tests

RFC context

This implements the Circuit JSON portion of the merged SPICE Simulation Analyses, Stimulus, and Measurements RFC, specifically the multidimensional sweep relationships and measurement-result contract introduced through tscircuit/rfc#11.

The RFC specifies that multidimensional analysis results carry an ordered simulation_parameter_sweep_coordinates array, while one-dimensional results retain simulation_parameter_sweep_coordinate. It also specifies one simulation_measurement_result per measurement, with measurement_values aligned to simulation_parameter_sweep_coordinate_sets in Cartesian-product order.

The immediate use case is a TPS63802 load-regulation simulation: input voltage and load current form a two-dimensional sweep, and each run contributes one scalar regulation measurement. The schemas in this PR remain generic and are not tied to that device.

This PR intentionally covers only the Circuit JSON contract. The corresponding props, core execution, and Circuit-to-SVG rendering work will follow in their respective repositories.

Compatibility

  • existing one-dimensional sweep results remain valid
  • multidimensional results require at least two unique sweep coordinates
  • providing the singular and plural coordinate fields together is rejected
  • measurement results without a parameter sweep contain exactly one scalar value

Validation

  • bun test - 294 tests passed
  • bun run build
  • bunx tsc --noEmit
  • bun run lint:zod
  • bun run check-snake-case
  • bun run generate-docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant