circuit-json 0.0.339 → 0.0.340
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 +41 -0
- package/dist/index.d.mts +316 -1
- package/dist/index.mjs +99 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2904,20 +2904,67 @@ expectTypesMatch(true);
|
|
|
2904
2904
|
expectTypesMatch(true);
|
|
2905
2905
|
expectTypesMatch(true);
|
|
2906
2906
|
|
|
2907
|
-
// src/simulation/
|
|
2907
|
+
// src/simulation/simulation_current_source.ts
|
|
2908
2908
|
import { z as z131 } from "zod";
|
|
2909
|
-
var
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2909
|
+
var percentage2 = z131.union([z131.string(), z131.number()]).transform((val) => {
|
|
2910
|
+
if (typeof val === "string") {
|
|
2911
|
+
if (val.endsWith("%")) {
|
|
2912
|
+
return parseFloat(val.slice(0, -1)) / 100;
|
|
2913
|
+
}
|
|
2914
|
+
return parseFloat(val);
|
|
2915
|
+
}
|
|
2916
|
+
return val;
|
|
2917
|
+
}).pipe(
|
|
2918
|
+
z131.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
|
|
2919
|
+
);
|
|
2920
|
+
var simulation_dc_current_source = z131.object({
|
|
2921
|
+
type: z131.literal("simulation_current_source"),
|
|
2922
|
+
simulation_current_source_id: getZodPrefixedIdWithDefault(
|
|
2923
|
+
"simulation_current_source"
|
|
2924
|
+
),
|
|
2925
|
+
is_dc_source: z131.literal(true).optional().default(true),
|
|
2926
|
+
positive_source_port_id: z131.string().optional(),
|
|
2927
|
+
negative_source_port_id: z131.string().optional(),
|
|
2928
|
+
positive_source_net_id: z131.string().optional(),
|
|
2929
|
+
negative_source_net_id: z131.string().optional(),
|
|
2930
|
+
current
|
|
2931
|
+
}).describe("Defines a DC current source for simulation");
|
|
2932
|
+
var simulation_ac_current_source = z131.object({
|
|
2933
|
+
type: z131.literal("simulation_current_source"),
|
|
2934
|
+
simulation_current_source_id: getZodPrefixedIdWithDefault(
|
|
2935
|
+
"simulation_current_source"
|
|
2936
|
+
),
|
|
2937
|
+
is_dc_source: z131.literal(false),
|
|
2938
|
+
terminal1_source_port_id: z131.string().optional(),
|
|
2939
|
+
terminal2_source_port_id: z131.string().optional(),
|
|
2940
|
+
terminal1_source_net_id: z131.string().optional(),
|
|
2941
|
+
terminal2_source_net_id: z131.string().optional(),
|
|
2942
|
+
current: current.optional(),
|
|
2943
|
+
frequency: frequency.optional(),
|
|
2944
|
+
peak_to_peak_current: current.optional(),
|
|
2945
|
+
wave_shape: wave_shape.optional(),
|
|
2946
|
+
phase: rotation.optional(),
|
|
2947
|
+
duty_cycle: percentage2.optional()
|
|
2948
|
+
}).describe("Defines an AC current source for simulation");
|
|
2949
|
+
var simulation_current_source = z131.union([simulation_dc_current_source, simulation_ac_current_source]).describe("Defines a current source for simulation");
|
|
2950
|
+
expectTypesMatch(true);
|
|
2951
|
+
expectTypesMatch(true);
|
|
2952
|
+
expectTypesMatch(true);
|
|
2953
|
+
|
|
2954
|
+
// src/simulation/simulation_experiment.ts
|
|
2955
|
+
import { z as z132 } from "zod";
|
|
2956
|
+
var experiment_type = z132.union([
|
|
2957
|
+
z132.literal("spice_dc_sweep"),
|
|
2958
|
+
z132.literal("spice_dc_operating_point"),
|
|
2959
|
+
z132.literal("spice_transient_analysis"),
|
|
2960
|
+
z132.literal("spice_ac_analysis")
|
|
2914
2961
|
]);
|
|
2915
|
-
var simulation_experiment =
|
|
2916
|
-
type:
|
|
2962
|
+
var simulation_experiment = z132.object({
|
|
2963
|
+
type: z132.literal("simulation_experiment"),
|
|
2917
2964
|
simulation_experiment_id: getZodPrefixedIdWithDefault(
|
|
2918
2965
|
"simulation_experiment"
|
|
2919
2966
|
),
|
|
2920
|
-
name:
|
|
2967
|
+
name: z132.string(),
|
|
2921
2968
|
experiment_type,
|
|
2922
2969
|
time_per_step: duration_ms.optional(),
|
|
2923
2970
|
start_time_ms: ms.optional(),
|
|
@@ -2926,53 +2973,53 @@ var simulation_experiment = z131.object({
|
|
|
2926
2973
|
expectTypesMatch(true);
|
|
2927
2974
|
|
|
2928
2975
|
// src/simulation/simulation_transient_voltage_graph.ts
|
|
2929
|
-
import { z as
|
|
2930
|
-
var simulation_transient_voltage_graph =
|
|
2931
|
-
type:
|
|
2976
|
+
import { z as z133 } from "zod";
|
|
2977
|
+
var simulation_transient_voltage_graph = z133.object({
|
|
2978
|
+
type: z133.literal("simulation_transient_voltage_graph"),
|
|
2932
2979
|
simulation_transient_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
2933
2980
|
"simulation_transient_voltage_graph"
|
|
2934
2981
|
),
|
|
2935
|
-
simulation_experiment_id:
|
|
2936
|
-
timestamps_ms:
|
|
2937
|
-
voltage_levels:
|
|
2938
|
-
source_component_id:
|
|
2939
|
-
subcircuit_connectivity_map_key:
|
|
2982
|
+
simulation_experiment_id: z133.string(),
|
|
2983
|
+
timestamps_ms: z133.array(z133.number()).optional(),
|
|
2984
|
+
voltage_levels: z133.array(z133.number()),
|
|
2985
|
+
source_component_id: z133.string().optional(),
|
|
2986
|
+
subcircuit_connectivity_map_key: z133.string().optional(),
|
|
2940
2987
|
time_per_step: duration_ms,
|
|
2941
2988
|
start_time_ms: ms,
|
|
2942
2989
|
end_time_ms: ms,
|
|
2943
|
-
name:
|
|
2944
|
-
color:
|
|
2990
|
+
name: z133.string().optional(),
|
|
2991
|
+
color: z133.string().optional()
|
|
2945
2992
|
}).describe("Stores voltage measurements over time for a simulation");
|
|
2946
2993
|
expectTypesMatch(true);
|
|
2947
2994
|
|
|
2948
2995
|
// src/simulation/simulation_switch.ts
|
|
2949
|
-
import { z as
|
|
2950
|
-
var simulation_switch =
|
|
2951
|
-
type:
|
|
2996
|
+
import { z as z134 } from "zod";
|
|
2997
|
+
var simulation_switch = z134.object({
|
|
2998
|
+
type: z134.literal("simulation_switch"),
|
|
2952
2999
|
simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
|
|
2953
|
-
source_component_id:
|
|
3000
|
+
source_component_id: z134.string().optional(),
|
|
2954
3001
|
closes_at: ms.optional(),
|
|
2955
3002
|
opens_at: ms.optional(),
|
|
2956
|
-
starts_closed:
|
|
3003
|
+
starts_closed: z134.boolean().optional(),
|
|
2957
3004
|
switching_frequency: frequency.optional()
|
|
2958
3005
|
}).describe("Defines a switch for simulation timing control");
|
|
2959
3006
|
expectTypesMatch(true);
|
|
2960
3007
|
|
|
2961
3008
|
// src/simulation/simulation_voltage_probe.ts
|
|
2962
|
-
import { z as
|
|
2963
|
-
var simulation_voltage_probe =
|
|
2964
|
-
type:
|
|
3009
|
+
import { z as z135 } from "zod";
|
|
3010
|
+
var simulation_voltage_probe = z135.object({
|
|
3011
|
+
type: z135.literal("simulation_voltage_probe"),
|
|
2965
3012
|
simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
|
|
2966
3013
|
"simulation_voltage_probe"
|
|
2967
3014
|
),
|
|
2968
|
-
source_component_id:
|
|
2969
|
-
name:
|
|
2970
|
-
signal_input_source_port_id:
|
|
2971
|
-
signal_input_source_net_id:
|
|
2972
|
-
reference_input_source_port_id:
|
|
2973
|
-
reference_input_source_net_id:
|
|
2974
|
-
subcircuit_id:
|
|
2975
|
-
color:
|
|
3015
|
+
source_component_id: z135.string().optional(),
|
|
3016
|
+
name: z135.string().optional(),
|
|
3017
|
+
signal_input_source_port_id: z135.string().optional(),
|
|
3018
|
+
signal_input_source_net_id: z135.string().optional(),
|
|
3019
|
+
reference_input_source_port_id: z135.string().optional(),
|
|
3020
|
+
reference_input_source_net_id: z135.string().optional(),
|
|
3021
|
+
subcircuit_id: z135.string().optional(),
|
|
3022
|
+
color: z135.string().optional()
|
|
2976
3023
|
}).describe(
|
|
2977
3024
|
"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."
|
|
2978
3025
|
).superRefine((data, ctx) => {
|
|
@@ -2982,20 +3029,20 @@ var simulation_voltage_probe = z134.object({
|
|
|
2982
3029
|
const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
|
|
2983
3030
|
if (has_ports && has_nets) {
|
|
2984
3031
|
ctx.addIssue({
|
|
2985
|
-
code:
|
|
3032
|
+
code: z135.ZodIssueCode.custom,
|
|
2986
3033
|
message: "Cannot mix port and net connections in a differential probe."
|
|
2987
3034
|
});
|
|
2988
3035
|
} else if (has_ports) {
|
|
2989
3036
|
if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
|
|
2990
3037
|
ctx.addIssue({
|
|
2991
|
-
code:
|
|
3038
|
+
code: z135.ZodIssueCode.custom,
|
|
2992
3039
|
message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
|
|
2993
3040
|
});
|
|
2994
3041
|
}
|
|
2995
3042
|
} else if (has_nets) {
|
|
2996
3043
|
if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
|
|
2997
3044
|
ctx.addIssue({
|
|
2998
|
-
code:
|
|
3045
|
+
code: z135.ZodIssueCode.custom,
|
|
2999
3046
|
message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
|
|
3000
3047
|
});
|
|
3001
3048
|
}
|
|
@@ -3003,7 +3050,7 @@ var simulation_voltage_probe = z134.object({
|
|
|
3003
3050
|
} else {
|
|
3004
3051
|
if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
|
|
3005
3052
|
ctx.addIssue({
|
|
3006
|
-
code:
|
|
3053
|
+
code: z135.ZodIssueCode.custom,
|
|
3007
3054
|
message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
|
|
3008
3055
|
});
|
|
3009
3056
|
}
|
|
@@ -3012,22 +3059,22 @@ var simulation_voltage_probe = z134.object({
|
|
|
3012
3059
|
expectTypesMatch(true);
|
|
3013
3060
|
|
|
3014
3061
|
// src/simulation/simulation_unknown_experiment_error.ts
|
|
3015
|
-
import { z as
|
|
3016
|
-
var simulation_unknown_experiment_error =
|
|
3017
|
-
type:
|
|
3062
|
+
import { z as z136 } from "zod";
|
|
3063
|
+
var simulation_unknown_experiment_error = z136.object({
|
|
3064
|
+
type: z136.literal("simulation_unknown_experiment_error"),
|
|
3018
3065
|
simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
|
|
3019
3066
|
"simulation_unknown_experiment_error"
|
|
3020
3067
|
),
|
|
3021
|
-
error_type:
|
|
3022
|
-
message:
|
|
3023
|
-
simulation_experiment_id:
|
|
3024
|
-
subcircuit_id:
|
|
3068
|
+
error_type: z136.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
|
|
3069
|
+
message: z136.string(),
|
|
3070
|
+
simulation_experiment_id: z136.string().optional(),
|
|
3071
|
+
subcircuit_id: z136.string().optional()
|
|
3025
3072
|
}).describe("An unknown error occurred during the simulation experiment.");
|
|
3026
3073
|
expectTypesMatch(true);
|
|
3027
3074
|
|
|
3028
3075
|
// src/any_circuit_element.ts
|
|
3029
|
-
import { z as
|
|
3030
|
-
var any_circuit_element =
|
|
3076
|
+
import { z as z137 } from "zod";
|
|
3077
|
+
var any_circuit_element = z137.union([
|
|
3031
3078
|
source_trace,
|
|
3032
3079
|
source_port,
|
|
3033
3080
|
source_component_internal_connection,
|
|
@@ -3136,6 +3183,7 @@ var any_circuit_element = z136.union([
|
|
|
3136
3183
|
schematic_table_cell,
|
|
3137
3184
|
cad_component,
|
|
3138
3185
|
simulation_voltage_source,
|
|
3186
|
+
simulation_current_source,
|
|
3139
3187
|
simulation_experiment,
|
|
3140
3188
|
simulation_transient_voltage_graph,
|
|
3141
3189
|
simulation_switch,
|
|
@@ -3277,7 +3325,10 @@ export {
|
|
|
3277
3325
|
schematic_text,
|
|
3278
3326
|
schematic_trace,
|
|
3279
3327
|
schematic_voltage_probe,
|
|
3328
|
+
simulation_ac_current_source,
|
|
3280
3329
|
simulation_ac_voltage_source,
|
|
3330
|
+
simulation_current_source,
|
|
3331
|
+
simulation_dc_current_source,
|
|
3281
3332
|
simulation_dc_voltage_source,
|
|
3282
3333
|
simulation_experiment,
|
|
3283
3334
|
simulation_switch,
|