← Back to team overview

kicad-developers team mailing list archive

Re: doing math on plots

 

On 10/31/19 6:14 AM, Jonatan Liljedahl 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?

Not until V7.  The V6 road map is already pretty ambitious.

> 
>>> 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
> 
> 


References