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

Function _updateNodes

SLiCAP/SLiCAPyacc.py:947–980  ·  view source on GitHub ↗

Determines the nodes of a subcircuit element. 1. If the node is in de node list of the prototype circuit, it is replaced with the corresponding (same index) node of the parent element. 2. If this is not the case, the node is an interbal node and it will receive the name o

(newElement, parentNodes, prototypeNodes, parentRefDes)

Source from the content-addressed store, hash-verified

945 return circuitObject
946
947def _updateNodes(newElement, parentNodes, prototypeNodes, parentRefDes):
948 """
949 Determines the nodes of a subcircuit element.
950
951 1. If the node is in de node list of the prototype circuit, it is replaced
952 with the corresponding (same index) node of the parent element.
953 2. If this is not the case, the node is an interbal node and it will
954 receive the name of the node of the pprototype circuit with the postfix
955 _<refDes of parent element>.
956
957 :param newElement: Element of the subciorcuit that needs to be connected to
958 the parent circuit.
959 :type newElement: SLiCAPprotos.element
960
961 :param parentNodes: Node list of the parent element.
962 :type parentNodes: list
963
964 :param prototypeNodes: Node list of the prototype expansion (circuit)
965 :type prototypeNodes: list
966
967 :param parentRrefDes: Reference designator of the parent element
968 :type parentRefDes: str
969
970 :return: newElement with updated node list
971 :rtype: SLiCAPprotos.element
972 """
973 for i in range(len(newElement.nodes)):
974 if newElement.nodes[i] != '0':
975 try:
976 pos = prototypeNodes.index(newElement.nodes[i])
977 newElement.nodes[i] = parentNodes[pos]
978 except ValueError:
979 newElement.nodes[i] += '_' + parentRefDes
980 return newElement
981
982def _updateElementParams(newElement, parentParams, prototypeParams, parentRefDes):
983 """

Callers 1

_doExpandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected