circuit-json 0.0.338 → 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 +46 -0
- package/dist/index.d.mts +480 -70
- package/dist/index.mjs +109 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2007,11 +2007,20 @@ var pcb_board = z88.object({
|
|
|
2007
2007
|
width: length.optional(),
|
|
2008
2008
|
height: length.optional(),
|
|
2009
2009
|
center: point,
|
|
2010
|
+
display_offset_x: z88.string().optional().describe(
|
|
2011
|
+
"How to display the x offset for this board, usually corresponding with how the user specified it"
|
|
2012
|
+
),
|
|
2013
|
+
display_offset_y: z88.string().optional().describe(
|
|
2014
|
+
"How to display the y offset for this board, usually corresponding with how the user specified it"
|
|
2015
|
+
),
|
|
2010
2016
|
thickness: length.optional().default(1.4),
|
|
2011
2017
|
num_layers: z88.number().optional().default(4),
|
|
2012
2018
|
outline: z88.array(point).optional(),
|
|
2013
2019
|
shape: z88.enum(["rect", "polygon"]).optional(),
|
|
2014
|
-
material: z88.enum(["fr4", "fr1"]).default("fr4")
|
|
2020
|
+
material: z88.enum(["fr4", "fr1"]).default("fr4"),
|
|
2021
|
+
anchor_position: point.optional(),
|
|
2022
|
+
anchor_alignment: ninePointAnchor.default("center"),
|
|
2023
|
+
position_mode: z88.enum(["relative_to_panel_anchor", "none"]).optional()
|
|
2015
2024
|
}).describe("Defines the board outline of the PCB");
|
|
2016
2025
|
expectTypesMatch(true);
|
|
2017
2026
|
|
|
@@ -2895,20 +2904,67 @@ expectTypesMatch(true);
|
|
|
2895
2904
|
expectTypesMatch(true);
|
|
2896
2905
|
expectTypesMatch(true);
|
|
2897
2906
|
|
|
2898
|
-
// src/simulation/
|
|
2907
|
+
// src/simulation/simulation_current_source.ts
|
|
2899
2908
|
import { z as z131 } from "zod";
|
|
2900
|
-
var
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
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")
|
|
2905
2961
|
]);
|
|
2906
|
-
var simulation_experiment =
|
|
2907
|
-
type:
|
|
2962
|
+
var simulation_experiment = z132.object({
|
|
2963
|
+
type: z132.literal("simulation_experiment"),
|
|
2908
2964
|
simulation_experiment_id: getZodPrefixedIdWithDefault(
|
|
2909
2965
|
"simulation_experiment"
|
|
2910
2966
|
),
|
|
2911
|
-
name:
|
|
2967
|
+
name: z132.string(),
|
|
2912
2968
|
experiment_type,
|
|
2913
2969
|
time_per_step: duration_ms.optional(),
|
|
2914
2970
|
start_time_ms: ms.optional(),
|
|
@@ -2917,53 +2973,53 @@ var simulation_experiment = z131.object({
|
|
|
2917
2973
|
expectTypesMatch(true);
|
|
2918
2974
|
|
|
2919
2975
|
// src/simulation/simulation_transient_voltage_graph.ts
|
|
2920
|
-
import { z as
|
|
2921
|
-
var simulation_transient_voltage_graph =
|
|
2922
|
-
type:
|
|
2976
|
+
import { z as z133 } from "zod";
|
|
2977
|
+
var simulation_transient_voltage_graph = z133.object({
|
|
2978
|
+
type: z133.literal("simulation_transient_voltage_graph"),
|
|
2923
2979
|
simulation_transient_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
2924
2980
|
"simulation_transient_voltage_graph"
|
|
2925
2981
|
),
|
|
2926
|
-
simulation_experiment_id:
|
|
2927
|
-
timestamps_ms:
|
|
2928
|
-
voltage_levels:
|
|
2929
|
-
source_component_id:
|
|
2930
|
-
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(),
|
|
2931
2987
|
time_per_step: duration_ms,
|
|
2932
2988
|
start_time_ms: ms,
|
|
2933
2989
|
end_time_ms: ms,
|
|
2934
|
-
name:
|
|
2935
|
-
color:
|
|
2990
|
+
name: z133.string().optional(),
|
|
2991
|
+
color: z133.string().optional()
|
|
2936
2992
|
}).describe("Stores voltage measurements over time for a simulation");
|
|
2937
2993
|
expectTypesMatch(true);
|
|
2938
2994
|
|
|
2939
2995
|
// src/simulation/simulation_switch.ts
|
|
2940
|
-
import { z as
|
|
2941
|
-
var simulation_switch =
|
|
2942
|
-
type:
|
|
2996
|
+
import { z as z134 } from "zod";
|
|
2997
|
+
var simulation_switch = z134.object({
|
|
2998
|
+
type: z134.literal("simulation_switch"),
|
|
2943
2999
|
simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
|
|
2944
|
-
source_component_id:
|
|
3000
|
+
source_component_id: z134.string().optional(),
|
|
2945
3001
|
closes_at: ms.optional(),
|
|
2946
3002
|
opens_at: ms.optional(),
|
|
2947
|
-
starts_closed:
|
|
3003
|
+
starts_closed: z134.boolean().optional(),
|
|
2948
3004
|
switching_frequency: frequency.optional()
|
|
2949
3005
|
}).describe("Defines a switch for simulation timing control");
|
|
2950
3006
|
expectTypesMatch(true);
|
|
2951
3007
|
|
|
2952
3008
|
// src/simulation/simulation_voltage_probe.ts
|
|
2953
|
-
import { z as
|
|
2954
|
-
var simulation_voltage_probe =
|
|
2955
|
-
type:
|
|
3009
|
+
import { z as z135 } from "zod";
|
|
3010
|
+
var simulation_voltage_probe = z135.object({
|
|
3011
|
+
type: z135.literal("simulation_voltage_probe"),
|
|
2956
3012
|
simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
|
|
2957
3013
|
"simulation_voltage_probe"
|
|
2958
3014
|
),
|
|
2959
|
-
source_component_id:
|
|
2960
|
-
name:
|
|
2961
|
-
signal_input_source_port_id:
|
|
2962
|
-
signal_input_source_net_id:
|
|
2963
|
-
reference_input_source_port_id:
|
|
2964
|
-
reference_input_source_net_id:
|
|
2965
|
-
subcircuit_id:
|
|
2966
|
-
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()
|
|
2967
3023
|
}).describe(
|
|
2968
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."
|
|
2969
3025
|
).superRefine((data, ctx) => {
|
|
@@ -2973,20 +3029,20 @@ var simulation_voltage_probe = z134.object({
|
|
|
2973
3029
|
const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
|
|
2974
3030
|
if (has_ports && has_nets) {
|
|
2975
3031
|
ctx.addIssue({
|
|
2976
|
-
code:
|
|
3032
|
+
code: z135.ZodIssueCode.custom,
|
|
2977
3033
|
message: "Cannot mix port and net connections in a differential probe."
|
|
2978
3034
|
});
|
|
2979
3035
|
} else if (has_ports) {
|
|
2980
3036
|
if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
|
|
2981
3037
|
ctx.addIssue({
|
|
2982
|
-
code:
|
|
3038
|
+
code: z135.ZodIssueCode.custom,
|
|
2983
3039
|
message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
|
|
2984
3040
|
});
|
|
2985
3041
|
}
|
|
2986
3042
|
} else if (has_nets) {
|
|
2987
3043
|
if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
|
|
2988
3044
|
ctx.addIssue({
|
|
2989
|
-
code:
|
|
3045
|
+
code: z135.ZodIssueCode.custom,
|
|
2990
3046
|
message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
|
|
2991
3047
|
});
|
|
2992
3048
|
}
|
|
@@ -2994,7 +3050,7 @@ var simulation_voltage_probe = z134.object({
|
|
|
2994
3050
|
} else {
|
|
2995
3051
|
if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
|
|
2996
3052
|
ctx.addIssue({
|
|
2997
|
-
code:
|
|
3053
|
+
code: z135.ZodIssueCode.custom,
|
|
2998
3054
|
message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
|
|
2999
3055
|
});
|
|
3000
3056
|
}
|
|
@@ -3003,22 +3059,22 @@ var simulation_voltage_probe = z134.object({
|
|
|
3003
3059
|
expectTypesMatch(true);
|
|
3004
3060
|
|
|
3005
3061
|
// src/simulation/simulation_unknown_experiment_error.ts
|
|
3006
|
-
import { z as
|
|
3007
|
-
var simulation_unknown_experiment_error =
|
|
3008
|
-
type:
|
|
3062
|
+
import { z as z136 } from "zod";
|
|
3063
|
+
var simulation_unknown_experiment_error = z136.object({
|
|
3064
|
+
type: z136.literal("simulation_unknown_experiment_error"),
|
|
3009
3065
|
simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
|
|
3010
3066
|
"simulation_unknown_experiment_error"
|
|
3011
3067
|
),
|
|
3012
|
-
error_type:
|
|
3013
|
-
message:
|
|
3014
|
-
simulation_experiment_id:
|
|
3015
|
-
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()
|
|
3016
3072
|
}).describe("An unknown error occurred during the simulation experiment.");
|
|
3017
3073
|
expectTypesMatch(true);
|
|
3018
3074
|
|
|
3019
3075
|
// src/any_circuit_element.ts
|
|
3020
|
-
import { z as
|
|
3021
|
-
var any_circuit_element =
|
|
3076
|
+
import { z as z137 } from "zod";
|
|
3077
|
+
var any_circuit_element = z137.union([
|
|
3022
3078
|
source_trace,
|
|
3023
3079
|
source_port,
|
|
3024
3080
|
source_component_internal_connection,
|
|
@@ -3127,6 +3183,7 @@ var any_circuit_element = z136.union([
|
|
|
3127
3183
|
schematic_table_cell,
|
|
3128
3184
|
cad_component,
|
|
3129
3185
|
simulation_voltage_source,
|
|
3186
|
+
simulation_current_source,
|
|
3130
3187
|
simulation_experiment,
|
|
3131
3188
|
simulation_transient_voltage_graph,
|
|
3132
3189
|
simulation_switch,
|
|
@@ -3268,7 +3325,10 @@ export {
|
|
|
3268
3325
|
schematic_text,
|
|
3269
3326
|
schematic_trace,
|
|
3270
3327
|
schematic_voltage_probe,
|
|
3328
|
+
simulation_ac_current_source,
|
|
3271
3329
|
simulation_ac_voltage_source,
|
|
3330
|
+
simulation_current_source,
|
|
3331
|
+
simulation_dc_current_source,
|
|
3272
3332
|
simulation_dc_voltage_source,
|
|
3273
3333
|
simulation_experiment,
|
|
3274
3334
|
simulation_switch,
|