When simulating analog circuits and experimenting with feedback compensation, I often need to change multiple component values (resistors and capacitors) at the same time.
It would be really useful to be able to define component values using an expression with parameters, e.g. resistor R1 value being defined as (1000 + ra) * rf
where ra
and rf
are parameters that can be set independently and cause several components to change value.
Does such a feature exist in KiCad or in any plugin/extension?
Would it be possible to implement this type of in a (Python) plugin that iterates over all components, and if a certain custom field (e.g. value_expression
) exists, calculating the value of the expression resolving values of any embedded named parameters as well as references to other component values (e.g. R2
value being defined as R1*2.5+100
, and subsequently update the component value with the computed value (possibly formatting the value into a human readable form usiing SI units: p, n, µ, m, k, M, G).
If no such feature exists, I’ll create a repo on GitHub and make an attempt developing the plugin myself. I naively think that it shouldn’t be that difficult to implement, and even automatically triggering a recalculation of componentr values when referenced parameters or component values change.
EDIT
With a working IPC API for the schematic editor still being way off, I think I will make an attempt to solve this feature by parsing/modifying the underlying s-expressions in the <project>.kicad_sch
file using KiCad-Skip.
References
Similar feature request
About contents of symbol value field and simulation
Example of Python plugin modifying schematic field values
KiCad-skip
- Repository: GitHub - psychogenic/kicad-skip: kicad s-expression schematic/layout file manipulation
- Youtube video showing Kicad-skipi in use: https://youtu.be/EP1GtsZ2VfM?si=qdSb8NjNqx3b_Sc0