← Back to team overview

kicad-developers team mailing list archive

Re: doing math on plots

 

For convenience, I created the following schematic symbol, and this subcircuit:

.subckt DIFFMETER a b out1 out2
BV1 out1 GND V=V(a,b)
R1 out2 GND 1g
.ends

By putting the pins out1 and out2 in the same location, hiding out2, I
could trick KiCad to consider any wire/label there connected.

It would be nice if one could pass the actual expression (V value) as
a subcircuit parameter, but my attempts at that failed. Not sure if
it's possible, Holger?

Cheers

On Thu, Oct 31, 2019 at 11:14 AM Jonatan Liljedahl <lijon@xxxxxxxxxxxx> wrote:
>
> On Wed, Oct 30, 2019 at 6:42 PM Holger Vogt <holger.vogt@xxxxxxxxxx> wrote:
> >
> > The current eeschema-ngspice interface is very limited.
>
> Are there any plans or roadmap for improving it?
>
> > > How would one plot, for example, the difference between two vectors?
> > > I tried this in a text box:
> > >
> > > .save foo=(‘v(/input)-v(/output2)’)
> > > .tran 10u 50m
> > >
> > > but "foo" does not show up in the list of vectors to display in the plot window.
> >
> > Here you might have a look at
> > https://forum.kicad.info/t/spice-plotting-difference-of-voltages/19545/2
>
> Thanks! Also I found this way: I added a symbol and a dummy resistor,
> setting the symbols Spice_Primitive and Value such that I get this in
> the netlist:
>
> BV1 /diff GND V=V(/input,/output)
> Rdummy1 NC_03 /diff 1g
>
> "V(/diff)" then shows up in the kicad plot menu. This also work for
> other operations than diffing, for example
>
> BV2 /mul GND V=V(/input)*V(/output)/100
>
> It would be nice if one could simply append stuff to the netlist in a
> textblock, is this possible?
>
> > > Another thing, I found that one can use parameters for values, for
> > > example {Rx} for a resistor value and then add a textbox with ".param
> > > Rx=100k". Would it be possible to simultaneous get plots for a set of
> > > different values of Rx?
> > >
> >
> > Here you might try external ngspice.  KiCad 5.1.x has a direct
> > interface, where you generate a netlist from your circuit and then may
> > call ngspice. This will offer the full ngspice capabilities and plotting
> > via ngspice or gnuplot. I have described an example at
> > http://ngspice.sourceforge.net/ngspice-eeschema.html#external .
> >
> > Unfortunately this interface has disappeared in KiCad 5.9.9 . I still
> > will have to make a wish list bug report to get this back.
>
> Is this supposed to work on macOS as well? I downloaded the ngspice
> package but the binary fails to run:
>
> $ ./ngspice
> dyld: Library not loaded: /opt/X11/lib/libXaw.7.dylib
>   Referenced from: /Applications/ngspice/bin/./ngspice
>   Reason: image not found
> Abort trap: 6
>
>
> --
> /Jonatan
> http://kymatica.com



-- 
/Jonatan
http://kymatica.com

Attachment: Screenshot 2019-10-31 at 12.02.01.png
Description: PNG image


References