ngspice: triangle-wave carrier for a milk frother, by gpt-6.1-sol
gpt-6.1-sol · round 1 · seed 2$0.03SVGcarrier.cir
carrier.cir · 33 lines
1 kHz, 2 Vpp triangle carrier - autonomous relaxation oscillator
* Only independent sources are DC supply rails; no PULSE, PWL or SIN.
* Behavioral devices model a fast Schmitt comparator and a bidirectional
* voltage-controlled current source. Capacitors provide the dynamic state.
VCC vcc 0 DC 5
VEE vee 0 DC -5

* Schmitt comparator: positive feedback sets thresholds at +/-1 V
* (0.2 times the +/-5 V output). A finite 10 ns response avoids an
* instantaneous algebraic feedback loop and represents comparator delay.
Bcmp drive 0 V=(V(vcc)+V(vee))/2+(V(vcc)-V(vee))/2*tanh(1e4*(V(carrier)+0.2*V(square)))
Rdriver drive square 100
Cdelay square 0 100p IC=0

* Integrator: positive square output discharges the timing capacitor;
* negative output charges it. |I| = 5/125k = 40 uA.
* Slope = I/C = 4000 V/s. Each 2 V ramp takes 0.5 ms:
* T = 4*(1 V)*(125 kohm)*(10 nF)/(5 V) = 1 ms.
* The small initial capacitor voltage breaks the perfectly symmetric
* zero-state equilibrium; it is not a periodic excitation.
Bcurrent carrier 0 I=V(square)/125k
Ctiming carrier 0 10n IC=0.05

.control
set wr_singlescale
set wr_vecnames
* Use initial capacitor voltages and resolve each ramp with <=0.5 us steps.
tran 0.5u 20m 0 0.5u uic
* Two columns: time (s), carrier voltage (V); includes the entire 20 ms.
wrdata carrier.txt v(carrier)
.endc
.end

Triangle-wave carrier for a milk frother: GPT-6.1 Sol

modelopenai/gpt-6.1-soltaskspice-frother-triangle@v1, checks c1, harness h1date2026-10-02rounds1 of 8 allowed, 12 minutes on the clockcost$0.0306thinkingmediumtokens30,135 in, 1,703 out, of which 582 reasoningtime1 min 7 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.