circuit-json 0.0.453 → 0.0.454
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/README.md +232 -0
- package/dist/index.d.mts +2654 -40
- package/dist/index.mjs +415 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3583,7 +3583,9 @@ var simulation_dc_voltage_source = z169.object({
|
|
|
3583
3583
|
negative_source_port_id: z169.string().optional(),
|
|
3584
3584
|
positive_source_net_id: z169.string().optional(),
|
|
3585
3585
|
negative_source_net_id: z169.string().optional(),
|
|
3586
|
-
voltage
|
|
3586
|
+
voltage,
|
|
3587
|
+
ac_magnitude: voltage.optional(),
|
|
3588
|
+
ac_phase: rotation.optional()
|
|
3587
3589
|
}).describe("Defines a DC voltage source for simulation");
|
|
3588
3590
|
var simulation_ac_voltage_source = z169.object({
|
|
3589
3591
|
type: z169.literal("simulation_voltage_source"),
|
|
@@ -3605,7 +3607,9 @@ var simulation_ac_voltage_source = z169.object({
|
|
|
3605
3607
|
rise_time: ms.optional(),
|
|
3606
3608
|
fall_time: ms.optional(),
|
|
3607
3609
|
pulse_width: ms.optional(),
|
|
3608
|
-
period: ms.optional()
|
|
3610
|
+
period: ms.optional(),
|
|
3611
|
+
ac_magnitude: voltage.optional(),
|
|
3612
|
+
ac_phase: rotation.optional()
|
|
3609
3613
|
}).describe("Defines an AC voltage source for simulation");
|
|
3610
3614
|
var simulation_voltage_source = z169.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
|
|
3611
3615
|
expectTypesMatch(true);
|
|
@@ -3635,7 +3639,9 @@ var simulation_dc_current_source = z170.object({
|
|
|
3635
3639
|
negative_source_port_id: z170.string().optional(),
|
|
3636
3640
|
positive_source_net_id: z170.string().optional(),
|
|
3637
3641
|
negative_source_net_id: z170.string().optional(),
|
|
3638
|
-
current
|
|
3642
|
+
current,
|
|
3643
|
+
ac_magnitude: current.optional(),
|
|
3644
|
+
ac_phase: rotation.optional()
|
|
3639
3645
|
}).describe("Defines a DC current source for simulation");
|
|
3640
3646
|
var simulation_ac_current_source = z170.object({
|
|
3641
3647
|
type: z170.literal("simulation_current_source"),
|
|
@@ -3652,7 +3658,9 @@ var simulation_ac_current_source = z170.object({
|
|
|
3652
3658
|
peak_to_peak_current: current.optional(),
|
|
3653
3659
|
wave_shape: wave_shape.optional(),
|
|
3654
3660
|
phase: rotation.optional(),
|
|
3655
|
-
duty_cycle: percentage2.optional()
|
|
3661
|
+
duty_cycle: percentage2.optional(),
|
|
3662
|
+
ac_magnitude: current.optional(),
|
|
3663
|
+
ac_phase: rotation.optional()
|
|
3656
3664
|
}).describe("Defines an AC current source for simulation");
|
|
3657
3665
|
var simulation_current_source = z170.union([simulation_dc_current_source, simulation_ac_current_source]).describe("Defines a current source for simulation");
|
|
3658
3666
|
expectTypesMatch(true);
|
|
@@ -3660,101 +3668,201 @@ expectTypesMatch(true);
|
|
|
3660
3668
|
expectTypesMatch(true);
|
|
3661
3669
|
|
|
3662
3670
|
// src/simulation/simulation_experiment.ts
|
|
3671
|
+
import { z as z172 } from "zod";
|
|
3672
|
+
|
|
3673
|
+
// src/simulation/simulation_units.ts
|
|
3663
3674
|
import { z as z171 } from "zod";
|
|
3664
|
-
var
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3675
|
+
var simulation_dc_sweep_unit = z171.custom(
|
|
3676
|
+
(dcSweepUnit) => dcSweepUnit === "V" || dcSweepUnit === "A"
|
|
3677
|
+
);
|
|
3678
|
+
var simulation_parameter_unit = z171.custom(
|
|
3679
|
+
(parameterUnit) => parameterUnit === "\u03A9" || parameterUnit === "F" || parameterUnit === "H" || parameterUnit === "V" || parameterUnit === "A"
|
|
3680
|
+
);
|
|
3681
|
+
|
|
3682
|
+
// src/simulation/simulation_experiment.ts
|
|
3683
|
+
var experiment_type = z172.union([
|
|
3684
|
+
z172.literal("spice_dc_sweep"),
|
|
3685
|
+
z172.literal("spice_dc_operating_point"),
|
|
3686
|
+
z172.literal("spice_transient_analysis"),
|
|
3687
|
+
z172.literal("spice_ac_analysis")
|
|
3669
3688
|
]);
|
|
3670
|
-
var spice_simulation_options =
|
|
3671
|
-
method:
|
|
3672
|
-
reltol:
|
|
3673
|
-
abstol:
|
|
3674
|
-
vntol:
|
|
3689
|
+
var spice_simulation_options = z172.object({
|
|
3690
|
+
method: z172.enum(["trap", "gear"]).optional(),
|
|
3691
|
+
reltol: z172.union([z172.number(), z172.string()]).optional(),
|
|
3692
|
+
abstol: z172.union([z172.number(), z172.string()]).optional(),
|
|
3693
|
+
vntol: z172.union([z172.number(), z172.string()]).optional()
|
|
3675
3694
|
}).describe("SPICE solver options for a simulation experiment");
|
|
3676
|
-
var simulation_experiment =
|
|
3677
|
-
type:
|
|
3695
|
+
var simulation_experiment = z172.object({
|
|
3696
|
+
type: z172.literal("simulation_experiment"),
|
|
3678
3697
|
simulation_experiment_id: getZodPrefixedIdWithDefault(
|
|
3679
3698
|
"simulation_experiment"
|
|
3680
3699
|
),
|
|
3681
|
-
name:
|
|
3700
|
+
name: z172.string(),
|
|
3682
3701
|
experiment_type,
|
|
3683
3702
|
time_per_step: duration_ms.optional(),
|
|
3684
3703
|
start_time_ms: ms.optional(),
|
|
3685
3704
|
end_time_ms: ms.optional(),
|
|
3686
|
-
spice_options: spice_simulation_options.optional()
|
|
3705
|
+
spice_options: spice_simulation_options.optional(),
|
|
3706
|
+
dc_sweep_voltage_source_id: z172.string().optional(),
|
|
3707
|
+
dc_sweep_current_source_id: z172.string().optional(),
|
|
3708
|
+
dc_sweep_start: z172.number().optional(),
|
|
3709
|
+
dc_sweep_stop: z172.number().optional(),
|
|
3710
|
+
dc_sweep_step: z172.number().refine((dcSweepStep) => dcSweepStep !== 0).optional(),
|
|
3711
|
+
dc_sweep_unit: simulation_dc_sweep_unit.optional(),
|
|
3712
|
+
ac_sweep_type: z172.enum(["linear", "decade", "octave"]).optional(),
|
|
3713
|
+
ac_samples_per_interval: z172.number().int().positive().optional(),
|
|
3714
|
+
ac_sample_count: z172.number().int().positive().optional(),
|
|
3715
|
+
ac_start_frequency_hz: z172.number().positive().optional(),
|
|
3716
|
+
ac_stop_frequency_hz: z172.number().positive().optional()
|
|
3717
|
+
}).superRefine((experiment, context) => {
|
|
3718
|
+
if (experiment.experiment_type === "spice_dc_sweep") {
|
|
3719
|
+
const requiredFields = [
|
|
3720
|
+
"dc_sweep_start",
|
|
3721
|
+
"dc_sweep_stop",
|
|
3722
|
+
"dc_sweep_step",
|
|
3723
|
+
"dc_sweep_unit"
|
|
3724
|
+
];
|
|
3725
|
+
for (const field of requiredFields) {
|
|
3726
|
+
if (experiment[field] === void 0) {
|
|
3727
|
+
context.addIssue({
|
|
3728
|
+
code: z172.ZodIssueCode.custom,
|
|
3729
|
+
path: [field],
|
|
3730
|
+
message: `${field} is required for a DC sweep`
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
const hasVoltageSource = experiment.dc_sweep_voltage_source_id !== void 0;
|
|
3735
|
+
const hasCurrentSource = experiment.dc_sweep_current_source_id !== void 0;
|
|
3736
|
+
if (hasVoltageSource === hasCurrentSource) {
|
|
3737
|
+
context.addIssue({
|
|
3738
|
+
code: z172.ZodIssueCode.custom,
|
|
3739
|
+
path: ["dc_sweep_voltage_source_id"],
|
|
3740
|
+
message: "Exactly one DC sweep voltage or current source ID is required"
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
if (experiment.experiment_type === "spice_ac_analysis") {
|
|
3745
|
+
if (experiment.ac_sweep_type === void 0) {
|
|
3746
|
+
context.addIssue({
|
|
3747
|
+
code: z172.ZodIssueCode.custom,
|
|
3748
|
+
path: ["ac_sweep_type"],
|
|
3749
|
+
message: "ac_sweep_type is required for an AC analysis"
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
if (experiment.ac_start_frequency_hz === void 0) {
|
|
3753
|
+
context.addIssue({
|
|
3754
|
+
code: z172.ZodIssueCode.custom,
|
|
3755
|
+
path: ["ac_start_frequency_hz"],
|
|
3756
|
+
message: "ac_start_frequency_hz is required for an AC analysis"
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3759
|
+
if (experiment.ac_stop_frequency_hz === void 0) {
|
|
3760
|
+
context.addIssue({
|
|
3761
|
+
code: z172.ZodIssueCode.custom,
|
|
3762
|
+
path: ["ac_stop_frequency_hz"],
|
|
3763
|
+
message: "ac_stop_frequency_hz is required for an AC analysis"
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
if (experiment.ac_sweep_type === "linear" && experiment.ac_sample_count === void 0) {
|
|
3767
|
+
context.addIssue({
|
|
3768
|
+
code: z172.ZodIssueCode.custom,
|
|
3769
|
+
path: ["ac_sample_count"],
|
|
3770
|
+
message: "ac_sample_count is required for a linear AC analysis"
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
if ((experiment.ac_sweep_type === "decade" || experiment.ac_sweep_type === "octave") && experiment.ac_samples_per_interval === void 0) {
|
|
3774
|
+
context.addIssue({
|
|
3775
|
+
code: z172.ZodIssueCode.custom,
|
|
3776
|
+
path: ["ac_samples_per_interval"],
|
|
3777
|
+
message: "ac_samples_per_interval is required for decade and octave AC analyses"
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3687
3781
|
}).describe("Defines a simulation experiment configuration");
|
|
3688
3782
|
expectTypesMatch(true);
|
|
3689
3783
|
|
|
3690
3784
|
// src/simulation/simulation_transient_voltage_graph.ts
|
|
3691
|
-
import { z as
|
|
3692
|
-
|
|
3693
|
-
|
|
3785
|
+
import { z as z174 } from "zod";
|
|
3786
|
+
|
|
3787
|
+
// src/simulation/simulation_parameter_sweep_coordinate.ts
|
|
3788
|
+
import { z as z173 } from "zod";
|
|
3789
|
+
var simulation_parameter_sweep_coordinate = z173.object({
|
|
3790
|
+
simulation_parameter_sweep_id: z173.string(),
|
|
3791
|
+
sweep_index: z173.number().int().nonnegative(),
|
|
3792
|
+
parameter_value: z173.number(),
|
|
3793
|
+
parameter_unit: simulation_parameter_unit
|
|
3794
|
+
});
|
|
3795
|
+
expectTypesMatch(true);
|
|
3796
|
+
|
|
3797
|
+
// src/simulation/simulation_transient_voltage_graph.ts
|
|
3798
|
+
var simulation_transient_voltage_graph = z174.object({
|
|
3799
|
+
type: z174.literal("simulation_transient_voltage_graph"),
|
|
3694
3800
|
simulation_transient_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
3695
3801
|
"simulation_transient_voltage_graph"
|
|
3696
3802
|
),
|
|
3697
|
-
simulation_experiment_id:
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3803
|
+
simulation_experiment_id: z174.string(),
|
|
3804
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
3805
|
+
timestamps_ms: z174.array(z174.number()).optional(),
|
|
3806
|
+
voltage_levels: z174.array(z174.number()),
|
|
3807
|
+
source_component_id: z174.string().optional(),
|
|
3808
|
+
subcircuit_connectivity_map_key: z174.string().optional(),
|
|
3702
3809
|
time_per_step: duration_ms,
|
|
3703
3810
|
start_time_ms: ms,
|
|
3704
3811
|
end_time_ms: ms,
|
|
3705
|
-
name:
|
|
3706
|
-
color:
|
|
3812
|
+
name: z174.string().optional(),
|
|
3813
|
+
color: z174.string().optional()
|
|
3707
3814
|
}).describe("Stores voltage measurements over time for a simulation");
|
|
3708
3815
|
expectTypesMatch(true);
|
|
3709
3816
|
|
|
3710
3817
|
// src/simulation/simulation_transient_current_graph.ts
|
|
3711
|
-
import { z as
|
|
3712
|
-
var simulation_transient_current_graph =
|
|
3713
|
-
type:
|
|
3818
|
+
import { z as z175 } from "zod";
|
|
3819
|
+
var simulation_transient_current_graph = z175.object({
|
|
3820
|
+
type: z175.literal("simulation_transient_current_graph"),
|
|
3714
3821
|
simulation_transient_current_graph_id: getZodPrefixedIdWithDefault(
|
|
3715
3822
|
"simulation_transient_current_graph"
|
|
3716
3823
|
),
|
|
3717
|
-
simulation_experiment_id:
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3824
|
+
simulation_experiment_id: z175.string(),
|
|
3825
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
3826
|
+
timestamps_ms: z175.array(z175.number()).optional(),
|
|
3827
|
+
current_levels: z175.array(z175.number()),
|
|
3828
|
+
source_component_id: z175.string().optional(),
|
|
3829
|
+
subcircuit_connectivity_map_key: z175.string().optional(),
|
|
3722
3830
|
time_per_step: duration_ms,
|
|
3723
3831
|
start_time_ms: ms,
|
|
3724
3832
|
end_time_ms: ms,
|
|
3725
|
-
name:
|
|
3726
|
-
color:
|
|
3833
|
+
name: z175.string().optional(),
|
|
3834
|
+
color: z175.string().optional()
|
|
3727
3835
|
}).describe("Stores current measurements over time for a simulation");
|
|
3728
3836
|
expectTypesMatch(true);
|
|
3729
3837
|
|
|
3730
3838
|
// src/simulation/simulation_switch.ts
|
|
3731
|
-
import { z as
|
|
3732
|
-
var simulation_switch =
|
|
3733
|
-
type:
|
|
3839
|
+
import { z as z176 } from "zod";
|
|
3840
|
+
var simulation_switch = z176.object({
|
|
3841
|
+
type: z176.literal("simulation_switch"),
|
|
3734
3842
|
simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
|
|
3735
|
-
source_component_id:
|
|
3843
|
+
source_component_id: z176.string().optional(),
|
|
3736
3844
|
closes_at: ms.optional(),
|
|
3737
3845
|
opens_at: ms.optional(),
|
|
3738
|
-
starts_closed:
|
|
3846
|
+
starts_closed: z176.boolean().optional(),
|
|
3739
3847
|
switching_frequency: frequency.optional()
|
|
3740
3848
|
}).describe("Defines a switch for simulation timing control");
|
|
3741
3849
|
expectTypesMatch(true);
|
|
3742
3850
|
|
|
3743
3851
|
// src/simulation/simulation_voltage_probe.ts
|
|
3744
|
-
import { z as
|
|
3745
|
-
var simulation_voltage_probe =
|
|
3746
|
-
type:
|
|
3852
|
+
import { z as z177 } from "zod";
|
|
3853
|
+
var simulation_voltage_probe = z177.object({
|
|
3854
|
+
type: z177.literal("simulation_voltage_probe"),
|
|
3747
3855
|
simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
|
|
3748
3856
|
"simulation_voltage_probe"
|
|
3749
3857
|
),
|
|
3750
|
-
source_component_id:
|
|
3751
|
-
name:
|
|
3752
|
-
signal_input_source_port_id:
|
|
3753
|
-
signal_input_source_net_id:
|
|
3754
|
-
reference_input_source_port_id:
|
|
3755
|
-
reference_input_source_net_id:
|
|
3756
|
-
subcircuit_id:
|
|
3757
|
-
color:
|
|
3858
|
+
source_component_id: z177.string().optional(),
|
|
3859
|
+
name: z177.string().optional(),
|
|
3860
|
+
signal_input_source_port_id: z177.string().optional(),
|
|
3861
|
+
signal_input_source_net_id: z177.string().optional(),
|
|
3862
|
+
reference_input_source_port_id: z177.string().optional(),
|
|
3863
|
+
reference_input_source_net_id: z177.string().optional(),
|
|
3864
|
+
subcircuit_id: z177.string().optional(),
|
|
3865
|
+
color: z177.string().optional()
|
|
3758
3866
|
}).describe(
|
|
3759
3867
|
"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."
|
|
3760
3868
|
).superRefine((data, ctx) => {
|
|
@@ -3764,20 +3872,20 @@ var simulation_voltage_probe = z175.object({
|
|
|
3764
3872
|
const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
|
|
3765
3873
|
if (has_ports && has_nets) {
|
|
3766
3874
|
ctx.addIssue({
|
|
3767
|
-
code:
|
|
3875
|
+
code: z177.ZodIssueCode.custom,
|
|
3768
3876
|
message: "Cannot mix port and net connections in a differential probe."
|
|
3769
3877
|
});
|
|
3770
3878
|
} else if (has_ports) {
|
|
3771
3879
|
if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
|
|
3772
3880
|
ctx.addIssue({
|
|
3773
|
-
code:
|
|
3881
|
+
code: z177.ZodIssueCode.custom,
|
|
3774
3882
|
message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
|
|
3775
3883
|
});
|
|
3776
3884
|
}
|
|
3777
3885
|
} else if (has_nets) {
|
|
3778
3886
|
if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
|
|
3779
3887
|
ctx.addIssue({
|
|
3780
|
-
code:
|
|
3888
|
+
code: z177.ZodIssueCode.custom,
|
|
3781
3889
|
message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
|
|
3782
3890
|
});
|
|
3783
3891
|
}
|
|
@@ -3785,7 +3893,7 @@ var simulation_voltage_probe = z175.object({
|
|
|
3785
3893
|
} else {
|
|
3786
3894
|
if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
|
|
3787
3895
|
ctx.addIssue({
|
|
3788
|
-
code:
|
|
3896
|
+
code: z177.ZodIssueCode.custom,
|
|
3789
3897
|
message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
|
|
3790
3898
|
});
|
|
3791
3899
|
}
|
|
@@ -3794,20 +3902,20 @@ var simulation_voltage_probe = z175.object({
|
|
|
3794
3902
|
expectTypesMatch(true);
|
|
3795
3903
|
|
|
3796
3904
|
// src/simulation/simulation_current_probe.ts
|
|
3797
|
-
import { z as
|
|
3798
|
-
var simulation_current_probe =
|
|
3799
|
-
type:
|
|
3905
|
+
import { z as z178 } from "zod";
|
|
3906
|
+
var simulation_current_probe = z178.object({
|
|
3907
|
+
type: z178.literal("simulation_current_probe"),
|
|
3800
3908
|
simulation_current_probe_id: getZodPrefixedIdWithDefault(
|
|
3801
3909
|
"simulation_current_probe"
|
|
3802
3910
|
),
|
|
3803
|
-
source_component_id:
|
|
3804
|
-
name:
|
|
3805
|
-
positive_source_port_id:
|
|
3806
|
-
negative_source_port_id:
|
|
3807
|
-
positive_source_net_id:
|
|
3808
|
-
negative_source_net_id:
|
|
3809
|
-
subcircuit_id:
|
|
3810
|
-
color:
|
|
3911
|
+
source_component_id: z178.string().optional(),
|
|
3912
|
+
name: z178.string().optional(),
|
|
3913
|
+
positive_source_port_id: z178.string().optional(),
|
|
3914
|
+
negative_source_port_id: z178.string().optional(),
|
|
3915
|
+
positive_source_net_id: z178.string().optional(),
|
|
3916
|
+
negative_source_net_id: z178.string().optional(),
|
|
3917
|
+
subcircuit_id: z178.string().optional(),
|
|
3918
|
+
color: z178.string().optional()
|
|
3811
3919
|
}).describe(
|
|
3812
3920
|
"Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
|
|
3813
3921
|
).superRefine((data, ctx) => {
|
|
@@ -3819,7 +3927,7 @@ var simulation_current_probe = z176.object({
|
|
|
3819
3927
|
const hasNets = hasPositiveNet || hasNegativeNet;
|
|
3820
3928
|
if (hasPorts && hasNets) {
|
|
3821
3929
|
ctx.addIssue({
|
|
3822
|
-
code:
|
|
3930
|
+
code: z178.ZodIssueCode.custom,
|
|
3823
3931
|
message: "Cannot mix port and net connections in a current probe."
|
|
3824
3932
|
});
|
|
3825
3933
|
return;
|
|
@@ -3827,7 +3935,7 @@ var simulation_current_probe = z176.object({
|
|
|
3827
3935
|
if (hasPorts) {
|
|
3828
3936
|
if (!hasPositivePort || !hasNegativePort) {
|
|
3829
3937
|
ctx.addIssue({
|
|
3830
|
-
code:
|
|
3938
|
+
code: z178.ZodIssueCode.custom,
|
|
3831
3939
|
message: "Current probe using source ports requires both positive_source_port_id and negative_source_port_id."
|
|
3832
3940
|
});
|
|
3833
3941
|
}
|
|
@@ -3836,79 +3944,256 @@ var simulation_current_probe = z176.object({
|
|
|
3836
3944
|
if (hasNets) {
|
|
3837
3945
|
if (!hasPositiveNet || !hasNegativeNet) {
|
|
3838
3946
|
ctx.addIssue({
|
|
3839
|
-
code:
|
|
3947
|
+
code: z178.ZodIssueCode.custom,
|
|
3840
3948
|
message: "Current probe using source nets requires both positive_source_net_id and negative_source_net_id."
|
|
3841
3949
|
});
|
|
3842
3950
|
}
|
|
3843
3951
|
return;
|
|
3844
3952
|
}
|
|
3845
3953
|
ctx.addIssue({
|
|
3846
|
-
code:
|
|
3954
|
+
code: z178.ZodIssueCode.custom,
|
|
3847
3955
|
message: "A current probe must have either positive/negative source port ids or positive/negative source net ids."
|
|
3848
3956
|
});
|
|
3849
3957
|
});
|
|
3850
3958
|
expectTypesMatch(true);
|
|
3851
3959
|
|
|
3852
3960
|
// src/simulation/simulation_unknown_experiment_error.ts
|
|
3853
|
-
import { z as
|
|
3961
|
+
import { z as z179 } from "zod";
|
|
3854
3962
|
var simulation_unknown_experiment_error = base_circuit_json_error.extend({
|
|
3855
|
-
type:
|
|
3963
|
+
type: z179.literal("simulation_unknown_experiment_error"),
|
|
3856
3964
|
simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
|
|
3857
3965
|
"simulation_unknown_experiment_error"
|
|
3858
3966
|
),
|
|
3859
|
-
error_type:
|
|
3860
|
-
simulation_experiment_id:
|
|
3861
|
-
subcircuit_id:
|
|
3967
|
+
error_type: z179.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
|
|
3968
|
+
simulation_experiment_id: z179.string().optional(),
|
|
3969
|
+
subcircuit_id: z179.string().optional()
|
|
3862
3970
|
}).describe("An unknown error occurred during the simulation experiment.");
|
|
3863
3971
|
expectTypesMatch(true);
|
|
3864
3972
|
|
|
3973
|
+
// src/simulation/simulation_parameter_sweep.ts
|
|
3974
|
+
import { z as z180 } from "zod";
|
|
3975
|
+
var simulation_parameter_type = z180.enum([
|
|
3976
|
+
"resistance",
|
|
3977
|
+
"capacitance",
|
|
3978
|
+
"inductance",
|
|
3979
|
+
"voltage",
|
|
3980
|
+
"current"
|
|
3981
|
+
]);
|
|
3982
|
+
var simulation_parameter_sweep_base = z180.object({
|
|
3983
|
+
type: z180.literal("simulation_parameter_sweep"),
|
|
3984
|
+
simulation_parameter_sweep_id: getZodPrefixedIdWithDefault(
|
|
3985
|
+
"simulation_parameter_sweep"
|
|
3986
|
+
),
|
|
3987
|
+
simulation_experiment_id: z180.string(),
|
|
3988
|
+
name: z180.string().optional(),
|
|
3989
|
+
parameter_values: z180.array(z180.number()).min(1),
|
|
3990
|
+
parameter_unit: simulation_parameter_unit
|
|
3991
|
+
});
|
|
3992
|
+
var simulation_parameter_sweep = z180.discriminatedUnion("parameter_type", [
|
|
3993
|
+
simulation_parameter_sweep_base.extend({
|
|
3994
|
+
parameter_type: z180.literal("resistance"),
|
|
3995
|
+
resistor_source_component_id: z180.string()
|
|
3996
|
+
}),
|
|
3997
|
+
simulation_parameter_sweep_base.extend({
|
|
3998
|
+
parameter_type: z180.literal("capacitance"),
|
|
3999
|
+
capacitor_source_component_id: z180.string()
|
|
4000
|
+
}),
|
|
4001
|
+
simulation_parameter_sweep_base.extend({
|
|
4002
|
+
parameter_type: z180.literal("inductance"),
|
|
4003
|
+
inductor_source_component_id: z180.string()
|
|
4004
|
+
}),
|
|
4005
|
+
simulation_parameter_sweep_base.extend({
|
|
4006
|
+
parameter_type: z180.literal("voltage"),
|
|
4007
|
+
source_net_id: z180.string()
|
|
4008
|
+
}),
|
|
4009
|
+
simulation_parameter_sweep_base.extend({
|
|
4010
|
+
parameter_type: z180.literal("current"),
|
|
4011
|
+
current_source_component_id: z180.string()
|
|
4012
|
+
})
|
|
4013
|
+
]).describe("Repeats a simulation experiment over component parameter values");
|
|
4014
|
+
expectTypesMatch(
|
|
4015
|
+
true
|
|
4016
|
+
);
|
|
4017
|
+
|
|
4018
|
+
// src/simulation/simulation_dc_operating_point_voltage.ts
|
|
4019
|
+
import { z as z181 } from "zod";
|
|
4020
|
+
var simulation_dc_operating_point_voltage = z181.object({
|
|
4021
|
+
type: z181.literal("simulation_dc_operating_point_voltage"),
|
|
4022
|
+
simulation_dc_operating_point_voltage_id: getZodPrefixedIdWithDefault(
|
|
4023
|
+
"simulation_dc_operating_point_voltage"
|
|
4024
|
+
),
|
|
4025
|
+
simulation_experiment_id: z181.string(),
|
|
4026
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4027
|
+
simulation_voltage_probe_id: z181.string(),
|
|
4028
|
+
voltage: z181.number(),
|
|
4029
|
+
name: z181.string().optional(),
|
|
4030
|
+
color: z181.string().optional()
|
|
4031
|
+
});
|
|
4032
|
+
expectTypesMatch(true);
|
|
4033
|
+
|
|
4034
|
+
// src/simulation/simulation_dc_operating_point_current.ts
|
|
4035
|
+
import { z as z182 } from "zod";
|
|
4036
|
+
var simulation_dc_operating_point_current = z182.object({
|
|
4037
|
+
type: z182.literal("simulation_dc_operating_point_current"),
|
|
4038
|
+
simulation_dc_operating_point_current_id: getZodPrefixedIdWithDefault(
|
|
4039
|
+
"simulation_dc_operating_point_current"
|
|
4040
|
+
),
|
|
4041
|
+
simulation_experiment_id: z182.string(),
|
|
4042
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4043
|
+
simulation_current_probe_id: z182.string(),
|
|
4044
|
+
current: z182.number(),
|
|
4045
|
+
name: z182.string().optional(),
|
|
4046
|
+
color: z182.string().optional()
|
|
4047
|
+
});
|
|
4048
|
+
expectTypesMatch(true);
|
|
4049
|
+
|
|
4050
|
+
// src/simulation/simulation_dc_sweep_voltage_graph.ts
|
|
4051
|
+
import { z as z183 } from "zod";
|
|
4052
|
+
var simulation_dc_sweep_voltage_graph = z183.object({
|
|
4053
|
+
type: z183.literal("simulation_dc_sweep_voltage_graph"),
|
|
4054
|
+
simulation_dc_sweep_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
4055
|
+
"simulation_dc_sweep_voltage_graph"
|
|
4056
|
+
),
|
|
4057
|
+
simulation_experiment_id: z183.string(),
|
|
4058
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4059
|
+
simulation_voltage_probe_id: z183.string(),
|
|
4060
|
+
sweep_values: z183.array(z183.number()),
|
|
4061
|
+
sweep_unit: simulation_dc_sweep_unit,
|
|
4062
|
+
voltage_levels: z183.array(z183.number()),
|
|
4063
|
+
name: z183.string().optional(),
|
|
4064
|
+
color: z183.string().optional()
|
|
4065
|
+
}).refine(
|
|
4066
|
+
(graph) => graph.sweep_values.length === graph.voltage_levels.length,
|
|
4067
|
+
{
|
|
4068
|
+
message: "sweep_values and voltage_levels must have the same length"
|
|
4069
|
+
}
|
|
4070
|
+
);
|
|
4071
|
+
expectTypesMatch(true);
|
|
4072
|
+
|
|
4073
|
+
// src/simulation/simulation_dc_sweep_current_graph.ts
|
|
4074
|
+
import { z as z184 } from "zod";
|
|
4075
|
+
var simulation_dc_sweep_current_graph = z184.object({
|
|
4076
|
+
type: z184.literal("simulation_dc_sweep_current_graph"),
|
|
4077
|
+
simulation_dc_sweep_current_graph_id: getZodPrefixedIdWithDefault(
|
|
4078
|
+
"simulation_dc_sweep_current_graph"
|
|
4079
|
+
),
|
|
4080
|
+
simulation_experiment_id: z184.string(),
|
|
4081
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4082
|
+
simulation_current_probe_id: z184.string(),
|
|
4083
|
+
sweep_values: z184.array(z184.number()),
|
|
4084
|
+
sweep_unit: simulation_dc_sweep_unit,
|
|
4085
|
+
current_levels: z184.array(z184.number()),
|
|
4086
|
+
name: z184.string().optional(),
|
|
4087
|
+
color: z184.string().optional()
|
|
4088
|
+
}).refine(
|
|
4089
|
+
(graph) => graph.sweep_values.length === graph.current_levels.length,
|
|
4090
|
+
{
|
|
4091
|
+
message: "sweep_values and current_levels must have the same length"
|
|
4092
|
+
}
|
|
4093
|
+
);
|
|
4094
|
+
expectTypesMatch(true);
|
|
4095
|
+
|
|
4096
|
+
// src/simulation/simulation_ac_sweep_voltage_graph.ts
|
|
4097
|
+
import { z as z186 } from "zod";
|
|
4098
|
+
|
|
4099
|
+
// src/simulation/simulation_complex_sample.ts
|
|
4100
|
+
import { z as z185 } from "zod";
|
|
4101
|
+
var simulation_complex_sample = z185.object({
|
|
4102
|
+
re: z185.number(),
|
|
4103
|
+
im: z185.number()
|
|
4104
|
+
});
|
|
4105
|
+
expectTypesMatch(true);
|
|
4106
|
+
|
|
4107
|
+
// src/simulation/simulation_ac_sweep_voltage_graph.ts
|
|
4108
|
+
var simulation_ac_sweep_voltage_graph = z186.object({
|
|
4109
|
+
type: z186.literal("simulation_ac_sweep_voltage_graph"),
|
|
4110
|
+
simulation_ac_sweep_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
4111
|
+
"simulation_ac_sweep_voltage_graph"
|
|
4112
|
+
),
|
|
4113
|
+
simulation_experiment_id: z186.string(),
|
|
4114
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4115
|
+
simulation_voltage_probe_id: z186.string(),
|
|
4116
|
+
frequencies_hz: z186.array(z186.number()),
|
|
4117
|
+
complex_voltages: z186.array(simulation_complex_sample),
|
|
4118
|
+
name: z186.string().optional(),
|
|
4119
|
+
color: z186.string().optional()
|
|
4120
|
+
}).refine(
|
|
4121
|
+
(graph) => graph.frequencies_hz.length === graph.complex_voltages.length,
|
|
4122
|
+
{
|
|
4123
|
+
message: "frequencies_hz and complex_voltages must have the same length"
|
|
4124
|
+
}
|
|
4125
|
+
);
|
|
4126
|
+
expectTypesMatch(true);
|
|
4127
|
+
|
|
4128
|
+
// src/simulation/simulation_ac_sweep_current_graph.ts
|
|
4129
|
+
import { z as z187 } from "zod";
|
|
4130
|
+
var simulation_ac_sweep_current_graph = z187.object({
|
|
4131
|
+
type: z187.literal("simulation_ac_sweep_current_graph"),
|
|
4132
|
+
simulation_ac_sweep_current_graph_id: getZodPrefixedIdWithDefault(
|
|
4133
|
+
"simulation_ac_sweep_current_graph"
|
|
4134
|
+
),
|
|
4135
|
+
simulation_experiment_id: z187.string(),
|
|
4136
|
+
simulation_parameter_sweep_coordinate: simulation_parameter_sweep_coordinate.optional(),
|
|
4137
|
+
simulation_current_probe_id: z187.string(),
|
|
4138
|
+
frequencies_hz: z187.array(z187.number()),
|
|
4139
|
+
complex_currents: z187.array(simulation_complex_sample),
|
|
4140
|
+
name: z187.string().optional(),
|
|
4141
|
+
color: z187.string().optional()
|
|
4142
|
+
}).refine(
|
|
4143
|
+
(graph) => graph.frequencies_hz.length === graph.complex_currents.length,
|
|
4144
|
+
{
|
|
4145
|
+
message: "frequencies_hz and complex_currents must have the same length"
|
|
4146
|
+
}
|
|
4147
|
+
);
|
|
4148
|
+
expectTypesMatch(true);
|
|
4149
|
+
|
|
3865
4150
|
// src/simulation/simulation_op_amp.ts
|
|
3866
|
-
import { z as
|
|
3867
|
-
var simulation_op_amp =
|
|
3868
|
-
type:
|
|
4151
|
+
import { z as z188 } from "zod";
|
|
4152
|
+
var simulation_op_amp = z188.object({
|
|
4153
|
+
type: z188.literal("simulation_op_amp"),
|
|
3869
4154
|
simulation_op_amp_id: getZodPrefixedIdWithDefault("simulation_op_amp"),
|
|
3870
|
-
source_component_id:
|
|
3871
|
-
inverting_input_source_port_id:
|
|
3872
|
-
non_inverting_input_source_port_id:
|
|
3873
|
-
output_source_port_id:
|
|
3874
|
-
positive_supply_source_port_id:
|
|
3875
|
-
negative_supply_source_port_id:
|
|
4155
|
+
source_component_id: z188.string().optional(),
|
|
4156
|
+
inverting_input_source_port_id: z188.string(),
|
|
4157
|
+
non_inverting_input_source_port_id: z188.string(),
|
|
4158
|
+
output_source_port_id: z188.string(),
|
|
4159
|
+
positive_supply_source_port_id: z188.string(),
|
|
4160
|
+
negative_supply_source_port_id: z188.string()
|
|
3876
4161
|
}).describe("Defines a simple ideal operational amplifier for simulation");
|
|
3877
4162
|
expectTypesMatch(true);
|
|
3878
4163
|
|
|
3879
4164
|
// src/simulation/simulation_spice_subcircuit.ts
|
|
3880
|
-
import { z as
|
|
3881
|
-
var simulation_spice_subcircuit =
|
|
3882
|
-
type:
|
|
4165
|
+
import { z as z189 } from "zod";
|
|
4166
|
+
var simulation_spice_subcircuit = z189.object({
|
|
4167
|
+
type: z189.literal("simulation_spice_subcircuit"),
|
|
3883
4168
|
simulation_spice_subcircuit_id: getZodPrefixedIdWithDefault(
|
|
3884
4169
|
"simulation_spice_subcircuit"
|
|
3885
4170
|
),
|
|
3886
|
-
source_component_id:
|
|
3887
|
-
spice_pin_to_source_port_map:
|
|
3888
|
-
subcircuit_source:
|
|
4171
|
+
source_component_id: z189.string(),
|
|
4172
|
+
spice_pin_to_source_port_map: z189.record(z189.string(), z189.string()),
|
|
4173
|
+
subcircuit_source: z189.string()
|
|
3889
4174
|
}).describe("Defines a custom SPICE subcircuit model for simulation");
|
|
3890
4175
|
expectTypesMatch(
|
|
3891
4176
|
true
|
|
3892
4177
|
);
|
|
3893
4178
|
|
|
3894
4179
|
// src/simulation/simulation_oscilloscope_trace.ts
|
|
3895
|
-
import { z as
|
|
4180
|
+
import { z as z190 } from "zod";
|
|
3896
4181
|
var hasValue = (value) => value !== void 0;
|
|
3897
|
-
var simulation_oscilloscope_trace =
|
|
3898
|
-
type:
|
|
4182
|
+
var simulation_oscilloscope_trace = z190.object({
|
|
4183
|
+
type: z190.literal("simulation_oscilloscope_trace"),
|
|
3899
4184
|
simulation_oscilloscope_trace_id: getZodPrefixedIdWithDefault(
|
|
3900
4185
|
"simulation_oscilloscope_trace"
|
|
3901
4186
|
),
|
|
3902
|
-
simulation_transient_voltage_graph_id:
|
|
3903
|
-
simulation_transient_current_graph_id:
|
|
3904
|
-
simulation_voltage_probe_id:
|
|
3905
|
-
simulation_current_probe_id:
|
|
3906
|
-
display_name:
|
|
3907
|
-
color:
|
|
3908
|
-
display_center_value:
|
|
3909
|
-
display_center_offset_divs:
|
|
3910
|
-
volts_per_div:
|
|
3911
|
-
amps_per_div:
|
|
4187
|
+
simulation_transient_voltage_graph_id: z190.string().optional(),
|
|
4188
|
+
simulation_transient_current_graph_id: z190.string().optional(),
|
|
4189
|
+
simulation_voltage_probe_id: z190.string().optional(),
|
|
4190
|
+
simulation_current_probe_id: z190.string().optional(),
|
|
4191
|
+
display_name: z190.string().optional(),
|
|
4192
|
+
color: z190.string().optional(),
|
|
4193
|
+
display_center_value: z190.number().optional(),
|
|
4194
|
+
display_center_offset_divs: z190.number().optional(),
|
|
4195
|
+
volts_per_div: z190.number().positive().optional(),
|
|
4196
|
+
amps_per_div: z190.number().positive().optional()
|
|
3912
4197
|
}).describe(
|
|
3913
4198
|
"Defines how a simulation measurement is rendered as an oscilloscope-style trace."
|
|
3914
4199
|
).superRefine((data, ctx) => {
|
|
@@ -3922,19 +4207,19 @@ var simulation_oscilloscope_trace = z180.object({
|
|
|
3922
4207
|
].filter(hasValue).length;
|
|
3923
4208
|
if (voltageReferences + currentReferences !== 1) {
|
|
3924
4209
|
ctx.addIssue({
|
|
3925
|
-
code:
|
|
4210
|
+
code: z190.ZodIssueCode.custom,
|
|
3926
4211
|
message: "An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."
|
|
3927
4212
|
});
|
|
3928
4213
|
}
|
|
3929
4214
|
if (voltageReferences > 0 && data.amps_per_div !== void 0) {
|
|
3930
4215
|
ctx.addIssue({
|
|
3931
|
-
code:
|
|
4216
|
+
code: z190.ZodIssueCode.custom,
|
|
3932
4217
|
message: "Voltage oscilloscope traces must use volts_per_div, not amps_per_div."
|
|
3933
4218
|
});
|
|
3934
4219
|
}
|
|
3935
4220
|
if (currentReferences > 0 && data.volts_per_div !== void 0) {
|
|
3936
4221
|
ctx.addIssue({
|
|
3937
|
-
code:
|
|
4222
|
+
code: z190.ZodIssueCode.custom,
|
|
3938
4223
|
message: "Current oscilloscope traces must use amps_per_div, not volts_per_div."
|
|
3939
4224
|
});
|
|
3940
4225
|
}
|
|
@@ -3942,8 +4227,8 @@ var simulation_oscilloscope_trace = z180.object({
|
|
|
3942
4227
|
expectTypesMatch(true);
|
|
3943
4228
|
|
|
3944
4229
|
// src/any_circuit_element.ts
|
|
3945
|
-
import { z as
|
|
3946
|
-
var any_circuit_element =
|
|
4230
|
+
import { z as z191 } from "zod";
|
|
4231
|
+
var any_circuit_element = z191.union([
|
|
3947
4232
|
source_trace,
|
|
3948
4233
|
source_port,
|
|
3949
4234
|
source_component_internal_connection,
|
|
@@ -4084,6 +4369,13 @@ var any_circuit_element = z181.union([
|
|
|
4084
4369
|
simulation_experiment,
|
|
4085
4370
|
simulation_transient_voltage_graph,
|
|
4086
4371
|
simulation_transient_current_graph,
|
|
4372
|
+
simulation_dc_operating_point_voltage,
|
|
4373
|
+
simulation_dc_operating_point_current,
|
|
4374
|
+
simulation_dc_sweep_voltage_graph,
|
|
4375
|
+
simulation_dc_sweep_current_graph,
|
|
4376
|
+
simulation_ac_sweep_voltage_graph,
|
|
4377
|
+
simulation_ac_sweep_current_graph,
|
|
4378
|
+
simulation_parameter_sweep,
|
|
4087
4379
|
simulation_switch,
|
|
4088
4380
|
simulation_voltage_probe,
|
|
4089
4381
|
simulation_current_probe,
|
|
@@ -4268,14 +4560,26 @@ export {
|
|
|
4268
4560
|
schematic_trace,
|
|
4269
4561
|
schematic_voltage_probe,
|
|
4270
4562
|
simulation_ac_current_source,
|
|
4563
|
+
simulation_ac_sweep_current_graph,
|
|
4564
|
+
simulation_ac_sweep_voltage_graph,
|
|
4271
4565
|
simulation_ac_voltage_source,
|
|
4566
|
+
simulation_complex_sample,
|
|
4272
4567
|
simulation_current_probe,
|
|
4273
4568
|
simulation_current_source,
|
|
4274
4569
|
simulation_dc_current_source,
|
|
4570
|
+
simulation_dc_operating_point_current,
|
|
4571
|
+
simulation_dc_operating_point_voltage,
|
|
4572
|
+
simulation_dc_sweep_current_graph,
|
|
4573
|
+
simulation_dc_sweep_unit,
|
|
4574
|
+
simulation_dc_sweep_voltage_graph,
|
|
4275
4575
|
simulation_dc_voltage_source,
|
|
4276
4576
|
simulation_experiment,
|
|
4277
4577
|
simulation_op_amp,
|
|
4278
4578
|
simulation_oscilloscope_trace,
|
|
4579
|
+
simulation_parameter_sweep,
|
|
4580
|
+
simulation_parameter_sweep_coordinate,
|
|
4581
|
+
simulation_parameter_type,
|
|
4582
|
+
simulation_parameter_unit,
|
|
4279
4583
|
simulation_spice_subcircuit,
|
|
4280
4584
|
simulation_switch,
|
|
4281
4585
|
simulation_transient_current_graph,
|