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

Function _checkElementModel

SLiCAP/SLiCAPyacc.py:741–774  ·  view source on GitHub ↗

Checks: 1. If the element has a correct model definition 2. If the model parameters correspond with those of the prototype model 3. If the use of the Laplace variable in expressions is allowed. If the element model is not a built-in model, and the model definition

(circuitObject)

Source from the content-addressed store, hash-verified

739 circuitObject.errors += 1
740
741def _checkElementModel(circuitObject):
742 """
743 Checks:
744 1. If the element has a correct model definition
745 2. If the model parameters correspond with those of the prototype model
746 3. If the use of the Laplace variable in expressions is allowed.
747
748 If the element model is not a built-in model, and the model definition
749 is not included in the circuit, the definition will be taken from a
750 library file.
751
752 If the element model is not given the default device model will be used.
753
754 If the element is not a subcircuit, the model attribute will be set to that
755 basic model (e.g. 'Q2N3904' will be replaced with 'Q'), and model
756 parameters that have not been defined will obtain their default value.
757
758 If the element is a subcircuit model parameters that have not been defined
759 with the call will obtain their default value.
760
761 :param circuitObject: Circuit object to be checked.
762
763 :type circuitObject: SLiCAP circuit object
764
765 :return: None
766 :rtype: NoneType
767 """
768 elementNames = list(circuitObject.elements.keys())
769 for i in range(len(elementNames)):
770 elType = circuitObject.elements[elementNames[i]].type
771 if type(circuitObject.elements[elementNames[i]].model) != circuit and elType != 'X':
772 circuitObject = _checkElementModelParams(circuitObject, circuitObject.elements[elementNames[i]])
773 else:
774 circuitObject = _checkSubCircuitElementModelParams(circuitObject, circuitObject.elements[elementNames[i]])
775
776def _checkElementModelParams(circuitObject, el):
777 """

Callers 1

_checkReferencesFunction · 0.85

Calls 2

_checkElementModelParamsFunction · 0.85

Tested by

no test coverage detected