Exemple #1
0
def main(fileName):
    start = time.clock()
    var = Var()
    var.openFile(fileName)

    var.output_something()
    var.analysis_text()
    # for Martix and dict
    var.initMartix()

    var.makeDict()

    var.initStamp()  # stamp for the element like R
    # var.printMartix()
    # var.printGBCDUI()
    var.backMartix()

    if var.ToSolveDC:
        var.solveDC(plotFlag=1)
    if var.ToSolveTran:
        var.solveTran()

    if var.ToSolveAC:
        var.solveAC()

    # var.printMartix()
    # var.printGBCDUI()
    # var.printX()
    var.closeFile()
    end = time.clock()
    print end - start
Exemple #2
0
def parse(netlist):
    var = Var()

    var.string2file(netlist)
    var.analysis_text()
    # for Martix and dict
    var.initMartix()

    var.makeDict()

    var.initStamp()  # stamp for the element like R
    # var.printMartix()
    # var.printGBCDUI()
    var.backMartix()

    if var.ToSolveDC:
        var.solveDC(plotFlag=1)
    if var.ToSolveTran:
        var.solveTran()

    if var.ToSolveAC:
        var.solveAC()

    # var.printMartix()
    # var.printGBCDUI()
    # var.printX()
    var.closeFile()
    result = {}
    if hasattr(var, 'voltage_tag'):
        result['voltage'] = var.voltage_tag
    if hasattr(var, 'current_tag'):
        result['current'] = var.current_tag
    if hasattr(var, 'phase_tag'):
        result['phase'] = var.phase_tag
    return result