1. An inductor (for now, but in general an energy storage element) contains non-negligible current because a negligible current could simply mean it is in a loop that is stiff but finds itself only in stiff loops.
2. For this current to break would be either bad design which means undue voltage stress on devices as stored energy has nowhere to go or the current freewheels through a diode (or any other device such as an IGBT with an anti-parallel diode).
And this is essentially how the algorithm develops:
1. After one iteration is over, suppose the ideal switch in the buck converter turns off.
2. The next iteration will throw up an event. So new loop manipulations will be done, an effort will be made to remove stiffness, and this effort will fail because there are two parallel stiff branches.
3. The check to be done - is there any inductor in all the loops which has a non-negligible current but now finds itself only in stiff loops? Right now I will restrict the search to inductors but I will expand the criteria later if needed.
4. If so, check if it can freewheel through a device capable of freewheeling. Now this is the tough part.
5. Start with the loop that contains the inductor but has a non-negligible current. This is because the inductor could have been in multiple loops to begin with and some of them may have been stiff in the first place.
6. Check if any of the devices in the loop are capable of freewheeling. This will be done by running a function within all devices but will be empty for all devices that can't freewheel and will contain code for those than can freewheel. The function will check if the loop current and direction are such that the device will start conducting if the current were to flow through it. If so, the device state changes.
7. Now check again if loop containing the inductor is stiff. Why? Because there may be two diodes connected in series. So repeat the above procedure.
8. There could be another possibility. Suppose there are two diodes connected in series in the buck converter and they have high resistance snubbers connected in parallel with them. So now we won't know how the loops are formed. It could be that the inductor appears in a loop with the snubbers and not the diodes. The diodes appear in a loop with the snubbers. So the above algorithm will give up because the inductor loop never encounters a diode.
9. So if upon encountering a stiff branch, it so turns out that the stiff branch does not contain an element that can freewheel, check if that branch exists in other loops. If so, perform a loop manipulation and bring those other loops into the inductor loop. Now repeat the above process.
10. When will the algorithm give up? Not sure how this will work. I will have to run different cases and check. There may be times when it goes into an infinite loop.
Now I will code this. Not sure if I can finish it tonight. Probably will post again tomorrow.