Why initial conditions don't work?

As I told few days ago I installed V8 to do some Spice.
I need to be able to set initial voltages. In PSpice to set net initial voltage I was connecting to net something like KiCad PWR_FLAG but with voltage inside and done. Unfortunately PSpice I have (version from 90s) doesn’t work at Win10.
Looking through KiCad Spice library I didn’t found anything to set initial net voltage. So I looked through long list of examples:

I noticed that something have to be done by adding text to file. In MAX9000 example I found .ic commad. I understood “ic” as setting initial conditions.
But it doesn’t work:

It would be easier to say what I have not done to find how to make it working. When you do something for the first time you are sure of nothing what you are doing. You are even not sure if the way you add text to schematic may be is not the right one.
At the beginning I used global label (like at my screen shot) and tried to use it in .ic with ‘/’ and without ‘/’. Nothing.
So as in MAX9000 example there are labels and not global labels I have tried also with them using in .ic v(/V1)=0.5. Not working. So may be .ic v(V1)=0.5. Also nothing. There were comments in that example so I have also made my text being 2 lines, with comment line before .ic line. - nothing. During that I noticed that my texts are by default centered (until I had only one line I didn’t noticed it). So may be it have to be left justified as may be .ic have to be understood as starting from first text column - didn’t helped.
I found some other example with changing the capacitor value to “10p ic=0.5”. Nothing.
New idea. May be Spice in KiCad uses local setting and I should use ‘,’ and not ‘.’ in my value. I have checked it and to be sure also with using simple 1 instead of 0.5. Nothing could made these initial condition to work.

Here is the V8 project:
Ic_Init_Tst.zip (5.6 KB)

Here is my version info:

Application: KiCad x64 on x64

Version: 8.0.2-153-g3e5ceaa319, release build

wxWidgets 3.2.4
FreeType 2.12.1
HarfBuzz 8.3.0
FontConfig 2.14.2
libcurl/8.5.0-DEV Schannel zlib/1.3

Platform: Windows 10 (build 19044), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: May 22 2024 05:22:34
wxWidgets: 3.2.4 (wchar_t,wx containers)
Boost: 1.83.0
OCC: 7.8.1
Curl: 8.5.0-DEV
ngspice: 42
Compiler: Visual C++ 1939 without C++ ABI

Build settings:

It took me 2 hours to find how to make Spice to use initial conditions in transient simulation.
Am I so stupid?
I believe you will find it much faster than me.

Indeed the description along the check box “Use initial conditions” is misleading, as initial condition (given by a .ic command) should be recognized always, check or unchecked.

I will suggest a bug fix to change the text to “Skip determining the operating point”. Standard setting is to not check this box. Skipping the operating point calculation should be tried only when there are convergence problems while trying to get it.

But even then, when checked, there is a bug in ngspice that leads to not recognizing the initial conditions. This has to do with another check box selected: “Save all currents” or “Save all power dissipations”. Measuring the current prevents setting the initial condition. This has to be fixed in ngspice.

That’s not correct. There is something happening in your example circuit, but somehow surprising: VOUT starts at -0.5V. This is a user issue: If you show the pin numbering of the capacitor, it is 2 at the top, 1 at its bottom, so to speak “upside down”. This does not matter for the circuit, as a capacitor is symmetric, but for a voltage applied upon the capacitor, one has to decide. ngspice selects to apply the voltage from node 1 to node 2.

After I found it I supposed that its logic is simply reversed, or text should be “Ignore initial conditions.”
Do we really have here two different things both with the same name?

When setting transient analysis, knowing that what I am trying to do is to use initial conditions it was obvious to me that I have to check this checkbox to make KiCad to not ignore initial conditions I will set. It was so obvious that during 2h I didn’t thought about changing it. As part of catching a drowning man by the straw, I had an idea that maybe someone had reversed the logic of this flag but even then didn’t supposed that it is about something different.

Help me understand one more thing.
If in my example I delete .ic and set in VPULSE y1=-1 then:

  • with ‘Use initial…’ checked it starts from 0,
  • with ‘Use initial…’ unchecked it starts from -1.

Where from is this 0?
Do I have a way to set for V1 a DC voltage as well as AC voltage and phase. I think I should search it in Spice documentation but may be this way I will get it faster.
When I add at V1 string end the text: ‘dc=2’ and try to run simulation I get an error saying that in v1 there is unknown parameter (y1) not matter if ‘Use initial…’ is checked or not.
At first I supposed that may be if it uses other initial conditions it wants to tell me that y1 value is ignored (using by mistake word ‘unknown’) but not.
So how having y1=-1 and y2=1 I can set V1 value used in OP calculation to say 2V. Can I do it by some settings in V1 or have I to add label to that net and use .ic. Didn’t checked adding a label to this net but not sure if it will work if it will be contradictory to what from V1 is assumed.

You are right.
For real when I was testing ic in capacitor (it was after first fails with .ic so long before finishing my efforts) I had the following circuit:

Transil (model obtained from ‘Diodes’) was what I wanted intentionally. To try to use ic in capacitor (instead of .ic) I added 1pF (to set initial condition not changing circuit behavior). I hoped that that way I am setting the initial voltage for that node but then I sow only -5mV so assumed whatever was done it was not what I want. Two hours later writing the post I only remembered that with ic I also failed so written what written.
Now I suppose I understand that ic sets only that capacitor initial voltage even the second one (may be internal to transil) connected with it in paralel has different voltage. Yesterday I supposed it is not possible and that this 1pF voltage determines everything in paralel with it. It looks that during time=0 this capacitor is connected with transil internal capacitor having 0V and at once drops to 5mV.

I probably checked it in both orders and may be because of this it left being reversed in final circuit.

What I want to do is to simulate bursts.
Bursts are defined as something like VEXP but repeated with specified frequency.
I think I will use VPULSE instead.

Is there a simple way to make VEXP being repeatable?

VEXP: probably no.

But what about a pwl, using a repeated ramp with slow rising, fast falling, and feeding this resulting node into a B source with some exponential function?

I don’t need the interrupted series of pulses. I can use continuous pulses so VPULSE is OK. I want to check how much burst demodulation take place at input transil depending on input circuit construction. I need .ic to not have to simulate too many pulses.

Each of ESD. Burst and Surge have faster rising than falling.

I use Spice very rarely. PSpice last time may be 10 years ago, and KiCad just few days at the 2023 end I spend mainly on editing symbols (as I prefer them) and learning how to assign models.
I have never been proficient in Spice and I am not familiar with possibilities KiCad-Spice duet gives.
Instead of using V sources and some functions you can probably use switch + LRC to get expected shape. But I don’t have a need to be it exactly as they are defined. I want only to compare different input solutions.

Please see Exponential pulses.