How to simulate constant current - constant voltage source in LTspice
It looks like you want some behavioural modeling, not a real-life scenario, so here's an attempt, if I understood what you meant:



The NAND gate starts high if output is low (which is assumes it is). The diode is the ideal one which uses its builtin current limiter ilimit to limit the current. You may want to add epsilon=&lt;...&gt; and revepsilon=&lt;...&gt; to its .model card, if convergence issues arise. The NAND has a delay of 30s and a reference of 3.6V, which is the difference between its logic high and the diode forward drop, 0.4V. Be careful, the same delay applies when re-starting. You can complicate a bit with .machine script, or more A-devices, for better control, but that's up to you.