def run_test_circuit_6(name): I1 = CurrentSource('I1', [0, 1], 2, (2, 0.002)) # 2 Ampere R2 = Resistor('R2', [1, 0], 3) # 1 Ohm L3 = Inductor('L3', [1, 0], 0.001, 0) # 0.01 H # I_start = 0.1 test_circuit = Circuit(gpu=True) test_circuit.add_components([I1, R2, L3]) res = test_circuit.solve_AC(0, 0.1, 0.001) # test_circuit.print_results() test_circuit.draw_plot(name, I1, res, 'I') test_circuit.draw_plot(name, R2, res, 'V') test_circuit.draw_plot(name, L3, res, 'V')
def run_test_circuit_7(name): I1 = CurrentSource('I1', [2, 0], 2, (2, 0.2, 0.1)) # 2 Ampere R2 = Resistor('R2', [1, 0], 1) # 1 Ohm L3 = Inductor('L3', [2, 0], 0.01, ) # 0.01 H # I_start = 0. C4 = Capacitor('C4', [1, 2], 0.00001) # 0.00001 F #U_start = 0. test_circuit = Circuit() test_circuit.add_components([I1, R2, L3, C4]) res = test_circuit.solve_AC(0, 0.001, 0.000002) test_circuit.print_results() test_circuit.draw_plot(name, I1, res, 'I') test_circuit.draw_plot(name, R2, res, 'V') test_circuit.draw_plot(name, L3, res, 'V') test_circuit.draw_plot(name, C4, res, 'I')
def run_test_circuit_5(name): I2 = CurrentSource('I1', [0, 1], 2, (2, 0.23, 0.1)) # 2 Ampere R1 = Resistor('R2', [1, 0], 10) # 1 Ohm C3 = Capacitor('C3', [1, 0], 1e-6, 0) # 1e-6 F # U_start = 0 argument test_circuit = Circuit() test_circuit.add_components([R1, I2, C3]) # test_circuit.solve_DC() # DC res = test_circuit.solve_AC(0, 1e-4, 0.5e-7) # AC # print(res['result']) test_circuit.print_results() test_circuit.print_matrix() test_circuit.draw_plot(name, I2, res, 'I') test_circuit.draw_plot(name, R1, res, 'V') test_circuit.draw_plot(name, C3, res, 'I')