Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LseElectricNode curr = source.Plus.DfsInit(plusMark);
- // Interface.Log("+dfs from " + scheme.GetName(curr));
- while (curr) {
- // Interface.Log("+dfs at " + scheme.GetName(curr));
- if (curr == source.Minus) {
- float current = sourceVoltage / baseResistance;
- source.Current = source.Current - current;
- BackTraceCurrent(curr, current);
- goto sourcePassDone;
- }
- LseElectricLink link;
- while (link = curr.DfsNextLink()) {
- // Interface.Log(LStr.Format("+dfs via '$0' to '$1'", scheme.GetName(curr.DfsNext), scheme.GetName(link)));
- if (link.Resistance < LoadResistanceThreshold) {
- curr = curr.DfsPush();
- curr.Mark = plusMark;
- break;
- }
- }
- if (!link) {
- curr = curr.DfsPrevious;
- // Interface.Log("+dfs pop ");
- }
- }
- loads[0, ] = null;
- float totalLoadResistance = 0.0;
- curr = source.Minus.DfsInit(minusMark);
- // Interface.Log("-dfs from " + scheme.GetName(curr));
- while (curr) {
- // Interface.Log("-dfs at " + scheme.GetName(curr));
- LseElectricLink link;
- while (link = curr.DfsNextLink()) {
- if (link.Resistance < LoadResistanceThreshold) {
- // Interface.Log(LStr.Format("-dfs cond '$0' to '$1'", scheme.GetName(curr.DfsNext), scheme.GetName(link)));
- curr = curr.DfsPush();
- curr.Mark = minusMark;
- break;
- }
- if (link.Resistance < ConductiveResistanceThreshold) {
- // Interface.Log(LStr.Format("-dfs load '$0' to '$1'", scheme.GetName(curr.DfsNext), scheme.GetName(link)));
- loads[loads.size()] = link;
- totalLoadResistance = totalLoadResistance + 1.0 / link.Resistance;
- }
- }
- if (!link) {
- curr = curr.DfsPrevious;
- // Interface.Log("-dfs pop ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement