Finds the DC solution of the network using the .dc attribute of independent sources as inputs. The DC solution will be stored in the .dcSolve attribute of the instr object. :param instr: SLiCAP instruction object that holds instruction data. :type instr: SLiCAPinstruction.
(instr)
| 994 | return instr |
| 995 | |
| 996 | def _doDCsolve(instr): |
| 997 | """ |
| 998 | Finds the DC solution of the network using the .dc attribute of independent |
| 999 | sources as inputs. |
| 1000 | |
| 1001 | The DC solution will be stored in the .dcSolve attribute of the instr |
| 1002 | object. |
| 1003 | |
| 1004 | :param instr: SLiCAP instruction object that holds instruction data. |
| 1005 | :type instr: SLiCAPinstruction.instruction |
| 1006 | |
| 1007 | :return: instr of the execution of the instruction. |
| 1008 | :rtype: SLiCAPinstruction.instruction |
| 1009 | """ |
| 1010 | if instr.step: |
| 1011 | if ini.step_function: |
| 1012 | instr = _makeAllMatrices(instr, reduce=False) |
| 1013 | instr.M = instr.M.xreplace({ini.laplace: 0}) |
| 1014 | instr.Iv = instr.Iv.xreplace({ini.laplace: 0}) |
| 1015 | instr = _doPySolve(instr) |
| 1016 | sol = sp.simplify(instr.solve[-1]) |
| 1017 | instr.dcSolve = _stepFunctions(instr.stepDict, sol) |
| 1018 | else: |
| 1019 | stepVars = list(instr.stepDict.keys()) |
| 1020 | numSteps = len(instr.stepDict[stepVars[0]]) |
| 1021 | for i in range(numSteps): |
| 1022 | for j in range(len(stepVars)): |
| 1023 | instr.parDefs[stepVars[j]]=instr.stepDict[stepVars[j]][i] |
| 1024 | instr = _makeAllMatrices(instr, reduce=False) |
| 1025 | instr.M = instr.M.xreplace({ini.laplace: 0}) |
| 1026 | instr.Iv = instr.Iv.xreplace({ini.laplace: 0}) |
| 1027 | instr = _doPySolve(instr) |
| 1028 | instr.dcSolve.append(sp.simplify(instr.solve[-1])) |
| 1029 | else: |
| 1030 | instr = _makeAllMatrices(instr, reduce=False) |
| 1031 | instr.M = instr.M.xreplace({ini.laplace: 0}) |
| 1032 | instr.Iv = instr.Iv.xreplace({ini.laplace: 0}) |
| 1033 | instr = _doPySolve(instr) |
| 1034 | instr.dcSolve = sp.simplify(instr.solve[0]) |
| 1035 | return instr |
| 1036 | |
| 1037 | def _doTimeSolve(instr): |
| 1038 | """ |
no test coverage detected