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

Method setDetector

SLiCAP/SLiCAPinstruction.py:1246–1291  ·  view source on GitHub ↗

Defines the signal detector :param detector: Name(s) of one or two nodal voltages or of one or two dependent currents. :type detector: list, str detector can defined as: - None: no detector has been defined - str: a single

(self, detector)

Source from the content-addressed store, hash-verified

1244 return
1245
1246 def setDetector(self, detector):
1247 """
1248 Defines the signal detector
1249
1250 :param detector: Name(s) of one or two nodal voltages or of one or two
1251 dependent currents.
1252 :type detector: list, str
1253
1254 detector can defined as:
1255
1256 - None: no detector has been defined
1257 - str: a single detector, name of a nodal voltage or a branch current
1258 - list: with names of either two nodal voltages or two branch currents.
1259
1260 instruction.checkDetector converts the detector definition into a list
1261 with a positive and a negative detector [<detP>, <detN>], where detP
1262 and detN are the names (str) of either two nodal voltages or two branch
1263 currents. One of those can be 'None'.
1264
1265 A list with names of dependent variables that can be used as signal
1266 detector is returned by the method: **instruction.depVars()**.
1267
1268 :Example:
1269
1270 >>> # create an instance if a SLiCAP instruction
1271 >>> my_instr = instruction()
1272 >>> # create my_instr.circuit from the netlist 'myFirstRCnetwork.cir'
1273 >>> my_instr.setCircuit('myFirstRCnetwork.cir')
1274 >>> # Display a list with names of nodal voltages and branch currents
1275 >>> # that can be assigned to the detector.
1276 >>> my_instr.depVars()
1277 ['I_V1', 'V_0', 'V_N001', 'V_out']
1278 >>> # Voltage at node 'out':
1279 >>> my_instr.setDetector('V_out')
1280 >>> # Differential voltage between node 'N001' and 'out':
1281 >>> my_instr.setDetector(['V_N001', 'V_out'])
1282 >>> # Current through `V1':
1283 >>> my_instr.setDetector('I_V1')
1284
1285 :note:
1286
1287 The voltage 'V_0' at the reference node '0' equals zero.
1288 """
1289 self.detector = detector
1290 self.checkDetector()
1291 return
1292
1293 def checkDetector(self):
1294 """

Callers 1

_executeInstructionFunction · 0.80

Calls 1

checkDetectorMethod · 0.95

Tested by

no test coverage detected