Gallery, prompt v1
Triangle-wave carrier for a milk frother
One frozen prompt and every model that has run it, newest first.
The prompt, v1, frozen
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.
Every model, its first three runs.
One square a check, in this order:
- DC supplies only
- 1 kHz
- 2 V peak to peak
- Straight, even ramps
passed, failed, undecided.
| DeepSeek 4.1 Flash |
How it is checked
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.
DC supplies onlymeasuredNo PULSE, SIN or PWL source, and no behavioural source that reads time.
1 kHzmeasuredIt runs, oscillates, and settles within 10% of 1 kHz.
2 V peak to peakmeasuredWithin 10% of 2 V once settled.
Straight, even rampsmeasuredEach ramp fitted to a line with little bend, and rise and fall about equal.
When this saturates: Require a real op-amp model with finite slew and supply rails, so an ideal behavioural comparator is not allowed.
The rules behind all of thisThis task's prompt, checks and any checker, on GitHub

