jaijeet / MAPP

The Berkeley Model and Algorithm Prototyping Platform
https://github.com/jaijeet/MAPP/wiki
Other
14 stars 13 forks source link

Issur report for Initial Guess of Newton-Raphson(DC analysis) #14

Open Pklijiahua opened 6 years ago

Pklijiahua commented 6 years ago

%% I was trying to learn how's the accuracy of initial guess could affect the iteration time, so at the first %% time I put a +/-n% variation of final result of DC value as initial guess but it does not show much %% progress, then I directly put final result of DC value to the initial guess of the same circuit at next %% run. %% It should converge immediately, but it does not and start oscillate then settle down, the total %% iteration number is still 10. we suspect it is because the limiting function and try to debug it, perhaps %% any helps could be expected from your side? (The MATLAB code below is for copy and run)

%% It is a example code from A1oDAEAPI-MATLAB_'op.m' %% DAE = MNA_EqnEngine(current_mirror_ckt()); DC = op(DAE, 'dbglvl', 2); feval(DC.print, DC); % the code above is the DC analysis(Newton-Raphson method) with all zeros as initial guess

init = DC.solution; % get the final DC value after 10 iterations clear DAE; clear DC; % clear all workspace except for 'init' which would be used for later initial guess

DAE = MNA_EqnEngine(current_mirror_ckt()); DC = op(DAE,init, 'dbglvl', 2);% the initial guess of DC value there should be the same as final answer

TianshiWang commented 6 years ago

Please try:

DC = op(DAE, init, 'init', 0);

to turn the SPICE-compatible initialization off. It should print .* or report "NR succeeded in 2 iterations". That means, after the function is evaluated at the initial guess in the first iteration, NR reports convergence in the second iteration.

SPICE-compatible initialization will ignore some initial guesses and reset junction voltages to certain initial values specified by the devices.