Phase 1 implementation with ngspice backend and Astro/React frontend: Backend (FastAPI): - ngspice subprocess engine with custom .raw file parser - Notebook CRUD with .spicebook JSON format (filesystem storage) - Simulation endpoints (standalone + cell-in-notebook) - SVG waveform export endpoint - 18 REST API routes, 5 passing tests Frontend (Astro 5 + React 19): - Notebook editor as React island with Zustand state management - CodeMirror 6 with custom SPICE language mode (syntax highlighting for dot commands, components, engineering notation, comments) - uPlot waveform viewer with transient and AC/Bode plot modes - Markdown cells with edit/preview toggle - Notebook list with card grid UI - Dark theme, Tailwind CSS 4, Lucide icons Infrastructure: - Docker Compose with dev/prod targets - Caddy-based frontend prod serving - 3 example notebooks (RC filter, voltage divider, CE amplifier)
37 lines
2.1 KiB
Plaintext
37 lines
2.1 KiB
Plaintext
{
|
|
"spicebook_version": "2026-02-13",
|
|
"metadata": {
|
|
"title": "Common Emitter Amplifier",
|
|
"engine": "ngspice",
|
|
"tags": ["amplifier", "bjt", "intermediate"],
|
|
"created": "2026-02-13T00:00:00Z",
|
|
"modified": "2026-02-13T00:00:00Z"
|
|
},
|
|
"cells": [
|
|
{
|
|
"id": "cell-intro",
|
|
"type": "markdown",
|
|
"source": "# Common Emitter Amplifier\n\nA single-stage BJT amplifier with voltage divider biasing. This is one of the most common amplifier configurations.\n\nKey parameters:\n- **Voltage gain**: approximately -R_C / r_e (inverting)\n- **Input impedance**: R1 || R2 || (beta * r_e)\n- **Bandwidth**: determined by coupling and bypass capacitors",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-ac",
|
|
"type": "spice",
|
|
"source": "Common Emitter Amplifier - Frequency Response\nVCC vcc 0 DC 12\nV1 in 0 AC 1 SIN(0 10m 1k)\n* Bias network\nR1 vcc base 47k\nR2 base 0 10k\n* Transistor (2N2222 model)\nQ1 col base emit QNPN\n.model QNPN NPN(BF=200 IS=1e-14 VAF=100)\n* Collector and emitter resistors\nRC col vcc 4.7k\nRE emit 0 1k\n* Coupling capacitors\nC1 in base 10u\nC2 col out 10u\n* Emitter bypass capacitor\nCE emit 0 100u\n* Load\nRL out 0 10k\n.ac dec 50 10 10meg\n.end",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-explain",
|
|
"type": "markdown",
|
|
"source": "## Frequency Response Analysis\n\nThe Bode plot reveals the amplifier's bandwidth. Look for:\n\n1. **Low-frequency cutoff**: Determined by coupling capacitors C1, C2 and bypass capacitor CE\n2. **Mid-band gain**: The flat region where gain is approximately -R_C / r_e\n3. **High-frequency rolloff**: Due to transistor parasitic capacitances (not modeled here)",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-tran",
|
|
"type": "spice",
|
|
"source": "Common Emitter Amplifier - Transient Response\nVCC vcc 0 DC 12\nV1 in 0 SIN(0 10m 1k)\n* Bias network\nR1 vcc base 47k\nR2 base 0 10k\n* Transistor\nQ1 col base emit QNPN\n.model QNPN NPN(BF=200 IS=1e-14 VAF=100)\n* Collector and emitter resistors\nRC col vcc 4.7k\nRE emit 0 1k\n* Coupling caps\nC1 in base 10u\nC2 col out 10u\nCE emit 0 100u\nRL out 0 10k\n.tran 10u 5m\n.end",
|
|
"outputs": []
|
|
}
|
|
]
|
|
}
|