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)
43 lines
1.8 KiB
Plaintext
43 lines
1.8 KiB
Plaintext
{
|
|
"spicebook_version": "2026-02-13",
|
|
"metadata": {
|
|
"title": "RC Lowpass Filter Analysis",
|
|
"engine": "ngspice",
|
|
"tags": ["filter", "passive", "beginner"],
|
|
"created": "2026-02-13T00:00:00Z",
|
|
"modified": "2026-02-13T00:00:00Z"
|
|
},
|
|
"cells": [
|
|
{
|
|
"id": "cell-intro",
|
|
"type": "markdown",
|
|
"source": "# RC Lowpass Filter\n\nA first-order passive RC lowpass filter with a cutoff frequency of approximately **1.59 kHz**.\n\nThe -3dB frequency is: f_c = 1 / (2 * pi * R * C)\n\nWith R = 1k and C = 100nF: f_c = 1 / (2 * pi * 1000 * 100e-9) = 1591 Hz",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-ac",
|
|
"type": "spice",
|
|
"source": "RC Lowpass Filter - AC Analysis\nV1 in 0 AC 1\nR1 in out 1k\nC1 out 0 100n\n.ac dec 100 1 10meg\n.end",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-explain-ac",
|
|
"type": "markdown",
|
|
"source": "## Interpreting the Bode Plot\n\nThe magnitude plot should show:\n- **Flat response** (0 dB) below the cutoff frequency\n- **-3 dB point** at approximately 1.59 kHz\n- **-20 dB/decade rolloff** above the cutoff\n\nThe phase should transition from 0 degrees to -90 degrees, passing through -45 degrees at the cutoff frequency.",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-transient",
|
|
"type": "spice",
|
|
"source": "RC Lowpass Filter - Step Response\nV1 in 0 PULSE(0 1 0 1n 1n 0.5m 1m)\nR1 in out 1k\nC1 out 0 100n\n.tran 10u 3m\n.end",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-explain-transient",
|
|
"type": "markdown",
|
|
"source": "## Step Response\n\nThe transient simulation shows the capacitor charging and discharging through the resistor.\n\nThe time constant is: tau = R * C = 1000 * 100e-9 = 100 us\n\nThe output reaches ~63% of the input voltage after one time constant, and ~95% after three time constants (300 us).",
|
|
"outputs": []
|
|
}
|
|
]
|
|
}
|