ngspice: triangle-wave carrier for a milk frother, by deepseek-v4.1-flash
deepseek-v4.1-flash · round 1 · seed 2$0.04carrier.cir
carrier.cir · 36 lines
* 1 kHz triangle-wave carrier, 2 V peak-to-peak, self-oscillating
* Only DC supplies are used; the oscillation comes from the circuit itself.
*
* Topology: an inverting integrator (E_int + R_int + C_int) is driven by a
* Schmitt-trigger comparator (B_cmp with positive feedback Ra/Rb).
* The comparator output swings between the DC rails (+/-12 V), and the
* feedback network sets the hysteresis thresholds to +/-1 V, so the
* integrator output (the carrier) is a 2 Vpp triangle.
*
* f = (Vsat) / (4 * Vth * R_int * C_int) = 12 / (4*1*30k*100n) = 1 kHz

* --- DC supplies ---
Vcc  vcc 0 DC  12
Vee  vee 0 DC -12

* --- Integrator (op-amp 1) ---
* ideal op-amp: V(tri) = -A*V(inv1)
E_int tri 0 0 inv1 100000
R_int comp inv1 30k
C_int tri inv1 100n ic=0.1
R_dc  tri inv1 1Meg          $ DC feedback path so the bias point exists

* --- Schmitt-trigger comparator (op-amp 2) ---
* saturating comparator: output is the +/-12 V rail span, soft-clipped
B_cmp comp 0 V = 0.5*(V(vcc)-V(vee))*tanh(1000*(V(p2)-V(n2)))
Rn2  n2  0  1
* positive feedback network: V+ = (12*V(tri) + V(comp))/13
Ra   tri p2 1k
Rb   comp p2 12k
Cp2  p2  0  1n

.control
tran 1u 20m uic
wrdata carrier.txt v(tri)
.endc
.end

1000.0 Hz and 1.99 V on the first render.

modeldeepseek/deepseek-v4.1-flashtaskspice-frother-triangle@v1date2026-09-22rounds1 of 8 allowedcost$0.0357thinkingmediumtokens217,344 in, 18,853 out, of which 12,658 reasoningtime6 min 15 s
DC supplies onlydecided by a number, from the filepass
1 kHzdecided by a number, from the filepass
2 V peak to peakdecided by a number, from the filepass
Straight, even rampsdecided by a number, from the filepass

There is no post about this one, since only some results need one, so the picture, the source and the scoring are here instead.

its other runs
the prompt it was given
A milk frother's heater is driven by PWM, and the PWM needs a 1 kHz triangle-wave carrier of 2 V peak to peak. Build that oscillator in ngspice using only DC supplies, so the oscillation comes from the circuit itself, and simulate 20 ms. In a .control block, save the carrier voltage with wrdata to a .txt file so it can be plotted.
Frozen at v1. This model got this and nothing else.
ground truth

The netlist, re-run in ngspice offline and the written carrier read back. A triangle comes from integrating a square wave, so a PULSE into an RC, whose ramps curve, fails, and so does any source that is told the time. How it is scored, and this run's files on GitHub.