circuit-json 0.0.434 → 0.0.436

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
@@ -3560,34 +3560,61 @@ var simulation_transient_voltage_graph = z165.object({
3560
3560
  }).describe("Stores voltage measurements over time for a simulation");
3561
3561
  expectTypesMatch(true);
3562
3562
 
3563
- // src/simulation/simulation_switch.ts
3563
+ // src/simulation/simulation_transient_current_graph.ts
3564
3564
  import { z as z166 } from "zod";
3565
- var simulation_switch = z166.object({
3566
- type: z166.literal("simulation_switch"),
3567
- simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
3565
+ var simulation_transient_current_graph = z166.object({
3566
+ type: z166.literal("simulation_transient_current_graph"),
3567
+ simulation_transient_current_graph_id: getZodPrefixedIdWithDefault(
3568
+ "simulation_transient_current_graph"
3569
+ ),
3570
+ simulation_experiment_id: z166.string(),
3571
+ timestamps_ms: z166.array(z166.number()).optional(),
3572
+ current_levels: z166.array(z166.number()),
3568
3573
  source_component_id: z166.string().optional(),
3574
+ subcircuit_connectivity_map_key: z166.string().optional(),
3575
+ time_per_step: duration_ms,
3576
+ start_time_ms: ms,
3577
+ end_time_ms: ms,
3578
+ name: z166.string().optional(),
3579
+ color: z166.string().optional()
3580
+ }).describe("Stores current measurements over time for a simulation");
3581
+ expectTypesMatch(true);
3582
+
3583
+ // src/simulation/simulation_switch.ts
3584
+ import { z as z167 } from "zod";
3585
+ var simulation_switch = z167.object({
3586
+ type: z167.literal("simulation_switch"),
3587
+ simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
3588
+ source_component_id: z167.string().optional(),
3569
3589
  closes_at: ms.optional(),
3570
3590
  opens_at: ms.optional(),
3571
- starts_closed: z166.boolean().optional(),
3591
+ starts_closed: z167.boolean().optional(),
3572
3592
  switching_frequency: frequency.optional()
3573
3593
  }).describe("Defines a switch for simulation timing control");
3574
3594
  expectTypesMatch(true);
3575
3595
 
3576
3596
  // src/simulation/simulation_voltage_probe.ts
3577
- import { z as z167 } from "zod";
3578
- var simulation_voltage_probe = z167.object({
3579
- type: z167.literal("simulation_voltage_probe"),
3597
+ import { z as z168 } from "zod";
3598
+ var simulation_voltage_probe_display_options = z168.object({
3599
+ label: z168.string().optional(),
3600
+ center: z168.number().optional(),
3601
+ offset_divs: z168.number().optional(),
3602
+ units_per_div: z168.number().optional()
3603
+ });
3604
+ var simulation_voltage_probe = z168.object({
3605
+ type: z168.literal("simulation_voltage_probe"),
3580
3606
  simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
3581
3607
  "simulation_voltage_probe"
3582
3608
  ),
3583
- source_component_id: z167.string().optional(),
3584
- name: z167.string().optional(),
3585
- signal_input_source_port_id: z167.string().optional(),
3586
- signal_input_source_net_id: z167.string().optional(),
3587
- reference_input_source_port_id: z167.string().optional(),
3588
- reference_input_source_net_id: z167.string().optional(),
3589
- subcircuit_id: z167.string().optional(),
3590
- color: z167.string().optional()
3609
+ source_component_id: z168.string().optional(),
3610
+ name: z168.string().optional(),
3611
+ signal_input_source_port_id: z168.string().optional(),
3612
+ signal_input_source_net_id: z168.string().optional(),
3613
+ reference_input_source_port_id: z168.string().optional(),
3614
+ reference_input_source_net_id: z168.string().optional(),
3615
+ subcircuit_id: z168.string().optional(),
3616
+ color: z168.string().optional(),
3617
+ display_options: simulation_voltage_probe_display_options.optional()
3591
3618
  }).describe(
3592
3619
  "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."
3593
3620
  ).superRefine((data, ctx) => {
@@ -3597,20 +3624,20 @@ var simulation_voltage_probe = z167.object({
3597
3624
  const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
3598
3625
  if (has_ports && has_nets) {
3599
3626
  ctx.addIssue({
3600
- code: z167.ZodIssueCode.custom,
3627
+ code: z168.ZodIssueCode.custom,
3601
3628
  message: "Cannot mix port and net connections in a differential probe."
3602
3629
  });
3603
3630
  } else if (has_ports) {
3604
3631
  if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
3605
3632
  ctx.addIssue({
3606
- code: z167.ZodIssueCode.custom,
3633
+ code: z168.ZodIssueCode.custom,
3607
3634
  message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
3608
3635
  });
3609
3636
  }
3610
3637
  } else if (has_nets) {
3611
3638
  if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
3612
3639
  ctx.addIssue({
3613
- code: z167.ZodIssueCode.custom,
3640
+ code: z168.ZodIssueCode.custom,
3614
3641
  message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
3615
3642
  });
3616
3643
  }
@@ -3618,59 +3645,124 @@ var simulation_voltage_probe = z167.object({
3618
3645
  } else {
3619
3646
  if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
3620
3647
  ctx.addIssue({
3621
- code: z167.ZodIssueCode.custom,
3648
+ code: z168.ZodIssueCode.custom,
3622
3649
  message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
3623
3650
  });
3624
3651
  }
3625
3652
  }
3626
3653
  });
3627
3654
  expectTypesMatch(true);
3655
+ expectTypesMatch(true);
3656
+
3657
+ // src/simulation/simulation_current_probe.ts
3658
+ import { z as z169 } from "zod";
3659
+ var simulation_current_probe_display_options = z169.object({
3660
+ label: z169.string().optional(),
3661
+ center: z169.number().optional(),
3662
+ offset_divs: z169.number().optional(),
3663
+ units_per_div: z169.number().optional()
3664
+ });
3665
+ var simulation_current_probe = z169.object({
3666
+ type: z169.literal("simulation_current_probe"),
3667
+ simulation_current_probe_id: getZodPrefixedIdWithDefault(
3668
+ "simulation_current_probe"
3669
+ ),
3670
+ source_component_id: z169.string().optional(),
3671
+ name: z169.string().optional(),
3672
+ positive_source_port_id: z169.string().optional(),
3673
+ negative_source_port_id: z169.string().optional(),
3674
+ positive_source_net_id: z169.string().optional(),
3675
+ negative_source_net_id: z169.string().optional(),
3676
+ subcircuit_id: z169.string().optional(),
3677
+ color: z169.string().optional(),
3678
+ display_options: simulation_current_probe_display_options.optional()
3679
+ }).describe(
3680
+ "Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
3681
+ ).superRefine((data, ctx) => {
3682
+ const hasPositivePort = !!data.positive_source_port_id;
3683
+ const hasNegativePort = !!data.negative_source_port_id;
3684
+ const hasPositiveNet = !!data.positive_source_net_id;
3685
+ const hasNegativeNet = !!data.negative_source_net_id;
3686
+ const hasPorts = hasPositivePort || hasNegativePort;
3687
+ const hasNets = hasPositiveNet || hasNegativeNet;
3688
+ if (hasPorts && hasNets) {
3689
+ ctx.addIssue({
3690
+ code: z169.ZodIssueCode.custom,
3691
+ message: "Cannot mix port and net connections in a current probe."
3692
+ });
3693
+ return;
3694
+ }
3695
+ if (hasPorts) {
3696
+ if (!hasPositivePort || !hasNegativePort) {
3697
+ ctx.addIssue({
3698
+ code: z169.ZodIssueCode.custom,
3699
+ message: "Current probe using source ports requires both positive_source_port_id and negative_source_port_id."
3700
+ });
3701
+ }
3702
+ return;
3703
+ }
3704
+ if (hasNets) {
3705
+ if (!hasPositiveNet || !hasNegativeNet) {
3706
+ ctx.addIssue({
3707
+ code: z169.ZodIssueCode.custom,
3708
+ message: "Current probe using source nets requires both positive_source_net_id and negative_source_net_id."
3709
+ });
3710
+ }
3711
+ return;
3712
+ }
3713
+ ctx.addIssue({
3714
+ code: z169.ZodIssueCode.custom,
3715
+ message: "A current probe must have either positive/negative source port ids or positive/negative source net ids."
3716
+ });
3717
+ });
3718
+ expectTypesMatch(true);
3719
+ expectTypesMatch(true);
3628
3720
 
3629
3721
  // src/simulation/simulation_unknown_experiment_error.ts
3630
- import { z as z168 } from "zod";
3722
+ import { z as z170 } from "zod";
3631
3723
  var simulation_unknown_experiment_error = base_circuit_json_error.extend({
3632
- type: z168.literal("simulation_unknown_experiment_error"),
3724
+ type: z170.literal("simulation_unknown_experiment_error"),
3633
3725
  simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
3634
3726
  "simulation_unknown_experiment_error"
3635
3727
  ),
3636
- error_type: z168.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
3637
- simulation_experiment_id: z168.string().optional(),
3638
- subcircuit_id: z168.string().optional()
3728
+ error_type: z170.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
3729
+ simulation_experiment_id: z170.string().optional(),
3730
+ subcircuit_id: z170.string().optional()
3639
3731
  }).describe("An unknown error occurred during the simulation experiment.");
3640
3732
  expectTypesMatch(true);
3641
3733
 
3642
3734
  // src/simulation/simulation_op_amp.ts
3643
- import { z as z169 } from "zod";
3644
- var simulation_op_amp = z169.object({
3645
- type: z169.literal("simulation_op_amp"),
3735
+ import { z as z171 } from "zod";
3736
+ var simulation_op_amp = z171.object({
3737
+ type: z171.literal("simulation_op_amp"),
3646
3738
  simulation_op_amp_id: getZodPrefixedIdWithDefault("simulation_op_amp"),
3647
- source_component_id: z169.string().optional(),
3648
- inverting_input_source_port_id: z169.string(),
3649
- non_inverting_input_source_port_id: z169.string(),
3650
- output_source_port_id: z169.string(),
3651
- positive_supply_source_port_id: z169.string(),
3652
- negative_supply_source_port_id: z169.string()
3739
+ source_component_id: z171.string().optional(),
3740
+ inverting_input_source_port_id: z171.string(),
3741
+ non_inverting_input_source_port_id: z171.string(),
3742
+ output_source_port_id: z171.string(),
3743
+ positive_supply_source_port_id: z171.string(),
3744
+ negative_supply_source_port_id: z171.string()
3653
3745
  }).describe("Defines a simple ideal operational amplifier for simulation");
3654
3746
  expectTypesMatch(true);
3655
3747
 
3656
3748
  // src/simulation/simulation_spice_subcircuit.ts
3657
- import { z as z170 } from "zod";
3658
- var simulation_spice_subcircuit = z170.object({
3659
- type: z170.literal("simulation_spice_subcircuit"),
3749
+ import { z as z172 } from "zod";
3750
+ var simulation_spice_subcircuit = z172.object({
3751
+ type: z172.literal("simulation_spice_subcircuit"),
3660
3752
  simulation_spice_subcircuit_id: getZodPrefixedIdWithDefault(
3661
3753
  "simulation_spice_subcircuit"
3662
3754
  ),
3663
- source_component_id: z170.string(),
3664
- spice_pin_to_source_port_map: z170.record(z170.string(), z170.string()),
3665
- subcircuit_source: z170.string()
3755
+ source_component_id: z172.string(),
3756
+ spice_pin_to_source_port_map: z172.record(z172.string(), z172.string()),
3757
+ subcircuit_source: z172.string()
3666
3758
  }).describe("Defines a custom SPICE subcircuit model for simulation");
3667
3759
  expectTypesMatch(
3668
3760
  true
3669
3761
  );
3670
3762
 
3671
3763
  // src/any_circuit_element.ts
3672
- import { z as z171 } from "zod";
3673
- var any_circuit_element = z171.union([
3764
+ import { z as z173 } from "zod";
3765
+ var any_circuit_element = z173.union([
3674
3766
  source_trace,
3675
3767
  source_port,
3676
3768
  source_component_internal_connection,
@@ -3804,8 +3896,10 @@ var any_circuit_element = z171.union([
3804
3896
  simulation_current_source,
3805
3897
  simulation_experiment,
3806
3898
  simulation_transient_voltage_graph,
3899
+ simulation_transient_current_graph,
3807
3900
  simulation_switch,
3808
3901
  simulation_voltage_probe,
3902
+ simulation_current_probe,
3809
3903
  simulation_unknown_experiment_error,
3810
3904
  simulation_op_amp,
3811
3905
  simulation_spice_subcircuit
@@ -3984,6 +4078,8 @@ export {
3984
4078
  schematic_voltage_probe,
3985
4079
  simulation_ac_current_source,
3986
4080
  simulation_ac_voltage_source,
4081
+ simulation_current_probe,
4082
+ simulation_current_probe_display_options,
3987
4083
  simulation_current_source,
3988
4084
  simulation_dc_current_source,
3989
4085
  simulation_dc_voltage_source,
@@ -3991,9 +4087,11 @@ export {
3991
4087
  simulation_op_amp,
3992
4088
  simulation_spice_subcircuit,
3993
4089
  simulation_switch,
4090
+ simulation_transient_current_graph,
3994
4091
  simulation_transient_voltage_graph,
3995
4092
  simulation_unknown_experiment_error,
3996
4093
  simulation_voltage_probe,
4094
+ simulation_voltage_probe_display_options,
3997
4095
  simulation_voltage_source,
3998
4096
  size,
3999
4097
  source_ambiguous_port_reference,