<br><br><div class="gmail_quote">2009/8/9 Alan Grimes <span dir="ltr"><<a href="mailto:agrimes@speakeasy.net">agrimes@speakeasy.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
P Zoltan wrote:<br>
>  here is a patch that makes ktechlab to use Eigen for calculations, so<br>
> the internal matrix implementation can be removed.<br>
<br>
</div>=)<br>
<div class="im"><br>
>  Known problems:<br>
>  - the caching and changed/unchanged flags probabily don't work as they<br>
> should<br>
<br>
</div>I think that's where your memory leak is. It tries to cache everything<br>
and runs out of memory.<br>
<div class="im"></div></blockquote><div></div><div>Memory leak? I have of that, too?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">

>  - when inserting a reactive element in the circuit, the cpu usage will<br>
> increase to 100% after a time. Probable causes are that eigen uses great<br>
> precision calculation, so the circuit will never enter in steady state.<br>
> Or just some caching problem...<br>
<br>
>  Todos:<br>
>  - test it :D<br>
>  - we'll have to define _clearly_ the algorithms and data structures<br>
> used in the cirucit solving process. Currently I don't know how the A, b<br>
> changed flags should work and what is the purpose of CNode and CBranch<br>
> classes, how/when the iterations shoud be done, and so on...<br>
<br>
</div>When the circuit is in a steady state, it doesn't make any sense to<br>
recompute LU. (simply solve LbU = x ) or something like that.<br>
<br>
Note: the function call you make "mp_lu->rank() == 0" is equivalent to a<br>
correct version of my "validate()" function. Ie, when rank = 0, the<br>
matrix is singular/invalid/unsolvable. -- IIRC. Since I'm a dunce, I<br>
hacked together the validate() function in an attempt to detect bugs in<br>
the components as early as possible. asking "rank() == 0?" does the same<br>
thing.</blockquote><div></div><div>Yes, I know. Still, that rank() call should be removed, as LU::solve() method returns false if it can't solve the equation system. That case is not addressed -- the question is what to do in that case: write a "?" for voltage level, or use the last valid state for the circuit?</div>
<div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<div class="im"><br>
>  Here is the sketch of the algorithm (should be extended...):<br>
<br>
> if a component is added, removed, connected, ... in the circuitdocument:<br>
>  split the document in circuits, by connectivity<br>
>  create elementset from the circuit<br>
>     create the matrix corresponding to the elements<br>
<br>
> a step in the simulator:<br>
>   if the circuit contains nonlinear elements<br>
>     solve the cirucit by iterations<br>
>      in each iteration<br>
>        call the handler of nonlinear elements<br>
>        recreate the LU of the eqation matrix<br>
>        update nodes (why?)<br>
<br>
</div>Could you point me to a class, method and line number for that so that I<br>
can explain it?</blockquote><div></div><div>In not that interested in a particuar class, but in the interaction of all the  classes; or just the algorithm, without any particular class/method. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
>        run logic (here -- why?)<br>
-- cuz you could have triggered a state change.<br>
<div class="im"><br>
>        check for convergence<br>
>   else<br>
>     solve as a linear system<br>
>   run logic<br>
<br>
>  (where are the components updated?)<br>
<br>
</div></blockquote></div>