def multiply_diakoptics(sys, num_copies, nodes, resistance, inductance, capacitance, splits=0): gnd = dpsim.dp.Node.GND() sys.multiply(num_copies) counter = 0 tear_components = [] if splits > 0: split_every = int(num_copies + 1) / splits else: split_every = 1 for orig_node in nodes: node_names = [orig_node] node_names += [ orig_node + '_' + str(i) for i in range(2, num_copies + 2) ] node_names.append(orig_node) for i in range(0, num_copies + 1): line = dpsim.dp.ph1.PiLine('line' + str(counter)) line.R_series = resistance line.L_series = inductance line.C_parallel = capacitance line.connect( [sys.nodes[node_names[i]], sys.nodes[node_names[i + 1]]]) if i % split_every == 0: tear_components.append(line) else: sys.add_component(line) counter += 1 return tear_components
def multiply_coupled(sys, num_copies, nodes, resistance, inductance, capacitance): gnd = dpsim.dp.Node.GND() sys.multiply(num_copies) counter = 0 for orig_node in nodes: node_names = [orig_node] node_names += [ orig_node + '_' + str(i) for i in range(2, num_copies + 2) ] node_names.append(orig_node) for i in range(0, num_copies + 1): # TODO lumped resistance? rl_node = dpsim.dp.Node('N_add_' + str(counter)) res = dpsim.dp.ph1.Resistor('R_' + str(counter)) res.R = resistance ind = dpsim.dp.ph1.Inductor('L_' + str(counter)) ind.L = inductance cap1 = dpsim.dp.ph1.Capacitor('C1_' + str(counter)) cap1.C = capacitance / 2 cap2 = dpsim.dp.ph1.Capacitor('C2_' + str(counter)) cap2.C = capacitance / 2 sys.add_node(rl_node) res.connect([sys.nodes[node_names[i]], rl_node]) ind.connect([rl_node, sys.nodes[node_names[i + 1]]]) cap1.connect([sys.nodes[node_names[i]], gnd]) cap2.connect([sys.nodes[node_names[i + 1]], gnd]) counter += 1 sys.add_component(res) sys.add_component(ind) sys.add_component(cap1) sys.add_component(cap2)
def multiply_decoupled(sys, num_copies, nodes, resistance, inductance, capacitance): sys.multiply(num_copies) counter = 0 for orig_node in nodes: node_names = [orig_node] node_names += [ orig_node + '_' + str(i) for i in range(2, num_copies + 2) ] node_names.append(orig_node) for i in range(0, num_copies + 1): sys.add_decoupling_line('dline' + str(counter), sys.nodes[node_names[i]], sys.nodes[node_names[i + 1]], resistance, inductance, capacitance) counter += 1