MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / setSource

Method setSource

SLiCAP/SLiCAPinstruction.py:1159–1202  ·  view source on GitHub ↗

Defines the signal source. :param source: Name of an independent voltage or current source that exists in the circuit. :type source: str :Example: >>> # Create an instance of the instruction object >>> my_instr = instruction(

(self, source)

Source from the content-addressed store, hash-verified

1157
1158
1159 def setSource(self, source):
1160 """
1161 Defines the signal source.
1162
1163 :param source: Name of an independent voltage or current source that
1164 exists in the circuit.
1165 :type source: str
1166
1167 :Example:
1168
1169 >>> # Create an instance of the instruction object
1170 >>> my_instr = instruction()
1171 >>> # check a netlist file and use the circuit from this file for this
1172 >>> # instruction:
1173 >>> my_instr.setCircuit('my_circuit.cir')
1174 >>> # Define the voltage source 'V1' as signal source:
1175 >>> my_instr.setSource('V1')
1176
1177 :note:
1178
1179 A list with names of independent voltage and current sources that can be
1180 assigned as signal source can be obtained from the method:
1181 **instruction.indepVars()**:
1182
1183 :Example:
1184
1185 >>> # Create an instance of the instruction object
1186 >>> my_instr = instruction()
1187 >>> # check a netlist file and use the circuit from this file for this
1188 >>> # instruction:
1189 >>> my_instr.setCircuit('my_circuit.cir')
1190 >>> # Obtaine a list with names of independent sources:
1191 >>> my_instr.circuit.indepVars()
1192 """
1193 if type(source) == str:
1194 self.source = [source, None]
1195 self.checkSource()
1196 elif type(source) == list and len(source) == 2:
1197 self.source = source
1198 self.checkSource()
1199 else:
1200 print("Error in loop gain reference specification.")
1201 self.checkSource(need = False)
1202 return
1203
1204 def checkSource(self, need = True):
1205 """

Callers 1

_executeInstructionFunction · 0.80

Calls 1

checkSourceMethod · 0.95

Tested by

no test coverage detected