2009/8/9 Alan Grimes <email@example.com>
P Zoltan wrote:
> here is a patch that makes ktechlab to use Eigen for calculations, so
> the internal matrix implementation can be removed.
I think that's where your memory leak is. It tries to cache everything
> Known problems:
> - the caching and changed/unchanged flags probabily don't work as they
and runs out of memory.
Memory leak? I have of that, too?
> - when inserting a reactive element in the circuit, the cpu usage willWhen the circuit is in a steady state, it doesn't make any sense to
> increase to 100% after a time. Probable causes are that eigen uses great
> precision calculation, so the circuit will never enter in steady state.
> Or just some caching problem...
> - test it :D
> - we'll have to define _clearly_ the algorithms and data structures
> used in the cirucit solving process. Currently I don't know how the A, b
> changed flags should work and what is the purpose of CNode and CBranch
> classes, how/when the iterations shoud be done, and so on...
recompute LU. (simply solve LbU = x ) or something like that.
Note: the function call you make "mp_lu->rank() == 0" is equivalent to a
correct version of my "validate()" function. Ie, when rank = 0, the
matrix is singular/invalid/unsolvable. -- IIRC. Since I'm a dunce, I
hacked together the validate() function in an attempt to detect bugs in
the components as early as possible. asking "rank() == 0?" does the same
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?
Could you point me to a class, method and line number for that so that I
> Here is the sketch of the algorithm (should be extended...):
> if a component is added, removed, connected, ... in the circuitdocument:
> split the document in circuits, by connectivity
> create elementset from the circuit
> create the matrix corresponding to the elements
> a step in the simulator:
> if the circuit contains nonlinear elements
> solve the cirucit by iterations
> in each iteration
> call the handler of nonlinear elements
> recreate the LU of the eqation matrix
> update nodes (why?)
can explain it?
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.
> run logic (here -- why?)
-- cuz you could have triggered a state change.
> check for convergence
> solve as a linear system
> run logic
> (where are the components updated?)