circuit-json 0.0.521 → 0.0.523

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4508,10 +4508,72 @@ var cad_cable = z199.object({
4508
4508
  );
4509
4509
  expectTypesMatch(true);
4510
4510
 
4511
- // src/simulation/simulation_voltage_source.ts
4511
+ // src/cad/cad_reference_surface.ts
4512
4512
  import { z as z200 } from "zod";
4513
- var wave_shape = z200.enum(["sinewave", "square", "triangle", "sawtooth"]);
4514
- var percentage = z200.union([z200.string(), z200.number()]).transform((val) => {
4513
+ var FRAME_TOLERANCE = 1e-6;
4514
+ var unitDirection = z200.object({
4515
+ x: z200.number().finite(),
4516
+ y: z200.number().finite(),
4517
+ z: z200.number().finite()
4518
+ }).refine(
4519
+ (v) => Math.abs(Math.hypot(v.x, v.y, v.z) - 1) <= FRAME_TOLERANCE,
4520
+ "Reference surface directions must be unit vectors"
4521
+ );
4522
+ var extent = distance.pipe(z200.number().finite().positive());
4523
+ var cad_reference_surface = z200.object({
4524
+ type: z200.literal("cad_reference_surface"),
4525
+ cad_reference_surface_id: z200.string().min(1),
4526
+ source_component_id: z200.string().min(1).describe(
4527
+ "Owning assembly part's source component ID. The part may have no CAD geometry."
4528
+ ),
4529
+ name: z200.string().trim().min(1).describe(
4530
+ "Reference name, unique within the owning part, e.g. shade in STEM.shade."
4531
+ ),
4532
+ shape: z200.literal("rect"),
4533
+ center: point3.refine(
4534
+ (p) => [p.x, p.y, p.z].every(Number.isFinite),
4535
+ "Reference surface centers must be finite"
4536
+ ).describe(
4537
+ "Resolved surface center in right-handed circuit-world XYZ, millimeters: +X right, +Y top, +Z above. An absolute point after assembly placement."
4538
+ ),
4539
+ normal: unitDirection.describe(
4540
+ "Outward unit normal in circuit-world XYZ. Dimensionless direction; transform with the part's rotation, without translation."
4541
+ ),
4542
+ x_axis: unitDirection.describe(
4543
+ "In-plane unit X direction in circuit-world XYZ, perpendicular to normal. The second tangent is normal cross x_axis, giving a right-handed frame."
4544
+ ),
4545
+ width: extent.optional().describe(
4546
+ "Rectangular extent along x_axis in millimeters. Supply together with height. Omission leaves the surface's display size unspecified."
4547
+ ),
4548
+ height: extent.optional().describe(
4549
+ "Rectangular extent along normal cross x_axis in millimeters. Supply together with width."
4550
+ ),
4551
+ subcircuit_id: z200.string().optional()
4552
+ }).superRefine((surface, ctx) => {
4553
+ if (surface.width === void 0 !== (surface.height === void 0))
4554
+ ctx.addIssue({
4555
+ code: z200.ZodIssueCode.custom,
4556
+ path: ["width"],
4557
+ message: "Provide width and height together"
4558
+ });
4559
+ const { normal: n, x_axis: x } = surface;
4560
+ if (Math.abs(n.x * x.x + n.y * x.y + n.z * x.z) > FRAME_TOLERANCE)
4561
+ ctx.addIssue({
4562
+ code: z200.ZodIssueCode.custom,
4563
+ path: ["x_axis"],
4564
+ message: "x_axis must be perpendicular to normal"
4565
+ });
4566
+ }).describe(
4567
+ "A named assembly mounting surface with a resolved world-space frame. Reference geometry for optional visualization; does not add solid material or electrical connectivity. The producer resolves part placement independently of CAD-model offsets; renderers consume the world frame without reapplying the owning model's transform."
4568
+ );
4569
+ expectTypesMatch(
4570
+ true
4571
+ );
4572
+
4573
+ // src/simulation/simulation_voltage_source.ts
4574
+ import { z as z201 } from "zod";
4575
+ var wave_shape = z201.enum(["sinewave", "square", "triangle", "sawtooth"]);
4576
+ var percentage = z201.union([z201.string(), z201.number()]).transform((val) => {
4515
4577
  if (typeof val === "string") {
4516
4578
  if (val.endsWith("%")) {
4517
4579
  return parseFloat(val.slice(0, -1)) / 100;
@@ -4520,32 +4582,32 @@ var percentage = z200.union([z200.string(), z200.number()]).transform((val) => {
4520
4582
  }
4521
4583
  return val;
4522
4584
  }).pipe(
4523
- z200.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
4585
+ z201.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
4524
4586
  );
4525
- var simulation_dc_voltage_source = z200.object({
4526
- type: z200.literal("simulation_voltage_source"),
4587
+ var simulation_dc_voltage_source = z201.object({
4588
+ type: z201.literal("simulation_voltage_source"),
4527
4589
  simulation_voltage_source_id: getZodPrefixedIdWithDefault(
4528
4590
  "simulation_voltage_source"
4529
4591
  ),
4530
- is_dc_source: z200.literal(true).optional().default(true),
4531
- positive_source_port_id: z200.string().optional(),
4532
- negative_source_port_id: z200.string().optional(),
4533
- positive_source_net_id: z200.string().optional(),
4534
- negative_source_net_id: z200.string().optional(),
4592
+ is_dc_source: z201.literal(true).optional().default(true),
4593
+ positive_source_port_id: z201.string().optional(),
4594
+ negative_source_port_id: z201.string().optional(),
4595
+ positive_source_net_id: z201.string().optional(),
4596
+ negative_source_net_id: z201.string().optional(),
4535
4597
  voltage,
4536
4598
  ac_magnitude: voltage.optional(),
4537
4599
  ac_phase: rotation.optional()
4538
4600
  }).describe("Defines a DC voltage source for simulation");
4539
- var simulation_ac_voltage_source = z200.object({
4540
- type: z200.literal("simulation_voltage_source"),
4601
+ var simulation_ac_voltage_source = z201.object({
4602
+ type: z201.literal("simulation_voltage_source"),
4541
4603
  simulation_voltage_source_id: getZodPrefixedIdWithDefault(
4542
4604
  "simulation_voltage_source"
4543
4605
  ),
4544
- is_dc_source: z200.literal(false),
4545
- terminal1_source_port_id: z200.string().optional(),
4546
- terminal2_source_port_id: z200.string().optional(),
4547
- terminal1_source_net_id: z200.string().optional(),
4548
- terminal2_source_net_id: z200.string().optional(),
4606
+ is_dc_source: z201.literal(false),
4607
+ terminal1_source_port_id: z201.string().optional(),
4608
+ terminal2_source_port_id: z201.string().optional(),
4609
+ terminal1_source_net_id: z201.string().optional(),
4610
+ terminal2_source_net_id: z201.string().optional(),
4549
4611
  voltage: voltage.optional(),
4550
4612
  frequency: frequency.optional(),
4551
4613
  peak_to_peak_voltage: voltage.optional(),
@@ -4560,14 +4622,14 @@ var simulation_ac_voltage_source = z200.object({
4560
4622
  ac_magnitude: voltage.optional(),
4561
4623
  ac_phase: rotation.optional()
4562
4624
  }).describe("Defines an AC voltage source for simulation");
4563
- var simulation_voltage_source = z200.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
4625
+ var simulation_voltage_source = z201.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
4564
4626
  expectTypesMatch(true);
4565
4627
  expectTypesMatch(true);
4566
4628
  expectTypesMatch(true);
4567
4629
 
4568
4630
  // src/simulation/simulation_current_source.ts
4569
- import { z as z201 } from "zod";
4570
- var percentage2 = z201.union([z201.string(), z201.number()]).transform((val) => {
4631
+ import { z as z202 } from "zod";
4632
+ var percentage2 = z202.union([z202.string(), z202.number()]).transform((val) => {
4571
4633
  if (typeof val === "string") {
4572
4634
  if (val.endsWith("%")) {
4573
4635
  return parseFloat(val.slice(0, -1)) / 100;
@@ -4576,32 +4638,32 @@ var percentage2 = z201.union([z201.string(), z201.number()]).transform((val) =>
4576
4638
  }
4577
4639
  return val;
4578
4640
  }).pipe(
4579
- z201.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
4641
+ z202.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
4580
4642
  );
4581
- var simulation_dc_current_source = z201.object({
4582
- type: z201.literal("simulation_current_source"),
4643
+ var simulation_dc_current_source = z202.object({
4644
+ type: z202.literal("simulation_current_source"),
4583
4645
  simulation_current_source_id: getZodPrefixedIdWithDefault(
4584
4646
  "simulation_current_source"
4585
4647
  ),
4586
- is_dc_source: z201.literal(true).optional().default(true),
4587
- positive_source_port_id: z201.string().optional(),
4588
- negative_source_port_id: z201.string().optional(),
4589
- positive_source_net_id: z201.string().optional(),
4590
- negative_source_net_id: z201.string().optional(),
4648
+ is_dc_source: z202.literal(true).optional().default(true),
4649
+ positive_source_port_id: z202.string().optional(),
4650
+ negative_source_port_id: z202.string().optional(),
4651
+ positive_source_net_id: z202.string().optional(),
4652
+ negative_source_net_id: z202.string().optional(),
4591
4653
  current,
4592
4654
  ac_magnitude: current.optional(),
4593
4655
  ac_phase: rotation.optional()
4594
4656
  }).describe("Defines a DC current source for simulation");
4595
- var simulation_ac_current_source = z201.object({
4596
- type: z201.literal("simulation_current_source"),
4657
+ var simulation_ac_current_source = z202.object({
4658
+ type: z202.literal("simulation_current_source"),
4597
4659
  simulation_current_source_id: getZodPrefixedIdWithDefault(
4598
4660
  "simulation_current_source"
4599
4661
  ),
4600
- is_dc_source: z201.literal(false),
4601
- terminal1_source_port_id: z201.string().optional(),
4602
- terminal2_source_port_id: z201.string().optional(),
4603
- terminal1_source_net_id: z201.string().optional(),
4604
- terminal2_source_net_id: z201.string().optional(),
4662
+ is_dc_source: z202.literal(false),
4663
+ terminal1_source_port_id: z202.string().optional(),
4664
+ terminal2_source_port_id: z202.string().optional(),
4665
+ terminal1_source_net_id: z202.string().optional(),
4666
+ terminal2_source_net_id: z202.string().optional(),
4605
4667
  current: current.optional(),
4606
4668
  frequency: frequency.optional(),
4607
4669
  peak_to_peak_current: current.optional(),
@@ -4611,58 +4673,59 @@ var simulation_ac_current_source = z201.object({
4611
4673
  ac_magnitude: current.optional(),
4612
4674
  ac_phase: rotation.optional()
4613
4675
  }).describe("Defines an AC current source for simulation");
4614
- var simulation_current_source = z201.union([simulation_dc_current_source, simulation_ac_current_source]).describe("Defines a current source for simulation");
4676
+ var simulation_current_source = z202.union([simulation_dc_current_source, simulation_ac_current_source]).describe("Defines a current source for simulation");
4615
4677
  expectTypesMatch(true);
4616
4678
  expectTypesMatch(true);
4617
4679
  expectTypesMatch(true);
4618
4680
 
4619
4681
  // src/simulation/simulation_experiment.ts
4620
- import { z as z203 } from "zod";
4682
+ import { z as z204 } from "zod";
4621
4683
 
4622
4684
  // src/simulation/simulation_units.ts
4623
- import { z as z202 } from "zod";
4624
- var simulation_dc_sweep_unit = z202.custom(
4685
+ import { z as z203 } from "zod";
4686
+ var simulation_dc_sweep_unit = z203.custom(
4625
4687
  (dcSweepUnit) => dcSweepUnit === "V" || dcSweepUnit === "A"
4626
4688
  );
4627
- var simulation_parameter_unit = z202.custom(
4689
+ var simulation_parameter_unit = z203.custom(
4628
4690
  (parameterUnit) => parameterUnit === "\u03A9" || parameterUnit === "F" || parameterUnit === "H" || parameterUnit === "V" || parameterUnit === "A"
4629
4691
  );
4630
4692
 
4631
4693
  // src/simulation/simulation_experiment.ts
4632
- var experiment_type = z203.union([
4633
- z203.literal("spice_dc_sweep"),
4634
- z203.literal("spice_dc_operating_point"),
4635
- z203.literal("spice_transient_analysis"),
4636
- z203.literal("spice_ac_analysis")
4694
+ var experiment_type = z204.union([
4695
+ z204.literal("spice_dc_sweep"),
4696
+ z204.literal("spice_dc_operating_point"),
4697
+ z204.literal("spice_transient_analysis"),
4698
+ z204.literal("spice_ac_analysis"),
4699
+ z204.literal("pcb_return_current")
4637
4700
  ]);
4638
- var spice_simulation_options = z203.object({
4639
- method: z203.enum(["trap", "gear"]).optional(),
4640
- reltol: z203.union([z203.number(), z203.string()]).optional(),
4641
- abstol: z203.union([z203.number(), z203.string()]).optional(),
4642
- vntol: z203.union([z203.number(), z203.string()]).optional()
4701
+ var spice_simulation_options = z204.object({
4702
+ method: z204.enum(["trap", "gear"]).optional(),
4703
+ reltol: z204.union([z204.number(), z204.string()]).optional(),
4704
+ abstol: z204.union([z204.number(), z204.string()]).optional(),
4705
+ vntol: z204.union([z204.number(), z204.string()]).optional()
4643
4706
  }).describe("SPICE solver options for a simulation experiment");
4644
- var simulation_experiment = z203.object({
4645
- type: z203.literal("simulation_experiment"),
4707
+ var simulation_experiment = z204.object({
4708
+ type: z204.literal("simulation_experiment"),
4646
4709
  simulation_experiment_id: getZodPrefixedIdWithDefault(
4647
4710
  "simulation_experiment"
4648
4711
  ),
4649
- name: z203.string(),
4712
+ name: z204.string(),
4650
4713
  experiment_type,
4651
4714
  time_per_step: duration_ms.optional(),
4652
4715
  start_time_ms: ms.optional(),
4653
4716
  end_time_ms: ms.optional(),
4654
4717
  spice_options: spice_simulation_options.optional(),
4655
- dc_sweep_voltage_source_id: z203.string().optional(),
4656
- dc_sweep_current_source_id: z203.string().optional(),
4657
- dc_sweep_start: z203.number().optional(),
4658
- dc_sweep_stop: z203.number().optional(),
4659
- dc_sweep_step: z203.number().refine((dcSweepStep) => dcSweepStep !== 0).optional(),
4718
+ dc_sweep_voltage_source_id: z204.string().optional(),
4719
+ dc_sweep_current_source_id: z204.string().optional(),
4720
+ dc_sweep_start: z204.number().optional(),
4721
+ dc_sweep_stop: z204.number().optional(),
4722
+ dc_sweep_step: z204.number().refine((dcSweepStep) => dcSweepStep !== 0).optional(),
4660
4723
  dc_sweep_unit: simulation_dc_sweep_unit.optional(),
4661
- ac_sweep_type: z203.enum(["linear", "decade", "octave"]).optional(),
4662
- ac_samples_per_interval: z203.number().int().positive().optional(),
4663
- ac_sample_count: z203.number().int().positive().optional(),
4664
- ac_start_frequency_hz: z203.number().positive().optional(),
4665
- ac_stop_frequency_hz: z203.number().positive().optional()
4724
+ ac_sweep_type: z204.enum(["linear", "decade", "octave"]).optional(),
4725
+ ac_samples_per_interval: z204.number().int().positive().optional(),
4726
+ ac_sample_count: z204.number().int().positive().optional(),
4727
+ ac_start_frequency_hz: z204.number().positive().optional(),
4728
+ ac_stop_frequency_hz: z204.number().positive().optional()
4666
4729
  }).superRefine((experiment, context) => {
4667
4730
  if (experiment.experiment_type === "spice_dc_sweep") {
4668
4731
  const requiredFields = [
@@ -4674,7 +4737,7 @@ var simulation_experiment = z203.object({
4674
4737
  for (const field of requiredFields) {
4675
4738
  if (experiment[field] === void 0) {
4676
4739
  context.addIssue({
4677
- code: z203.ZodIssueCode.custom,
4740
+ code: z204.ZodIssueCode.custom,
4678
4741
  path: [field],
4679
4742
  message: `${field} is required for a DC sweep`
4680
4743
  });
@@ -4684,7 +4747,7 @@ var simulation_experiment = z203.object({
4684
4747
  const hasCurrentSource = experiment.dc_sweep_current_source_id !== void 0;
4685
4748
  if (hasVoltageSource === hasCurrentSource) {
4686
4749
  context.addIssue({
4687
- code: z203.ZodIssueCode.custom,
4750
+ code: z204.ZodIssueCode.custom,
4688
4751
  path: ["dc_sweep_voltage_source_id"],
4689
4752
  message: "Exactly one DC sweep voltage or current source ID is required"
4690
4753
  });
@@ -4693,35 +4756,35 @@ var simulation_experiment = z203.object({
4693
4756
  if (experiment.experiment_type === "spice_ac_analysis") {
4694
4757
  if (experiment.ac_sweep_type === void 0) {
4695
4758
  context.addIssue({
4696
- code: z203.ZodIssueCode.custom,
4759
+ code: z204.ZodIssueCode.custom,
4697
4760
  path: ["ac_sweep_type"],
4698
4761
  message: "ac_sweep_type is required for an AC analysis"
4699
4762
  });
4700
4763
  }
4701
4764
  if (experiment.ac_start_frequency_hz === void 0) {
4702
4765
  context.addIssue({
4703
- code: z203.ZodIssueCode.custom,
4766
+ code: z204.ZodIssueCode.custom,
4704
4767
  path: ["ac_start_frequency_hz"],
4705
4768
  message: "ac_start_frequency_hz is required for an AC analysis"
4706
4769
  });
4707
4770
  }
4708
4771
  if (experiment.ac_stop_frequency_hz === void 0) {
4709
4772
  context.addIssue({
4710
- code: z203.ZodIssueCode.custom,
4773
+ code: z204.ZodIssueCode.custom,
4711
4774
  path: ["ac_stop_frequency_hz"],
4712
4775
  message: "ac_stop_frequency_hz is required for an AC analysis"
4713
4776
  });
4714
4777
  }
4715
4778
  if (experiment.ac_sweep_type === "linear" && experiment.ac_sample_count === void 0) {
4716
4779
  context.addIssue({
4717
- code: z203.ZodIssueCode.custom,
4780
+ code: z204.ZodIssueCode.custom,
4718
4781
  path: ["ac_sample_count"],
4719
4782
  message: "ac_sample_count is required for a linear AC analysis"
4720
4783
  });
4721
4784
  }
4722
4785
  if ((experiment.ac_sweep_type === "decade" || experiment.ac_sweep_type === "octave") && experiment.ac_samples_per_interval === void 0) {
4723
4786
  context.addIssue({
4724
- code: z203.ZodIssueCode.custom,
4787
+ code: z204.ZodIssueCode.custom,
4725
4788
  path: ["ac_samples_per_interval"],
4726
4789
  message: "ac_samples_per_interval is required for decade and octave AC analyses"
4727
4790
  });
@@ -4731,87 +4794,87 @@ var simulation_experiment = z203.object({
4731
4794
  expectTypesMatch(true);
4732
4795
 
4733
4796
  // src/simulation/simulation_transient_voltage_graph.ts
4734
- import { z as z205 } from "zod";
4797
+ import { z as z206 } from "zod";
4735
4798
 
4736
4799
  // src/simulation/simulation_parameter_sweep_coordinate.ts
4737
- import { z as z204 } from "zod";
4738
- var simulation_parameter_sweep_coordinate = z204.object({
4739
- simulation_parameter_sweep_id: z204.string(),
4740
- sweep_index: z204.number().int().nonnegative(),
4741
- parameter_value: z204.number(),
4800
+ import { z as z205 } from "zod";
4801
+ var simulation_parameter_sweep_coordinate = z205.object({
4802
+ simulation_parameter_sweep_id: z205.string(),
4803
+ sweep_index: z205.number().int().nonnegative(),
4804
+ parameter_value: z205.number(),
4742
4805
  parameter_unit: simulation_parameter_unit
4743
4806
  });
4744
4807
  expectTypesMatch(true);
4745
4808
 
4746
4809
  // src/simulation/simulation_transient_voltage_graph.ts
4747
- var simulation_transient_voltage_graph = z205.object({
4748
- type: z205.literal("simulation_transient_voltage_graph"),
4810
+ var simulation_transient_voltage_graph = z206.object({
4811
+ type: z206.literal("simulation_transient_voltage_graph"),
4749
4812
  simulation_transient_voltage_graph_id: getZodPrefixedIdWithDefault(
4750
4813
  "simulation_transient_voltage_graph"
4751
4814
  ),
4752
- simulation_experiment_id: z205.string(),
4815
+ simulation_experiment_id: z206.string(),
4753
4816
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
4754
- timestamps_ms: z205.array(z205.number()).optional(),
4755
- voltage_levels: z205.array(z205.number()),
4756
- source_component_id: z205.string().optional(),
4757
- subcircuit_connectivity_map_key: z205.string().optional(),
4817
+ timestamps_ms: z206.array(z206.number()).optional(),
4818
+ voltage_levels: z206.array(z206.number()),
4819
+ source_component_id: z206.string().optional(),
4820
+ subcircuit_connectivity_map_key: z206.string().optional(),
4758
4821
  time_per_step: duration_ms,
4759
4822
  start_time_ms: ms,
4760
4823
  end_time_ms: ms,
4761
- name: z205.string().optional(),
4762
- color: z205.string().optional()
4824
+ name: z206.string().optional(),
4825
+ color: z206.string().optional()
4763
4826
  }).describe("Stores voltage measurements over time for a simulation");
4764
4827
  expectTypesMatch(true);
4765
4828
 
4766
4829
  // src/simulation/simulation_transient_current_graph.ts
4767
- import { z as z206 } from "zod";
4768
- var simulation_transient_current_graph = z206.object({
4769
- type: z206.literal("simulation_transient_current_graph"),
4830
+ import { z as z207 } from "zod";
4831
+ var simulation_transient_current_graph = z207.object({
4832
+ type: z207.literal("simulation_transient_current_graph"),
4770
4833
  simulation_transient_current_graph_id: getZodPrefixedIdWithDefault(
4771
4834
  "simulation_transient_current_graph"
4772
4835
  ),
4773
- simulation_experiment_id: z206.string(),
4836
+ simulation_experiment_id: z207.string(),
4774
4837
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
4775
- timestamps_ms: z206.array(z206.number()).optional(),
4776
- current_levels: z206.array(z206.number()),
4777
- source_component_id: z206.string().optional(),
4778
- subcircuit_connectivity_map_key: z206.string().optional(),
4838
+ timestamps_ms: z207.array(z207.number()).optional(),
4839
+ current_levels: z207.array(z207.number()),
4840
+ source_component_id: z207.string().optional(),
4841
+ subcircuit_connectivity_map_key: z207.string().optional(),
4779
4842
  time_per_step: duration_ms,
4780
4843
  start_time_ms: ms,
4781
4844
  end_time_ms: ms,
4782
- name: z206.string().optional(),
4783
- color: z206.string().optional()
4845
+ name: z207.string().optional(),
4846
+ color: z207.string().optional()
4784
4847
  }).describe("Stores current measurements over time for a simulation");
4785
4848
  expectTypesMatch(true);
4786
4849
 
4787
4850
  // src/simulation/simulation_switch.ts
4788
- import { z as z207 } from "zod";
4789
- var simulation_switch = z207.object({
4790
- type: z207.literal("simulation_switch"),
4851
+ import { z as z208 } from "zod";
4852
+ var simulation_switch = z208.object({
4853
+ type: z208.literal("simulation_switch"),
4791
4854
  simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
4792
- source_component_id: z207.string().optional(),
4855
+ source_component_id: z208.string().optional(),
4793
4856
  closes_at: ms.optional(),
4794
4857
  opens_at: ms.optional(),
4795
- starts_closed: z207.boolean().optional(),
4858
+ starts_closed: z208.boolean().optional(),
4796
4859
  switching_frequency: frequency.optional()
4797
4860
  }).describe("Defines a switch for simulation timing control");
4798
4861
  expectTypesMatch(true);
4799
4862
 
4800
4863
  // src/simulation/simulation_voltage_probe.ts
4801
- import { z as z208 } from "zod";
4802
- var simulation_voltage_probe = z208.object({
4803
- type: z208.literal("simulation_voltage_probe"),
4864
+ import { z as z209 } from "zod";
4865
+ var simulation_voltage_probe = z209.object({
4866
+ type: z209.literal("simulation_voltage_probe"),
4804
4867
  simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
4805
4868
  "simulation_voltage_probe"
4806
4869
  ),
4807
- source_component_id: z208.string().optional(),
4808
- name: z208.string().optional(),
4809
- signal_input_source_port_id: z208.string().optional(),
4810
- signal_input_source_net_id: z208.string().optional(),
4811
- reference_input_source_port_id: z208.string().optional(),
4812
- reference_input_source_net_id: z208.string().optional(),
4813
- subcircuit_id: z208.string().optional(),
4814
- color: z208.string().optional()
4870
+ source_component_id: z209.string().optional(),
4871
+ name: z209.string().optional(),
4872
+ signal_input_source_port_id: z209.string().optional(),
4873
+ signal_input_source_net_id: z209.string().optional(),
4874
+ reference_input_source_port_id: z209.string().optional(),
4875
+ reference_input_source_net_id: z209.string().optional(),
4876
+ subcircuit_id: z209.string().optional(),
4877
+ color: z209.string().optional()
4815
4878
  }).describe(
4816
4879
  "Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points."
4817
4880
  ).superRefine((data, ctx) => {
@@ -4821,20 +4884,20 @@ var simulation_voltage_probe = z208.object({
4821
4884
  const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
4822
4885
  if (has_ports && has_nets) {
4823
4886
  ctx.addIssue({
4824
- code: z208.ZodIssueCode.custom,
4887
+ code: z209.ZodIssueCode.custom,
4825
4888
  message: "Cannot mix port and net connections in a differential probe."
4826
4889
  });
4827
4890
  } else if (has_ports) {
4828
4891
  if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
4829
4892
  ctx.addIssue({
4830
- code: z208.ZodIssueCode.custom,
4893
+ code: z209.ZodIssueCode.custom,
4831
4894
  message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
4832
4895
  });
4833
4896
  }
4834
4897
  } else if (has_nets) {
4835
4898
  if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
4836
4899
  ctx.addIssue({
4837
- code: z208.ZodIssueCode.custom,
4900
+ code: z209.ZodIssueCode.custom,
4838
4901
  message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
4839
4902
  });
4840
4903
  }
@@ -4842,7 +4905,7 @@ var simulation_voltage_probe = z208.object({
4842
4905
  } else {
4843
4906
  if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
4844
4907
  ctx.addIssue({
4845
- code: z208.ZodIssueCode.custom,
4908
+ code: z209.ZodIssueCode.custom,
4846
4909
  message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
4847
4910
  });
4848
4911
  }
@@ -4851,20 +4914,20 @@ var simulation_voltage_probe = z208.object({
4851
4914
  expectTypesMatch(true);
4852
4915
 
4853
4916
  // src/simulation/simulation_current_probe.ts
4854
- import { z as z209 } from "zod";
4855
- var simulation_current_probe = z209.object({
4856
- type: z209.literal("simulation_current_probe"),
4917
+ import { z as z210 } from "zod";
4918
+ var simulation_current_probe = z210.object({
4919
+ type: z210.literal("simulation_current_probe"),
4857
4920
  simulation_current_probe_id: getZodPrefixedIdWithDefault(
4858
4921
  "simulation_current_probe"
4859
4922
  ),
4860
- source_component_id: z209.string().optional(),
4861
- name: z209.string().optional(),
4862
- positive_source_port_id: z209.string().optional(),
4863
- negative_source_port_id: z209.string().optional(),
4864
- positive_source_net_id: z209.string().optional(),
4865
- negative_source_net_id: z209.string().optional(),
4866
- subcircuit_id: z209.string().optional(),
4867
- color: z209.string().optional()
4923
+ source_component_id: z210.string().optional(),
4924
+ name: z210.string().optional(),
4925
+ positive_source_port_id: z210.string().optional(),
4926
+ negative_source_port_id: z210.string().optional(),
4927
+ positive_source_net_id: z210.string().optional(),
4928
+ negative_source_net_id: z210.string().optional(),
4929
+ subcircuit_id: z210.string().optional(),
4930
+ color: z210.string().optional()
4868
4931
  }).describe(
4869
4932
  "Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
4870
4933
  ).superRefine((data, ctx) => {
@@ -4876,7 +4939,7 @@ var simulation_current_probe = z209.object({
4876
4939
  const hasNets = hasPositiveNet || hasNegativeNet;
4877
4940
  if (hasPorts && hasNets) {
4878
4941
  ctx.addIssue({
4879
- code: z209.ZodIssueCode.custom,
4942
+ code: z210.ZodIssueCode.custom,
4880
4943
  message: "Cannot mix port and net connections in a current probe."
4881
4944
  });
4882
4945
  return;
@@ -4884,7 +4947,7 @@ var simulation_current_probe = z209.object({
4884
4947
  if (hasPorts) {
4885
4948
  if (!hasPositivePort || !hasNegativePort) {
4886
4949
  ctx.addIssue({
4887
- code: z209.ZodIssueCode.custom,
4950
+ code: z210.ZodIssueCode.custom,
4888
4951
  message: "Current probe using source ports requires both positive_source_port_id and negative_source_port_id."
4889
4952
  });
4890
4953
  }
@@ -4893,71 +4956,71 @@ var simulation_current_probe = z209.object({
4893
4956
  if (hasNets) {
4894
4957
  if (!hasPositiveNet || !hasNegativeNet) {
4895
4958
  ctx.addIssue({
4896
- code: z209.ZodIssueCode.custom,
4959
+ code: z210.ZodIssueCode.custom,
4897
4960
  message: "Current probe using source nets requires both positive_source_net_id and negative_source_net_id."
4898
4961
  });
4899
4962
  }
4900
4963
  return;
4901
4964
  }
4902
4965
  ctx.addIssue({
4903
- code: z209.ZodIssueCode.custom,
4966
+ code: z210.ZodIssueCode.custom,
4904
4967
  message: "A current probe must have either positive/negative source port ids or positive/negative source net ids."
4905
4968
  });
4906
4969
  });
4907
4970
  expectTypesMatch(true);
4908
4971
 
4909
4972
  // src/simulation/simulation_unknown_experiment_error.ts
4910
- import { z as z210 } from "zod";
4973
+ import { z as z211 } from "zod";
4911
4974
  var simulation_unknown_experiment_error = base_circuit_json_error.extend({
4912
- type: z210.literal("simulation_unknown_experiment_error"),
4975
+ type: z211.literal("simulation_unknown_experiment_error"),
4913
4976
  simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
4914
4977
  "simulation_unknown_experiment_error"
4915
4978
  ),
4916
- error_type: z210.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
4917
- simulation_experiment_id: z210.string().optional(),
4918
- subcircuit_id: z210.string().optional()
4979
+ error_type: z211.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
4980
+ simulation_experiment_id: z211.string().optional(),
4981
+ subcircuit_id: z211.string().optional()
4919
4982
  }).describe("An unknown error occurred during the simulation experiment.");
4920
4983
  expectTypesMatch(true);
4921
4984
 
4922
4985
  // src/simulation/simulation_parameter_sweep.ts
4923
- import { z as z211 } from "zod";
4924
- var simulation_parameter_type = z211.enum([
4986
+ import { z as z212 } from "zod";
4987
+ var simulation_parameter_type = z212.enum([
4925
4988
  "resistance",
4926
4989
  "capacitance",
4927
4990
  "inductance",
4928
4991
  "voltage",
4929
4992
  "current"
4930
4993
  ]);
4931
- var simulation_parameter_sweep_base = z211.object({
4932
- type: z211.literal("simulation_parameter_sweep"),
4994
+ var simulation_parameter_sweep_base = z212.object({
4995
+ type: z212.literal("simulation_parameter_sweep"),
4933
4996
  simulation_parameter_sweep_id: getZodPrefixedIdWithDefault(
4934
4997
  "simulation_parameter_sweep"
4935
4998
  ),
4936
- simulation_experiment_id: z211.string(),
4937
- name: z211.string().optional(),
4938
- parameter_values: z211.array(z211.number()).min(1),
4999
+ simulation_experiment_id: z212.string(),
5000
+ name: z212.string().optional(),
5001
+ parameter_values: z212.array(z212.number()).min(1),
4939
5002
  parameter_unit: simulation_parameter_unit
4940
5003
  });
4941
- var simulation_parameter_sweep = z211.discriminatedUnion("parameter_type", [
5004
+ var simulation_parameter_sweep = z212.discriminatedUnion("parameter_type", [
4942
5005
  simulation_parameter_sweep_base.extend({
4943
- parameter_type: z211.literal("resistance"),
4944
- resistor_source_component_id: z211.string()
5006
+ parameter_type: z212.literal("resistance"),
5007
+ resistor_source_component_id: z212.string()
4945
5008
  }),
4946
5009
  simulation_parameter_sweep_base.extend({
4947
- parameter_type: z211.literal("capacitance"),
4948
- capacitor_source_component_id: z211.string()
5010
+ parameter_type: z212.literal("capacitance"),
5011
+ capacitor_source_component_id: z212.string()
4949
5012
  }),
4950
5013
  simulation_parameter_sweep_base.extend({
4951
- parameter_type: z211.literal("inductance"),
4952
- inductor_source_component_id: z211.string()
5014
+ parameter_type: z212.literal("inductance"),
5015
+ inductor_source_component_id: z212.string()
4953
5016
  }),
4954
5017
  simulation_parameter_sweep_base.extend({
4955
- parameter_type: z211.literal("voltage"),
4956
- source_net_id: z211.string()
5018
+ parameter_type: z212.literal("voltage"),
5019
+ source_net_id: z212.string()
4957
5020
  }),
4958
5021
  simulation_parameter_sweep_base.extend({
4959
- parameter_type: z211.literal("current"),
4960
- current_source_component_id: z211.string()
5022
+ parameter_type: z212.literal("current"),
5023
+ current_source_component_id: z212.string()
4961
5024
  })
4962
5025
  ]).describe("Repeats a simulation experiment over component parameter values");
4963
5026
  expectTypesMatch(
@@ -4965,52 +5028,52 @@ expectTypesMatch(
4965
5028
  );
4966
5029
 
4967
5030
  // src/simulation/simulation_dc_operating_point_voltage.ts
4968
- import { z as z212 } from "zod";
4969
- var simulation_dc_operating_point_voltage = z212.object({
4970
- type: z212.literal("simulation_dc_operating_point_voltage"),
5031
+ import { z as z213 } from "zod";
5032
+ var simulation_dc_operating_point_voltage = z213.object({
5033
+ type: z213.literal("simulation_dc_operating_point_voltage"),
4971
5034
  simulation_dc_operating_point_voltage_id: getZodPrefixedIdWithDefault(
4972
5035
  "simulation_dc_operating_point_voltage"
4973
5036
  ),
4974
- simulation_experiment_id: z212.string(),
5037
+ simulation_experiment_id: z213.string(),
4975
5038
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
4976
- simulation_voltage_probe_id: z212.string(),
4977
- voltage: z212.number(),
4978
- name: z212.string().optional(),
4979
- color: z212.string().optional()
5039
+ simulation_voltage_probe_id: z213.string(),
5040
+ voltage: z213.number(),
5041
+ name: z213.string().optional(),
5042
+ color: z213.string().optional()
4980
5043
  });
4981
5044
  expectTypesMatch(true);
4982
5045
 
4983
5046
  // src/simulation/simulation_dc_operating_point_current.ts
4984
- import { z as z213 } from "zod";
4985
- var simulation_dc_operating_point_current = z213.object({
4986
- type: z213.literal("simulation_dc_operating_point_current"),
5047
+ import { z as z214 } from "zod";
5048
+ var simulation_dc_operating_point_current = z214.object({
5049
+ type: z214.literal("simulation_dc_operating_point_current"),
4987
5050
  simulation_dc_operating_point_current_id: getZodPrefixedIdWithDefault(
4988
5051
  "simulation_dc_operating_point_current"
4989
5052
  ),
4990
- simulation_experiment_id: z213.string(),
5053
+ simulation_experiment_id: z214.string(),
4991
5054
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
4992
- simulation_current_probe_id: z213.string(),
4993
- current: z213.number(),
4994
- name: z213.string().optional(),
4995
- color: z213.string().optional()
5055
+ simulation_current_probe_id: z214.string(),
5056
+ current: z214.number(),
5057
+ name: z214.string().optional(),
5058
+ color: z214.string().optional()
4996
5059
  });
4997
5060
  expectTypesMatch(true);
4998
5061
 
4999
5062
  // src/simulation/simulation_dc_sweep_voltage_graph.ts
5000
- import { z as z214 } from "zod";
5001
- var simulation_dc_sweep_voltage_graph = z214.object({
5002
- type: z214.literal("simulation_dc_sweep_voltage_graph"),
5063
+ import { z as z215 } from "zod";
5064
+ var simulation_dc_sweep_voltage_graph = z215.object({
5065
+ type: z215.literal("simulation_dc_sweep_voltage_graph"),
5003
5066
  simulation_dc_sweep_voltage_graph_id: getZodPrefixedIdWithDefault(
5004
5067
  "simulation_dc_sweep_voltage_graph"
5005
5068
  ),
5006
- simulation_experiment_id: z214.string(),
5069
+ simulation_experiment_id: z215.string(),
5007
5070
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
5008
- simulation_voltage_probe_id: z214.string(),
5009
- sweep_values: z214.array(z214.number()),
5071
+ simulation_voltage_probe_id: z215.string(),
5072
+ sweep_values: z215.array(z215.number()),
5010
5073
  sweep_unit: simulation_dc_sweep_unit,
5011
- voltage_levels: z214.array(z214.number()),
5012
- name: z214.string().optional(),
5013
- color: z214.string().optional()
5074
+ voltage_levels: z215.array(z215.number()),
5075
+ name: z215.string().optional(),
5076
+ color: z215.string().optional()
5014
5077
  }).refine(
5015
5078
  (graph) => graph.sweep_values.length === graph.voltage_levels.length,
5016
5079
  {
@@ -5020,20 +5083,20 @@ var simulation_dc_sweep_voltage_graph = z214.object({
5020
5083
  expectTypesMatch(true);
5021
5084
 
5022
5085
  // src/simulation/simulation_dc_sweep_current_graph.ts
5023
- import { z as z215 } from "zod";
5024
- var simulation_dc_sweep_current_graph = z215.object({
5025
- type: z215.literal("simulation_dc_sweep_current_graph"),
5086
+ import { z as z216 } from "zod";
5087
+ var simulation_dc_sweep_current_graph = z216.object({
5088
+ type: z216.literal("simulation_dc_sweep_current_graph"),
5026
5089
  simulation_dc_sweep_current_graph_id: getZodPrefixedIdWithDefault(
5027
5090
  "simulation_dc_sweep_current_graph"
5028
5091
  ),
5029
- simulation_experiment_id: z215.string(),
5092
+ simulation_experiment_id: z216.string(),
5030
5093
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
5031
- simulation_current_probe_id: z215.string(),
5032
- sweep_values: z215.array(z215.number()),
5094
+ simulation_current_probe_id: z216.string(),
5095
+ sweep_values: z216.array(z216.number()),
5033
5096
  sweep_unit: simulation_dc_sweep_unit,
5034
- current_levels: z215.array(z215.number()),
5035
- name: z215.string().optional(),
5036
- color: z215.string().optional()
5097
+ current_levels: z216.array(z216.number()),
5098
+ name: z216.string().optional(),
5099
+ color: z216.string().optional()
5037
5100
  }).refine(
5038
5101
  (graph) => graph.sweep_values.length === graph.current_levels.length,
5039
5102
  {
@@ -5043,29 +5106,29 @@ var simulation_dc_sweep_current_graph = z215.object({
5043
5106
  expectTypesMatch(true);
5044
5107
 
5045
5108
  // src/simulation/simulation_ac_sweep_voltage_graph.ts
5046
- import { z as z217 } from "zod";
5109
+ import { z as z218 } from "zod";
5047
5110
 
5048
5111
  // src/simulation/simulation_complex_sample.ts
5049
- import { z as z216 } from "zod";
5050
- var simulation_complex_sample = z216.object({
5051
- re: z216.number(),
5052
- im: z216.number()
5112
+ import { z as z217 } from "zod";
5113
+ var simulation_complex_sample = z217.object({
5114
+ re: z217.number(),
5115
+ im: z217.number()
5053
5116
  });
5054
5117
  expectTypesMatch(true);
5055
5118
 
5056
5119
  // src/simulation/simulation_ac_sweep_voltage_graph.ts
5057
- var simulation_ac_sweep_voltage_graph = z217.object({
5058
- type: z217.literal("simulation_ac_sweep_voltage_graph"),
5120
+ var simulation_ac_sweep_voltage_graph = z218.object({
5121
+ type: z218.literal("simulation_ac_sweep_voltage_graph"),
5059
5122
  simulation_ac_sweep_voltage_graph_id: getZodPrefixedIdWithDefault(
5060
5123
  "simulation_ac_sweep_voltage_graph"
5061
5124
  ),
5062
- simulation_experiment_id: z217.string(),
5125
+ simulation_experiment_id: z218.string(),
5063
5126
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
5064
- simulation_voltage_probe_id: z217.string(),
5065
- frequencies_hz: z217.array(z217.number()),
5066
- complex_voltages: z217.array(simulation_complex_sample),
5067
- name: z217.string().optional(),
5068
- color: z217.string().optional()
5127
+ simulation_voltage_probe_id: z218.string(),
5128
+ frequencies_hz: z218.array(z218.number()),
5129
+ complex_voltages: z218.array(simulation_complex_sample),
5130
+ name: z218.string().optional(),
5131
+ color: z218.string().optional()
5069
5132
  }).refine(
5070
5133
  (graph) => graph.frequencies_hz.length === graph.complex_voltages.length,
5071
5134
  {
@@ -5075,19 +5138,19 @@ var simulation_ac_sweep_voltage_graph = z217.object({
5075
5138
  expectTypesMatch(true);
5076
5139
 
5077
5140
  // src/simulation/simulation_ac_sweep_current_graph.ts
5078
- import { z as z218 } from "zod";
5079
- var simulation_ac_sweep_current_graph = z218.object({
5080
- type: z218.literal("simulation_ac_sweep_current_graph"),
5141
+ import { z as z219 } from "zod";
5142
+ var simulation_ac_sweep_current_graph = z219.object({
5143
+ type: z219.literal("simulation_ac_sweep_current_graph"),
5081
5144
  simulation_ac_sweep_current_graph_id: getZodPrefixedIdWithDefault(
5082
5145
  "simulation_ac_sweep_current_graph"
5083
5146
  ),
5084
- simulation_experiment_id: z218.string(),
5147
+ simulation_experiment_id: z219.string(),
5085
5148
  simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
5086
- simulation_current_probe_id: z218.string(),
5087
- frequencies_hz: z218.array(z218.number()),
5088
- complex_currents: z218.array(simulation_complex_sample),
5089
- name: z218.string().optional(),
5090
- color: z218.string().optional()
5149
+ simulation_current_probe_id: z219.string(),
5150
+ frequencies_hz: z219.array(z219.number()),
5151
+ complex_currents: z219.array(simulation_complex_sample),
5152
+ name: z219.string().optional(),
5153
+ color: z219.string().optional()
5091
5154
  }).refine(
5092
5155
  (graph) => graph.frequencies_hz.length === graph.complex_currents.length,
5093
5156
  {
@@ -5097,52 +5160,52 @@ var simulation_ac_sweep_current_graph = z218.object({
5097
5160
  expectTypesMatch(true);
5098
5161
 
5099
5162
  // src/simulation/simulation_op_amp.ts
5100
- import { z as z219 } from "zod";
5101
- var simulation_op_amp = z219.object({
5102
- type: z219.literal("simulation_op_amp"),
5163
+ import { z as z220 } from "zod";
5164
+ var simulation_op_amp = z220.object({
5165
+ type: z220.literal("simulation_op_amp"),
5103
5166
  simulation_op_amp_id: getZodPrefixedIdWithDefault("simulation_op_amp"),
5104
- source_component_id: z219.string().optional(),
5105
- inverting_input_source_port_id: z219.string(),
5106
- non_inverting_input_source_port_id: z219.string(),
5107
- output_source_port_id: z219.string(),
5108
- positive_supply_source_port_id: z219.string(),
5109
- negative_supply_source_port_id: z219.string()
5167
+ source_component_id: z220.string().optional(),
5168
+ inverting_input_source_port_id: z220.string(),
5169
+ non_inverting_input_source_port_id: z220.string(),
5170
+ output_source_port_id: z220.string(),
5171
+ positive_supply_source_port_id: z220.string(),
5172
+ negative_supply_source_port_id: z220.string()
5110
5173
  }).describe("Defines a simple ideal operational amplifier for simulation");
5111
5174
  expectTypesMatch(true);
5112
5175
 
5113
5176
  // src/simulation/simulation_spice_subcircuit.ts
5114
- import { z as z220 } from "zod";
5115
- var simulation_spice_subcircuit = z220.object({
5116
- type: z220.literal("simulation_spice_subcircuit"),
5177
+ import { z as z221 } from "zod";
5178
+ var simulation_spice_subcircuit = z221.object({
5179
+ type: z221.literal("simulation_spice_subcircuit"),
5117
5180
  simulation_spice_subcircuit_id: getZodPrefixedIdWithDefault(
5118
5181
  "simulation_spice_subcircuit"
5119
5182
  ),
5120
- source_component_id: z220.string(),
5121
- spice_pin_to_source_port_map: z220.record(z220.string(), z220.string()),
5122
- subcircuit_source: z220.string()
5183
+ source_component_id: z221.string(),
5184
+ spice_pin_to_source_port_map: z221.record(z221.string(), z221.string()),
5185
+ subcircuit_source: z221.string()
5123
5186
  }).describe("Defines a custom SPICE subcircuit model for simulation");
5124
5187
  expectTypesMatch(
5125
5188
  true
5126
5189
  );
5127
5190
 
5128
5191
  // src/simulation/simulation_oscilloscope_trace.ts
5129
- import { z as z221 } from "zod";
5192
+ import { z as z222 } from "zod";
5130
5193
  var hasValue = (value) => value !== void 0;
5131
- var simulation_oscilloscope_trace = z221.object({
5132
- type: z221.literal("simulation_oscilloscope_trace"),
5194
+ var simulation_oscilloscope_trace = z222.object({
5195
+ type: z222.literal("simulation_oscilloscope_trace"),
5133
5196
  simulation_oscilloscope_trace_id: getZodPrefixedIdWithDefault(
5134
5197
  "simulation_oscilloscope_trace"
5135
5198
  ),
5136
- simulation_transient_voltage_graph_id: z221.string().optional(),
5137
- simulation_transient_current_graph_id: z221.string().optional(),
5138
- simulation_voltage_probe_id: z221.string().optional(),
5139
- simulation_current_probe_id: z221.string().optional(),
5140
- display_name: z221.string().optional(),
5141
- color: z221.string().optional(),
5142
- display_center_value: z221.number().optional(),
5143
- display_center_offset_divs: z221.number().optional(),
5144
- volts_per_div: z221.number().positive().optional(),
5145
- amps_per_div: z221.number().positive().optional()
5199
+ simulation_transient_voltage_graph_id: z222.string().optional(),
5200
+ simulation_transient_current_graph_id: z222.string().optional(),
5201
+ simulation_voltage_probe_id: z222.string().optional(),
5202
+ simulation_current_probe_id: z222.string().optional(),
5203
+ display_name: z222.string().optional(),
5204
+ color: z222.string().optional(),
5205
+ display_center_value: z222.number().optional(),
5206
+ display_center_offset_divs: z222.number().optional(),
5207
+ volts_per_div: z222.number().positive().optional(),
5208
+ amps_per_div: z222.number().positive().optional()
5146
5209
  }).describe(
5147
5210
  "Defines how a simulation measurement is rendered as an oscilloscope-style trace."
5148
5211
  ).superRefine((data, ctx) => {
@@ -5156,28 +5219,316 @@ var simulation_oscilloscope_trace = z221.object({
5156
5219
  ].filter(hasValue).length;
5157
5220
  if (voltageReferences + currentReferences !== 1) {
5158
5221
  ctx.addIssue({
5159
- code: z221.ZodIssueCode.custom,
5222
+ code: z222.ZodIssueCode.custom,
5160
5223
  message: "An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."
5161
5224
  });
5162
5225
  }
5163
5226
  if (voltageReferences > 0 && data.amps_per_div !== void 0) {
5164
5227
  ctx.addIssue({
5165
- code: z221.ZodIssueCode.custom,
5228
+ code: z222.ZodIssueCode.custom,
5166
5229
  message: "Voltage oscilloscope traces must use volts_per_div, not amps_per_div."
5167
5230
  });
5168
5231
  }
5169
5232
  if (currentReferences > 0 && data.volts_per_div !== void 0) {
5170
5233
  ctx.addIssue({
5171
- code: z221.ZodIssueCode.custom,
5234
+ code: z222.ZodIssueCode.custom,
5172
5235
  message: "Current oscilloscope traces must use amps_per_div, not volts_per_div."
5173
5236
  });
5174
5237
  }
5175
5238
  });
5176
5239
  expectTypesMatch(true);
5177
5240
 
5241
+ // src/simulation/simulation_return_current_contact.ts
5242
+ import { z as z223 } from "zod";
5243
+ var contact_position = z223.object({
5244
+ x: z223.number().finite(),
5245
+ y: z223.number().finite(),
5246
+ layer: layer_ref
5247
+ });
5248
+ var simulation_return_current_contact = z223.discriminatedUnion("contact_type", [
5249
+ contact_position.extend({
5250
+ contact_type: z223.literal("pcb_port"),
5251
+ pcb_port_id: z223.string().min(1)
5252
+ }),
5253
+ contact_position.extend({
5254
+ contact_type: z223.literal("pcb_via"),
5255
+ pcb_via_id: z223.string().min(1)
5256
+ }),
5257
+ contact_position.extend({
5258
+ contact_type: z223.literal("pcb_copper_pour"),
5259
+ pcb_copper_pour_id: z223.string().min(1)
5260
+ })
5261
+ ]).describe("Identifies the reference conductor at a return-current contact");
5262
+ expectTypesMatch(true);
5263
+
5264
+ // src/simulation/simulation_terminal_port.ts
5265
+ import { z as z224 } from "zod";
5266
+ var simulation_terminal_port = z224.object({
5267
+ signal_pcb_port_id: z224.string().min(1),
5268
+ reference_pcb_port_id: z224.string().min(1).optional(),
5269
+ reference_layer: layer_ref,
5270
+ resistance: z224.number().finite().positive()
5271
+ }).describe(
5272
+ "A two-terminal return-current excitation port with resistance in ohms"
5273
+ );
5274
+ expectTypesMatch(true);
5275
+
5276
+ // src/simulation/simulation_return_current_excitation.ts
5277
+ import { z as z225 } from "zod";
5278
+ var simulation_return_current_excitation = z225.object({
5279
+ type: z225.literal("simulation_return_current_excitation"),
5280
+ simulation_return_current_excitation_id: getZodPrefixedIdWithDefault(
5281
+ "simulation_return_current_excitation"
5282
+ ),
5283
+ simulation_experiment_id: z225.string().min(1),
5284
+ pcb_trace_id: z225.string().min(1),
5285
+ ground_source_net_id: z225.string().min(1),
5286
+ current: z225.number().finite(),
5287
+ return_source: simulation_return_current_contact,
5288
+ return_sink: simulation_return_current_contact,
5289
+ source_port: simulation_terminal_port.optional(),
5290
+ load_port: simulation_terminal_port.optional()
5291
+ }).describe(
5292
+ "Excites a signal trace with signed current in amperes, peak for AC; return_source is near the load and return_sink near the driver for positive current"
5293
+ );
5294
+ expectTypesMatch(true);
5295
+
5296
+ // src/simulation/simulation_pcb_return_current_result.ts
5297
+ import { z as z226 } from "zod";
5298
+ var simulation_pcb_return_current_result = z226.object({
5299
+ type: z226.literal("simulation_pcb_return_current_result"),
5300
+ simulation_pcb_return_current_result_id: getZodPrefixedIdWithDefault(
5301
+ "simulation_pcb_return_current_result"
5302
+ ),
5303
+ simulation_experiment_id: z226.string().min(1),
5304
+ pcb_board_id: z226.string().min(1),
5305
+ simulation_return_current_excitation_ids: z226.array(z226.string().min(1)).min(1).refine(
5306
+ (ids) => new Set(ids).size === ids.length,
5307
+ "Excitation IDs must be unique"
5308
+ ),
5309
+ frequency_hz: z226.number().finite().positive().optional()
5310
+ }).describe(
5311
+ "A PCB return-current result at one frequency, or a frequency-independent result when frequency_hz is absent"
5312
+ );
5313
+ expectTypesMatch(true);
5314
+
5315
+ // src/simulation/simulation_return_current_asset.ts
5316
+ import { z as z227 } from "zod";
5317
+ function createSimulationReturnCurrentAssetSchema(mimetypes) {
5318
+ return asset.extend({
5319
+ project_relative_path: z227.string().min(1),
5320
+ url: z227.string().url()
5321
+ }).superRefine((value, context) => {
5322
+ if (!mimetypes.includes(value.mimetype)) {
5323
+ context.addIssue({
5324
+ code: z227.ZodIssueCode.custom,
5325
+ path: ["mimetype"],
5326
+ message: `Expected one of: ${mimetypes.join(", ")}`
5327
+ });
5328
+ }
5329
+ if (value.url.startsWith("data:")) {
5330
+ const mediaType = /^data:([^;,]*)(?:;[^,]*)?,/i.exec(value.url)?.[1];
5331
+ if (mediaType?.toLowerCase() !== value.mimetype) {
5332
+ context.addIssue({
5333
+ code: z227.ZodIssueCode.custom,
5334
+ path: ["url"],
5335
+ message: "Data URL media type must match asset.mimetype"
5336
+ });
5337
+ }
5338
+ }
5339
+ });
5340
+ }
5341
+ var simulation_return_current_field_asset = createSimulationReturnCurrentAssetSchema([
5342
+ "application/json",
5343
+ "application/gzip"
5344
+ ]);
5345
+ var simulation_return_current_image_asset = createSimulationReturnCurrentAssetSchema(["image/png", "image/webp"]);
5346
+
5347
+ // src/simulation/simulation_pcb_return_current_field.ts
5348
+ import { z as z228 } from "zod";
5349
+ var simulation_pcb_return_current_field = z228.object({
5350
+ type: z228.literal("simulation_pcb_return_current_field"),
5351
+ simulation_pcb_return_current_field_id: getZodPrefixedIdWithDefault(
5352
+ "simulation_pcb_return_current_field"
5353
+ ),
5354
+ simulation_pcb_return_current_result_id: z228.string().min(1),
5355
+ layer: layer_ref,
5356
+ source_net_id: z228.string().min(1),
5357
+ field_type: z228.enum(["real", "complex_phasor"]),
5358
+ min_x: z228.number().finite(),
5359
+ min_y: z228.number().finite(),
5360
+ columns: z228.number().int().positive().safe(),
5361
+ rows: z228.number().int().positive().safe(),
5362
+ cell_width: z228.number().finite().positive(),
5363
+ cell_height: z228.number().finite().positive(),
5364
+ copper_thickness: z228.number().finite().positive(),
5365
+ data_format: z228.literal("simulation_return_current_grid_json_v1"),
5366
+ field_asset: simulation_return_current_field_asset
5367
+ }).superRefine((field, context) => {
5368
+ if (!Number.isSafeInteger(field.columns * field.rows)) {
5369
+ context.addIssue({
5370
+ code: z228.ZodIssueCode.custom,
5371
+ path: ["columns"],
5372
+ message: "The grid cell count must be a safe integer"
5373
+ });
5374
+ }
5375
+ }).describe(
5376
+ "A sampled sheet-current field in A/mm, using plain or gzipped JSON Asset URLs; dimensions are PCB millimeters"
5377
+ );
5378
+ expectTypesMatch(true);
5379
+
5380
+ // src/simulation/simulation_return_current_grid_json.ts
5381
+ import { z as z229 } from "zod";
5382
+ var channel = z229.array(z229.number().finite().nullable()).min(1);
5383
+ var simulation_return_current_grid_json = z229.discriminatedUnion("field_type", [
5384
+ z229.object({
5385
+ field_type: z229.literal("real"),
5386
+ sheet_current_x: channel,
5387
+ sheet_current_y: channel
5388
+ }),
5389
+ z229.object({
5390
+ field_type: z229.literal("complex_phasor"),
5391
+ sheet_current_x_real: channel,
5392
+ sheet_current_x_imag: channel,
5393
+ sheet_current_y_real: channel,
5394
+ sheet_current_y_imag: channel
5395
+ })
5396
+ ]).superRefine((grid, context) => {
5397
+ const channels = grid.field_type === "real" ? [grid.sheet_current_x, grid.sheet_current_y] : [
5398
+ grid.sheet_current_x_real,
5399
+ grid.sheet_current_x_imag,
5400
+ grid.sheet_current_y_real,
5401
+ grid.sheet_current_y_imag
5402
+ ];
5403
+ const first = channels[0];
5404
+ if (channels.some((values) => values.length !== first.length)) {
5405
+ context.addIssue({
5406
+ code: z229.ZodIssueCode.custom,
5407
+ message: "Current channels must have equal lengths"
5408
+ });
5409
+ return;
5410
+ }
5411
+ for (let index = 0; index < first.length; index++) {
5412
+ const masked = first[index] === null;
5413
+ if (channels.some((values) => values[index] === null !== masked)) {
5414
+ context.addIssue({
5415
+ code: z229.ZodIssueCode.custom,
5416
+ message: `Cell ${index} must be null in every channel or finite in every channel`
5417
+ });
5418
+ return;
5419
+ }
5420
+ }
5421
+ }).describe(
5422
+ "Decoded real or complex sheet-current arrays with a shared conductor mask"
5423
+ );
5424
+ expectTypesMatch(true);
5425
+ function getSimulationReturnCurrentGridJsonSchema(field) {
5426
+ const count = field.columns * field.rows;
5427
+ if (!Number.isSafeInteger(field.columns) || field.columns <= 0 || !Number.isSafeInteger(field.rows) || field.rows <= 0 || !Number.isSafeInteger(count))
5428
+ throw new Error("Grid dimensions must be positive safe integers");
5429
+ return simulation_return_current_grid_json.superRefine((grid, context) => {
5430
+ if (grid.field_type !== field.field_type) {
5431
+ context.addIssue({
5432
+ code: z229.ZodIssueCode.custom,
5433
+ path: ["field_type"],
5434
+ message: "Decoded field_type must match the parent field"
5435
+ });
5436
+ }
5437
+ const first = grid.field_type === "real" ? grid.sheet_current_x : grid.sheet_current_x_real;
5438
+ if (first.length !== count) {
5439
+ context.addIssue({
5440
+ code: z229.ZodIssueCode.custom,
5441
+ message: `Each current channel must have ${count} entries (columns * rows)`
5442
+ });
5443
+ }
5444
+ });
5445
+ }
5446
+
5447
+ // src/simulation/simulation_pcb_return_current_heatmap.ts
5448
+ import { z as z230 } from "zod";
5449
+ var simulation_pcb_return_current_heatmap = z230.object({
5450
+ type: z230.literal("simulation_pcb_return_current_heatmap"),
5451
+ simulation_pcb_return_current_heatmap_id: getZodPrefixedIdWithDefault(
5452
+ "simulation_pcb_return_current_heatmap"
5453
+ ),
5454
+ simulation_pcb_return_current_result_id: z230.string().min(1),
5455
+ layer: layer_ref,
5456
+ source_net_id: z230.string().min(1),
5457
+ min_x: z230.number().finite(),
5458
+ min_y: z230.number().finite(),
5459
+ max_x: z230.number().finite(),
5460
+ max_y: z230.number().finite(),
5461
+ image_asset: simulation_return_current_image_asset
5462
+ }).superRefine((heatmap, context) => {
5463
+ for (const axis of ["x", "y"]) {
5464
+ if (heatmap[`max_${axis}`] <= heatmap[`min_${axis}`]) {
5465
+ context.addIssue({
5466
+ code: z230.ZodIssueCode.custom,
5467
+ path: [`max_${axis}`],
5468
+ message: "Heatmap bounds must have positive width and height"
5469
+ });
5470
+ }
5471
+ }
5472
+ }).describe(
5473
+ "A transparent PNG/WebP current-density overlay in A/mm\xB2; the top-left pixel maps to (min_x, max_y)"
5474
+ );
5475
+ expectTypesMatch(true);
5476
+
5477
+ // src/simulation/simulation_pcb_return_current_marker.ts
5478
+ import { z as z231 } from "zod";
5479
+ var marker_base = z231.object({
5480
+ type: z231.literal("simulation_pcb_return_current_marker"),
5481
+ simulation_pcb_return_current_marker_id: getZodPrefixedIdWithDefault(
5482
+ "simulation_pcb_return_current_marker"
5483
+ ),
5484
+ simulation_pcb_return_current_result_id: z231.string().min(1),
5485
+ role: z231.enum([
5486
+ "signal_source",
5487
+ "signal_load",
5488
+ "return_source",
5489
+ "return_sink",
5490
+ "signal_transition",
5491
+ "return_transition"
5492
+ ]),
5493
+ label: z231.string().optional(),
5494
+ label_x: z231.number().finite().optional(),
5495
+ label_y: z231.number().finite().optional()
5496
+ });
5497
+ var simulation_pcb_return_current_marker = z231.discriminatedUnion("target_type", [
5498
+ marker_base.extend({
5499
+ target_type: z231.literal("pcb_port"),
5500
+ pcb_port_id: z231.string().min(1),
5501
+ layer: layer_ref
5502
+ }),
5503
+ marker_base.extend({
5504
+ target_type: z231.literal("pcb_via"),
5505
+ pcb_via_id: z231.string().min(1),
5506
+ from_layer: layer_ref,
5507
+ to_layer: layer_ref
5508
+ })
5509
+ ]).superRefine((marker, context) => {
5510
+ if (marker.label_x === void 0 !== (marker.label_y === void 0)) {
5511
+ context.addIssue({
5512
+ code: z231.ZodIssueCode.custom,
5513
+ path: ["label_x"],
5514
+ message: "label_x and label_y must be provided together"
5515
+ });
5516
+ }
5517
+ if (marker.target_type === "pcb_via" && marker.from_layer === marker.to_layer) {
5518
+ context.addIssue({
5519
+ code: z231.ZodIssueCode.custom,
5520
+ path: ["to_layer"],
5521
+ message: "A via transition must connect distinct layers"
5522
+ });
5523
+ }
5524
+ }).describe(
5525
+ "A signal/return port or via highlight; markers do not assert measured via-transfer currents"
5526
+ );
5527
+ expectTypesMatch(true);
5528
+
5178
5529
  // src/any_circuit_element.ts
5179
- import { z as z222 } from "zod";
5180
- var any_circuit_element = z222.union([
5530
+ import { z as z232 } from "zod";
5531
+ var any_circuit_element = z232.union([
5181
5532
  source_runtime_error,
5182
5533
  source_trace,
5183
5534
  source_bus,
@@ -5336,10 +5687,16 @@ var any_circuit_element = z222.union([
5336
5687
  schematic_table_cell,
5337
5688
  cad_component,
5338
5689
  cad_cable,
5690
+ cad_reference_surface,
5339
5691
  cad_collision_error,
5340
5692
  simulation_voltage_source,
5341
5693
  simulation_current_source,
5342
5694
  simulation_experiment,
5695
+ simulation_return_current_excitation,
5696
+ simulation_pcb_return_current_result,
5697
+ simulation_pcb_return_current_field,
5698
+ simulation_pcb_return_current_heatmap,
5699
+ simulation_pcb_return_current_marker,
5343
5700
  simulation_transient_voltage_graph,
5344
5701
  simulation_transient_current_graph,
5345
5702
  simulation_dc_operating_point_voltage,
@@ -5375,6 +5732,7 @@ export {
5375
5732
  cad_component,
5376
5733
  cad_model_axis_directions,
5377
5734
  cad_model_formats,
5735
+ cad_reference_surface,
5378
5736
  capacitance,
5379
5737
  circle_shape,
5380
5738
  circuit_json_footprint_load_error,
@@ -5385,6 +5743,7 @@ export {
5385
5743
  external_footprint_load_error,
5386
5744
  frequency,
5387
5745
  getRotationBetweenPcbPin1Locations,
5746
+ getSimulationReturnCurrentGridJsonSchema,
5388
5747
  getZodPrefixedIdWithDefault,
5389
5748
  inductance,
5390
5749
  insertionDirectionToCanonical,
@@ -5591,8 +5950,18 @@ export {
5591
5950
  simulation_parameter_sweep_coordinate,
5592
5951
  simulation_parameter_type,
5593
5952
  simulation_parameter_unit,
5953
+ simulation_pcb_return_current_field,
5954
+ simulation_pcb_return_current_heatmap,
5955
+ simulation_pcb_return_current_marker,
5956
+ simulation_pcb_return_current_result,
5957
+ simulation_return_current_contact,
5958
+ simulation_return_current_excitation,
5959
+ simulation_return_current_field_asset,
5960
+ simulation_return_current_grid_json,
5961
+ simulation_return_current_image_asset,
5594
5962
  simulation_spice_subcircuit,
5595
5963
  simulation_switch,
5964
+ simulation_terminal_port,
5596
5965
  simulation_transient_current_graph,
5597
5966
  simulation_transient_voltage_graph,
5598
5967
  simulation_unknown_experiment_error,