SLiCAPprotos.py¶
SLiCAP module with basic SLiCAP classes and functions.
Imported by the module SLiCAPmatrices.py.
- class allResults¶
Return structure for results, has attributes with instruction data and execution results.
- A¶
Base conversion matrix.
- DCvalue¶
Zero-frequency value in case of dataType ‘pz’.
- Dv¶
Vector with dependent variables.
- Iv¶
Vector with independent variables.
- M¶
MNA matrix.
- circuit¶
Circuit (SLiCAPprotos.circuit) used for this instruction.
Will be copied from SLiCAPinstruction.instruction.circuit at the start of the execution of the instruction. This instance will not be a deep copy.
- convType¶
Defines the circuit conversion type.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- dataType¶
Defines the simulation data type.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- dc¶
DC solution at the detector.
- dcSolve¶
DC solution of the network.
- denom¶
Laplace poly of denominator.
- depVars()¶
Returns the list of detecors available AFTER execution of an instruction.
- detLabel¶
Name for the detector quantity to be used in expressions or plots.
Will be generated by SLiCAPinstruction.instruction at the start of the execution of the instruction.
- detUnits¶
Detector units ‘V’ or ‘A’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- detector¶
Names of the positive and negative detector.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- errors¶
Number of errors found in the definition of this instruction.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- gainType¶
Defines the simulation gain type.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- impulse¶
Unit impulse responses.
- inoise¶
Total source-referred noise spectral density.
- inoiseTerms¶
Dict with lists with contributions to source-referred noise.
- ivar¶
Total source-referred variance.
- ivarTerms¶
Dict with lists with contributions to source-referred variance.
- label¶
Label to be used in plots.
- laplace¶
Laplace transfer functions.
- lgRef¶
Refdes of the controlled source that is assigned as loop gain reference.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- numer¶
Laplace poly of numerator.
- numeric¶
Variable used during analysis an presentation of analysis results.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- onoise¶
Total detector-referred noise spectral.
- onoiseTerms¶
Dict with lists with contributions to detector-referred noise.
- ovar¶
Total detector-referred variance.
- ovarTerms¶
Dict with lists with contributions to detector-referred variance.
- pairedCircuits¶
Identifiers of paired subcircuits for base transformation of the circuit.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be e deep copy.
- pairedVars¶
Extension of paired nodes and branches for base transformation of the circuit.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be e deep copy.
- parDefs¶
Parameter definitions for the instruction.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be e deep copy.
- params¶
Results of parameter sweep (dataType = ‘param’).
- poles¶
Complex frequencies in [rad/s] or [Hz]
- removePairSubName¶
Setting for changing the parameter names of paired subcircuits.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be e deep copy.
- simType¶
Defines the simulation gain type.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- snoiseTerms¶
Dict with lists with source noise spectra.
- solve¶
Laplace solution of the network.
- source¶
Refdes of the signal source (independent v or i source).
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- srcUnits¶
Source units ‘V’ or ‘A’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- step¶
Setting for parameter stepping.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepArray¶
Array (list of lists) with values for step method array.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be a deep copy.
- stepList¶
List with values for step method ‘list’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction. This instance will be a deep copy.
- stepMethod¶
Step method for parameter stepping.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepNum¶
Number of steps for step methods ‘lin’ and ‘log’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepResp¶
Unit step responses.
- stepStart¶
Start value for stepping methods ‘lin’ and ‘log’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepStop¶
Stop value for stepping methods ‘lin’ and ‘log’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepVar¶
Defines the step variable (str) for step types ‘lin’, ‘log’ and ‘list’.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- stepVars¶
Defines the step variables for ‘array’ type parameter stepping.
Will be copied from SLiCAPinstruction.instruction at the start of the execution of the instruction.
- svarTerms¶
Dict with lists with source variances
- time¶
Time-domain responses.
- timeSolve¶
Time-domain solution of the network.
- zeros¶
Complex frequencies in [rad/s] or [Hz]
- class circuit¶
Prototype (sub)circuit object.
- circuits¶
(dict) with key-value pairs:
key: Name (str) of a subcircuit.
value: Associated circuit object (SLiCAPprotos.circuit).
- controlled¶
(list) with reference designators (str) of controlled sources.
- defPar(parName, parValue, units=None)¶
Updates or adds a parameter definition and updates the list SLiCAPprotos.circuit.params with names (sympy.Symbol) of undefined parameters.
- Parameters
parName (str, sympy.Symbol) – Name of the parameter.
parValue (str, sympy.Symbol, sympy.Expr, int, float) – Value of the parameter.
units (str, sympy.Symbol, sympy.Expr, int, float) – Value of the parameter, defaults to None
- Example
>>> # create my_circuit from the netlist 'myFirstRCnetwork.cir' >>> my_circuit = checkCircuit('myFirstRCnetwork.cir') >>> # Define the value of 'R' as 2000 >>> my_circuit.defPar('R', '2k', ) >>> # Or: >>> my_circuit.defPar('R', 2e3)
- defPars(parDict)¶
Adds or modifies multiple parameter definitions and updates the list circuit.params with names (sympy.Symbol) of undefined parameters.
- Params parDict
Dictionary with key-value pairs:
key: parName (str, sympy.Symbol): name of the parameter.
value: parValue (str, float, int, sympy object): value or expression of the parameter.
- Example
>>> # Create my_circuit from the netlist 'myFirstRCnetwork.cir' >>> my_circuit = checkCircuit('myFirstRCnetwork.cir') >>> # Define the value of 'R' as 2000 and 'C' as 5e-12: >>> my_circuit.defPars({'R': '2k', 'C': '5p')
- delPar(parName)¶
Deletes a parameter definition and updates the list SLiCAPprotos.circuit.params with names (sympy.core.symbol.Symbol) of undefined parameters.
- Parameters
parName (str, sympy.core.symbol.Symbol) – Name of the parameter.
- Example
>>> # create my_circuit from the netlist 'myFirstRCnetwork.cir' >>> my_circuit = checkCircuit('myFirstRCnetwork.cir') >>> # Delete the definition for the parameter 'R': >>> my_circuit.delPar('R')
- depVars¶
(list) with names (str) of independent variables:
nodal voltages:
A nodal voltage will be named as: ‘V_<node name>’
branch currents. Branch current will be named ad follows:
Current through a two-terminal element:
Vxxx: ‘I_Vxxx’
Rxxx with model ‘r’: ‘I_Rxxx’
Lxxx: ‘I_Lxxx’
Currents through the input port or the output port of controlled sources:
Exxx output port: ‘Io_Exxx’
Fxxx input port: ‘Ii_Fxxx’
Gxxx, model = ‘G’, output port: ‘Io_Gxxx’
Hxxx, input port: ‘Ii_Hxxx’, output port: ‘Io_xxx’
- elements¶
(dict) with key-value pairs:
key: Reference designator (str) of the element.
value: Element object (SLiCAPprotos.element)
- errors¶
Number (int) of errors found during checking of the circuit. Defaults to 0.
- file¶
Name (str) of the netlist file. Defaults to None.
- getElementValue(elementID, param, numeric)¶
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 arg numeric = True if instruction.simType is set to ‘numeric’.
- Parameters
elementID (str, list) – name(s) of the element(s)
param (str) –
name of the parameter (equal for all elements):
’value’: Laplace value
’dc’: DC value (independent sources only)
’noise’: Noise spectral density (independent sources only)
’dcvar’: DC variance (independent sources only)
- Returns
if type(parNames) == list:
return value = dict with key-value pairs: key (sympy.core.symbol.Symbol): name of the parameter, value (int, float, sympy expression): value of the parameter
else: value or expression
- Return type
dict, float, int, sympy.Expr
- Example
>>> # Create an instance if a SLiCAP instruction >>> my_instr = instruction() >>> # Create my_instr.circuit from the netlist 'myFirstRCnetwork.cir' >>> my_instr.setCircuit('myFirstRCnetwork.cir') >>> # Obtain the numeric value of 'R1' and 'C1': >>> my_instr.symType = 'numeric' >>> print my_instr.getElementValue(['R1', 'C1']) {'C1': 5.0e-7/pi, 'R1': 1000.00000000000}
- getParValue(parNames, numeric=False)¶
Returns the value or expression of one or more parameters.
If numeric == True it will perform a full recursive substitution of all circuit parameter definitions.
- Parameters
parNames (str, sympy.Symbol, list) – name(s) of the parameter(s)
- Returns
If type(parNames) == list:
(dict) with key-value pairs:
key (sympy.Symbol): name of the parameter
value (int, float, sympy object): value of the parameter
Else: value or expression (int, float, sympy object).
- Return type
dict, float, int, sympy obj
- Example
>>> # create an instance if a SLiCAP instruction >>> my_instr = instruction() >>> # create my_instr.circuit from the netlist 'myFirstRCnetwork.cir' >>> my_instr.checkCircuit('myFirstRCnetwork.cir') >>> # Obtain the numeric parameter definitions of of 'R' and 'C': >>> my_instr.symType = 'numeric' >>> my_instr.getParValues(['R', 'C'])
- indepVars¶
(list) with reference designators (str) of independent variables:
independent voltage sources
independent current sources.
- libs¶
(list) with names (str) of library files found in netlist lines starting with ‘,lib’ or ‘.inc’.
- modelDefs¶
(dict) with key-value pairs:
key: Name (sympy.core.symbol.Symbol) of a model.
value: Associated model object (SLiCAPprotos.model).
- nodes¶
(list) with names (str) of circuit nodes.
- parDefs¶
(dict) with key-value pairs:
key: Name (sympy.core.symbol.Symbol) of a circuit parameter.
value: Value (sympy object, float, int) of the parameter.
- parUnits¶
(dict) with key-value pairs:
key: Name (sympy.core.symbol.Symbol) of a circuit parameter.
value: Units (str) of the parameter.
- params¶
If SLiCAPcircuit.subCKT == True:
(dict) with key-value pairs:
key: Name (sympy.core.symbol.Symbol) of a parameter that can be passed to the sub circuit.
value: Default value (sympy object, float, int) of the parameter.
Else:
(list) with names (sympy.core.symbol.Symbol) of undefined parameters.
- subCKT¶
(bool) True if the circuit is a sub circuit. Defaults to False.
- title¶
Title (str) of the circuit. Defautls to None.
- updateParams()¶
Updates self.params (list with undefined parameters) after modification of parameter definitions in self.parDefs.
- varIndex¶
(dict) with key-value pairs:
key (str): node name or name of branch current.
value(int) : row position in the vector with independent variables, before elemination of the row anmd column associated with the reference node ‘0’.
- copyNotOverwrite(src, dest)¶
Copies the file ‘src’ to ‘dest’ if the latter one does not exist.
- Parameters
src (str) – Name of the source file.
dest (str) – Name of the desitination file.
- class device¶
Prototype for devices that can be used in SLiCAP.
- ID¶
ID of the device, e.g. ‘V’ for voltage source. Defaults to ‘’.
- models¶
(list) with names (str) of valid models for the device.
- nNodes¶
Number (int) of nodes of the device. Defaults to 0.
- nRefs¶
Number (int) of reference designators of referenced devices. Defaults to 0.
- value¶
(bool) True if model or value is required. Defaults to True.
- class element¶
Prototype circuit element object.
- model¶
Name (str) of the model of the element.
- nodes¶
(list) with names (str) of the nodes to which the element is connected.
- params¶
(dict) with key-value pairs:
key (sympy.core.symbol.Symbol): Name of an element parameter.
value (sympy object, float, int): Value of the parameter.
- refDes¶
Element reference designator (str), defaults to ‘’.
- refs¶
(list) with reference designators of elements (str) that are referenced to by the element.
- type¶
Element type: First letter of refdes (str).
- initAll()¶
Creates the SLiCAP built-in models and devices.
- makeDir(dirName)¶
Creates the directory ‘dirName’ if it does not yet exist.
- Parameters
dirName (str) – Name of the ditectory.
- class model¶
Protpotype for element models that can be used in SLiCAP.
- depVars¶
(list) with names of dependent variables to be used in the vector with dependent variables.
- name¶
Name (str) of the model.
- params¶
(dict) with key-value pairs:
key (str): Name of the model parameter
value (bool): True if the Laplace variable is allowed in the expression for this parameter, else False.
- stamp¶
(bool) True if model has associated matrix stamp, False if it requires expansion.
- class modelDef¶
Protpotype for model definitions that can be added to SLiCAP.
- name¶
Name (str) of the model.
- params¶
(dict) with key-value pairs:
key (str): Model parameter name
value (sympy object, float, int): Value or expression
- type¶
Name (str) of the built-in model type that should be used for this model.