CLR Simulator

Started June 2025

Description

Whenever I have the requirement to simulate a circuit, I usually turn to Altium. However, I do it so infrequently that it can take half a day just to remember how to set it up. While designing a new energiser I wanted to be able to play with the primary values of the capacitor discharge circuit and make sure that we were not going to exceed the ratings of the main components. I decided to see if I could get AI to code up a simulator for this simple circuit which allowed me to play with the main values and showed the peak current and the expected waveform of the discharge current.

My main reasons for attempting this project:

Method

I produced a very simple specification, less than one page. This included the schematic with a capacitor, switch, inductor and resistor all in series. I then asked ChatGPT (4o) to refine (expand and improve) the specification. It came back with a much more detailed specification, around four pages. It correctly identified the equations to use based on the the damping cases. However, it failed to allow for R or L values of zero. I asked it to do that. Finally I asked it to produce code as HTML, CSS and JS to create the App as a web page.

The code worked well first time; you can test it out yourself below

Ownership

© Paul Thompson

Links