@tscircuit/ngspice-spice-engine 0.0.11 → 0.0.12

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SpiceEngine } from '@tscircuit/props';
2
- import { ResultType } from 'eecircuit-engine';
2
+ import { ResultType } from '@tscircuit/eecircuit-engine';
3
3
 
4
4
  interface TranParams {
5
5
  tstep?: number;
@@ -15,10 +15,7 @@ interface VoltageGraph {
15
15
  time: number[];
16
16
  voltage: number[];
17
17
  }
18
- interface NgspiceSpiceEngineOptions {
19
- pspiceCompatibility?: boolean;
20
- }
21
18
  declare const eecircuitResultToVGraphs: (result: ResultType, spiceString: string) => VoltageGraph[];
22
- declare const createNgspiceSpiceEngine: (options?: NgspiceSpiceEngineOptions) => Promise<SpiceEngine>;
19
+ declare const createNgspiceSpiceEngine: () => Promise<SpiceEngine>;
23
20
 
24
- export { type NgspiceSpiceEngineOptions, type TranParams, createNgspiceSpiceEngine, createNgspiceSpiceEngine as default, eecircuitResultToVGraphs, parseTranParams };
21
+ export { type TranParams, createNgspiceSpiceEngine, createNgspiceSpiceEngine as default, eecircuitResultToVGraphs, parseTranParams };
package/dist/index.js CHANGED
@@ -110,8 +110,8 @@ var parseTranParams = (spiceString) => {
110
110
 
111
111
  // lib/index.ts
112
112
  var ensureSimulation = async () => {
113
- const { Simulation: SimulationCtor } = await import("eecircuit-engine");
114
- const instance = new SimulationCtor();
113
+ const { Simulation: SimulationCtor } = await import("@tscircuit/eecircuit-engine");
114
+ const instance = new SimulationCtor({ ngBehavior: "psa" });
115
115
  await instance.start();
116
116
  return instance;
117
117
  };
@@ -240,31 +240,9 @@ var voltageGraphsToCircuitJson = (graphs, spiceString) => {
240
240
  end_time_ms: (tranParams?.tstop ?? 0) * 1e3
241
241
  }));
242
242
  };
243
- var configureNgBehavior = (simulation, pspiceCompatibility) => {
244
- const simulationWithCommandList = simulation;
245
- const commandList = simulationWithCommandList.commandList;
246
- if (!Array.isArray(commandList)) {
247
- if (pspiceCompatibility) {
248
- throw new Error(
249
- "Unable to enable PSPICE compatibility: eecircuit-engine commandList is not accessible"
250
- );
251
- }
252
- return;
253
- }
254
- const ngBehaviorCommand = pspiceCompatibility ? "set ngbehavior=psa" : "unset ngbehavior";
255
- const sourceCommandIndex = commandList.findIndex(
256
- (command) => /^\s*source\s+test\.cir\s*$/i.test(command)
257
- );
258
- if (sourceCommandIndex === -1) {
259
- commandList.unshift(ngBehaviorCommand);
260
- return;
261
- }
262
- commandList.splice(sourceCommandIndex, 0, ngBehaviorCommand);
263
- };
264
- var simulate = async (spiceString, options) => {
243
+ var simulate = async (spiceString) => {
265
244
  const simulation = await getSimulation();
266
245
  simulation.setNetList(spiceString);
267
- configureNgBehavior(simulation, options.pspiceCompatibility);
268
246
  let result;
269
247
  try {
270
248
  result = await simulation.runSim();
@@ -283,12 +261,9 @@ var simulate = async (spiceString, options) => {
283
261
  )
284
262
  };
285
263
  };
286
- var createNgspiceSpiceEngine = async (options = {}) => {
287
- const resolvedOptions = {
288
- pspiceCompatibility: options.pspiceCompatibility ?? false
289
- };
264
+ var createNgspiceSpiceEngine = async () => {
290
265
  return {
291
- simulate: (spiceString) => simulate(spiceString, resolvedOptions)
266
+ simulate: (spiceString) => simulate(spiceString)
292
267
  };
293
268
  };
294
269
  var index_default = createNgspiceSpiceEngine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/ngspice-spice-engine",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A tscircuit-compatible SPICE engine using ngspice.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "typecheck": "tsc --noEmit"
18
18
  },
19
19
  "dependencies": {
20
- "eecircuit-engine": "^1.7.0"
20
+ "@tscircuit/eecircuit-engine": "https://jscdn.tscircuit.com/@tscircuit/eecircuit-engine/1.7.2.tgz"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@tscircuit/props": "^0.0.374",