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
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
{
|
|
"spicebook_version": "2026-02-13",
|
|
"metadata": {
|
|
"title": "Voltage Divider",
|
|
"engine": "ngspice",
|
|
"tags": ["passive", "beginner", "dc"],
|
|
"created": "2026-02-13T00:00:00Z",
|
|
"modified": "2026-02-13T00:00:00Z"
|
|
},
|
|
"cells": [
|
|
{
|
|
"id": "cell-intro",
|
|
"type": "markdown",
|
|
"source": "# Voltage Divider\n\nThe simplest and most fundamental circuit: two resistors dividing an input voltage.\n\nV_out = V_in * R2 / (R1 + R2)\n\nWith R1 = 10k and R2 = 10k: V_out = 5V * 10k / (10k + 10k) = 2.5V",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-op",
|
|
"type": "spice",
|
|
"source": "Voltage Divider - DC Operating Point\nV1 in 0 DC 5\nR1 in out 10k\nR2 out 0 10k\n.op\n.end",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-sweep",
|
|
"type": "spice",
|
|
"source": "Voltage Divider - DC Sweep\nV1 in 0 DC 5\nR1 in out 10k\nR2 out 0 10k\n.dc V1 0 10 0.1\n.end",
|
|
"outputs": []
|
|
},
|
|
{
|
|
"id": "cell-explain",
|
|
"type": "markdown",
|
|
"source": "## DC Sweep\n\nThe DC sweep shows how V(out) varies linearly with V(in). Since R1 = R2, the output is always exactly half of the input. The slope of the line is the voltage division ratio: 0.5.",
|
|
"outputs": []
|
|
}
|
|
]
|
|
}
|