Returns the value or expression of one or more circuit elements. If instruction.numeric == True it will perform a full recursive substitution of all circuit parameter definitions. This method is called by instruction.circuit.getElementValue() with keyword a
(self, elementID, param='value', substitute=True, numeric=False)
| 386 | return |
| 387 | |
| 388 | def getElementValue(self, elementID, param='value', substitute=True, numeric=False): |
| 389 | """ |
| 390 | Returns the value or expression of one or more circuit elements. |
| 391 | |
| 392 | If instruction.numeric == True it will perform a full recursive |
| 393 | substitution of all circuit parameter definitions. |
| 394 | |
| 395 | This method is called by instruction.circuit.getElementValue() with |
| 396 | keyword arg numeric = True if instruction.simType is set to 'numeric'. |
| 397 | |
| 398 | :param elementID: name(s) of the element(s) |
| 399 | :type elementID: str, list |
| 400 | |
| 401 | :param param: name of the parameter (equal for all elements): |
| 402 | |
| 403 | - 'value': Laplace value |
| 404 | - 'dc': DC value (independent sources only) |
| 405 | - 'noise': Noise spectral density (independent sources only) |
| 406 | - 'dcvar': DC variance (independent sources only) |
| 407 | |
| 408 | Defaults to 'value' |
| 409 | |
| 410 | :type param: str |
| 411 | |
| 412 | :param substitute: - True: circuit parameters will be recursively |
| 413 | substituted |
| 414 | - False: Element values or expressions will be |
| 415 | returned as defined |
| 416 | |
| 417 | Defaults to True |
| 418 | |
| 419 | :type substitute: Bool |
| 420 | |
| 421 | :param numeric: - True: Numeric values of functions and constants will |
| 422 | be evaluated and rational numbers will be converted |
| 423 | to sympy.Float. |
| 424 | - False: No numeric evaluation of functions and |
| 425 | constants |
| 426 | |
| 427 | Defaults to False |
| 428 | |
| 429 | :type numeric: Bool |
| 430 | |
| 431 | :return: if type(parNames) == list: |
| 432 | |
| 433 | return value = dict with key-value pairs: key (*sympy.core.symbol.Symbol*): |
| 434 | name of the parameter, value (*int, float, sympy expression*): |
| 435 | value of the parameter |
| 436 | |
| 437 | else: |
| 438 | value or expression |
| 439 | |
| 440 | :rtype: dict, sympy.Float, sympy.Expr |
| 441 | |
| 442 | """ |
| 443 | if type(elementID) == list: |
| 444 | elementValues = {} |
| 445 | for elID in elementID: |
no test coverage detected