ShiboSoftwareDev/simulation
This circuit models an NPN transistor switch with a 5V supply, a base resistor, a collector resistor, a switch controlling the base, and a voltage probe, simulated over 4ms using ngspice.
Usage: To import and use the "@tsci/ShiboSoftwareDev.simulation" package: 1. Import the component in your project: ```tsx import SimulationCircuit from "@tsci/ShiboSoftwareDev.simulation" ``` 2. Use the component within a tscircuit project: ```tsx export default () => ( <board> <SimulationCircuit /> </board> ) ``` The component creates a predefined circuit simulation with a voltage source, resistors, switch, transistor, and voltage probe, configured for a 4ms analog simulation using ngspice.
- Version
- 0.0.1
- License
- unset
- Stars
- 0
dist/index.cjs
PCB
Schematic
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var index = () => (jsxRuntime.jsxs("board", { schMaxTraceDistance: 10, routingDisabled: true, children: [jsxRuntime.jsx("voltagesource", { name: "V1", voltage: "5V" }), jsxRuntime.jsx("resistor", { name: "R_base", resistance: "10k", schY: 2 }), jsxRuntime.jsx("switch", { name: "SW1", simSwitchFrequency: "1kHz", schX: 1.5, schY: 2 }), jsxRuntime.jsx("transistor", { name: "Q1", type: "npn", footprint: "sot23", schX: 2, schY: 0.3, schRotation: 180 }), jsxRuntime.jsx("resistor", { name: "R_collector", resistance: "10k", schY: -2 }), jsxRuntime.jsx("trace", { from: ".V1 > .pin1", to: ".R_base > .pin1" }), jsxRuntime.jsx("trace", { from: ".R_base > .pin2", to: ".SW1 > .pin1" }), jsxRuntime.jsx("trace", { from: ".SW1 > .pin2", to: ".Q1 > .base" }), jsxRuntime.jsx("trace", { from: ".V1 > .pin1", to: ".R_collector > .pin1" }), jsxRuntime.jsx("trace", { from: ".R_collector > .pin2", to: ".Q1 > .collector" }), jsxRuntime.jsx("trace", { from: ".Q1 > .emitter", to: ".V1 > .pin2" }), jsxRuntime.jsx("voltageprobe", { name: "VP_COLLECTOR", connectsTo: ".R_collector > .pin2" }), jsxRuntime.jsx("analogsimulation", { duration: "4ms", timePerStep: "1us", spiceEngine: "ngspice" })] }));
module.exports = index;