MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _addResNoiseSources

Function _addResNoiseSources

SLiCAP/SLiCAPexecute.py:760–796  ·  view source on GitHub ↗

Adds the noise sources of resistors to instr.circuit for dataType: 'noise'. :param instr: SLiCAP instruction object that holds instruction data. :type instr: SLiCAPinstruction.instruction :return: instr of the execution of the instruction. :rtype: SLiCAPinstruction.instruction

(instr)

Source from the content-addressed store, hash-verified

758 return instr
759
760def _addResNoiseSources(instr):
761 """
762 Adds the noise sources of resistors to instr.circuit for dataType: 'noise'.
763
764 :param instr: SLiCAP instruction object that holds instruction data.
765 :type instr: SLiCAPinstruction.instruction
766
767 :return: instr of the execution of the instruction.
768 :rtype: SLiCAPinstruction.instruction
769 """
770 for el in list(instr.circuit.elements.keys()):
771 if instr.circuit.elements[el].model.upper() == 'R':
772 params = list(instr.circuit.elements[el].params.keys())
773 if 'noisetemp' in params:
774 Temp = instr.circuit.elements[el].params['noisetemp']
775 if Temp != False and Temp != 0 and instr.circuit.elements[el].params['value'] != 0:
776 spectrum = sp.sympify('4*k*' + str(Temp), rational=True)/instr.circuit.elements[el].params['value']
777 if 'noiseflow' in params:
778 flow = instr.circuit.elements[el].params['noiseflow']
779 if flow != False and flow != 0:
780 spectrum *= (1 + flow/ini.frequency)
781 noiseCurrent = element()
782 noiseCurrent.refDes = 'I_noise_' + instr.circuit.elements[el].refDes
783 noiseCurrent.params['noise'] = spectrum
784 noiseCurrent.params['value'] = sp.N(0)
785 noiseCurrent.params['dc'] = sp.N(0)
786 noiseCurrent.params['dcvar'] = sp.N(0)
787 noiseCurrent.model = 'I'
788 noiseCurrent.type = 'I'
789 noiseCurrent.nodes = instr.circuit.elements[el].nodes
790 instr.circuit.elements[noiseCurrent.refDes] = noiseCurrent
791 instr.circuit.indepVars.append(noiseCurrent.refDes)
792 # Add the global parameter k to the circuit parameter definitions
793 Boltzmann = sp.Symbol('k')
794 if Boltzmann not in list(instr.circuit.parDefs.keys()):
795 instr.circuit.parDefs[Boltzmann] = ini.SLiCAPPARAMS['k']
796 return instr
797
798def _delResNoiseSources(instr):
799 """

Callers 1

checkMethod · 0.90

Calls 1

elementClass · 0.90

Tested by

no test coverage detected