Skip to content

Implementation of parameters (.param)  #126

@HGrabas

Description

@HGrabas

Preliminary information:

In a similar fashion than circuit element manipulation one would expect to access the .param values of a netlist using the dictionary:

From netlist-manipulation:

We can get back an element of a circuit using its name, either as a class attribute or using the dictionary interface:
C1 = circuit.C1
C1 = circuit['C1']
and modify it

C1.capacitance = 10@u_F

Defining circuit parameters .param in ngspice is done in the following way in PySpice:

circuit.parameter('F=1','F=1') ##TODO report bad implementation 
circuit.parameter('FC={SQRT(F)}','F={SQRT(F)}') ##TODO report bad implementation 

There is also no clear way to access and modify the .param similar to C1.capacitance = 10@u_F

Expected Behaviour

circuit.parameter('F','F=2') ##TODO report bad implementation 
print(circuit)

.param F=2

Actual Behaviour

  • The key of the dictionary is used to set the .param field in ngspice and not the value
circuit.parameter('F=1','F=2') ##TODO report bad implementation
circuit.parameter('FC={SQRT(F)}','F={SQRT(F)}') ##TODO report bad implementation 
print("Printing circuit parameters")
print(circuit._parameters)
print(circuit)

Returns:

Printing circuit parameters
{'F=1': 'F=2', 'FC={SQRT(F)}': 'F={SQRT(F)}'}
.param F=1

Steps to reproduce the behaviour

circuit.parameter('F=1','F=2') ##TODO report bad implementation 
print(circuit._parameters)
print(circuit)

In the ngSpice netlist:

.param F=1

-> Here you'd expect F=2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions