From: Alan G. <ag...@sp...> - 2010-10-03 21:47:19
|
chrome://messenger/locale/messengercompose/composeMsgs.properties: > - call a calculateCurrents() method on all the elements. This way the > currents flowing from the elements into the CNodes are calculated, but > they are stored in the elements. The CNodes are not a good storage for the > currents, because one CNode is associated with more elements. The element doesn't really care unless it needs the information for the next simulation step. In general, I have been working to minimize the amount of state in each element. > See the original method, for a resistance, here, at the end of the file: > http://ktechlab.svn.sourceforge.net/viewvc/ktechlab/branches/ktechlab-0.3.7/src/electronics/simulation/resistance.cpp?revision=172&view=markup hmm. I don't remember the rationale behind that design. > - add a method to Element: > double nodeCurrent(int nodeNumber) const ; > and implement it, by using a doube m_nodeCurrent[4]; protected member. Okay, might be a good test. > - in all the lements, updaete the m_nodeCurrent member, in the > updateCurrents() method, instead of updating the node currents. As > explained earlier, the node currents will get updated by many elements, so > setting the current there is meaningless. > - add a double sourceCurrent() const; method to the Pin class, and a > setter method for it. The returned value should be interpreted as the > current flowing from the element into the pin. If the pin has no attached > element, then this value must be 0. A currentIsKnown() method already > exists, so that can be also reused. All pins have 0 current. I used the pin class only to help pipe information about currents between elements and wires. (and there may be more than one of each.) Because the pointer-tool needs a current to read, I simply sum the currents in the wires to obtain the current at a pin, it sometimes works... > - i don't really understand why is the ElementMap a separate class. Maybe > someone can explain it. That class is a helper for Element, that connects > the Element to Pins. Wouldn't it be more simple to make the element aware > of pins? I won't research that, but a wrapper class is needed that sets up > an element and tranfers the value of currents into the pins. Yeah, there are a number of sub-optimal things going on there. In the svn version, you can set "show current animation" to true to see what the UI thinks the flow of currents are. -- DO NOT USE OBAMACARE. DO NOT BUY OBAMACARE. Powers are not rights. |