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

index.tsx

PCBPCB preview for index.tsx
SchematicSchematic preview for index.tsx
export default () => (
           <board schMaxTraceDistance={10} routingDisabled>
            <voltagesource name="V1" voltage="5V" />
            <resistor name="R_base" resistance="10k" schY={2} />
            <switch name="SW1" simSwitchFrequency="1kHz" schX={1.5} schY={2} />
            <transistor
              name="Q1"
              type="npn"
              footprint="sot23"
              schX={2}
              schY={0.3}
              schRotation={180}
            />
            <resistor name="R_collector" resistance="10k" schY={-2} />

            <trace from=".V1 > .pin1" to=".R_base > .pin1" />
            <trace from=".R_base > .pin2" to=".SW1 > .pin1" />
            <trace from=".SW1 > .pin2" to=".Q1 > .base" />

            <trace from=".V1 > .pin1" to=".R_collector > .pin1" />
            <trace from=".R_collector > .pin2" to=".Q1 > .collector" />

            <trace from=".Q1 > .emitter" to=".V1 > .pin2" />

            <voltageprobe name="VP_COLLECTOR" connectsTo=".R_collector > .pin2" />

          <analogsimulation duration="4ms" timePerStep="1us" spiceEngine="ngspice" /> 
          </board>
        
)