It seems that NGSPICE does not have the possibility to describe frequency-domain behaviours using the key FREQ.
It is a pitty, because this is a very interesting possibility that many SPICE-like solvers have included and that perfectly suits frequency-domain EM codes.
Would it be possible to extend NGSPICE to support this?
Kind regards,
Marlize
Please see attached link:
http://www.ecircuitcenter.com/SPICEsummary.htm
ANALOG BEHAVIORAL MODELLING
FREQ
E|G{name} {+node} {-node} FREQ {expression} (freq, gain, phase)*
Examples:
EAMP 5 0 FREQ {V(1)} (1KZ, 10DB, 0DEG) (10KHZ, 0DB, -90DEG)
marcel hendrix
2013-07-02
Hi Marlize,
Look at XSPICE's s_xfer block. It has a different syntax but is much more powerful (e.g. also works in TRAN mode). To use it, you must be able to define a transfer function given a frequency/phase characteristic. There's probably a Matlab function that can do this for you.
-marcel
Marlize Schoeman
2013-07-03
Hello Marcel,
Thank you for the feedback.
Could you please provide me with some more details. I'm not familiar with the usage of XSPICE and I don't think it is currently compiled as part of our NGSPICE executable as we do not really require this (or at least haven't had a need for this).
We typically generate R-L-C circuit descriptions describing cable models using mainly linear/controlled voltage/current sources and R, L, C, K elements. These files are generated on a per frequency basis for which we then run a single AC analysis. We additionally probe a number of voltages/currents, which we then again parse from the results file for further processing.
Users may typically include SUBCKT descriptions/files of their own to terminate these circuits that we generate. We obviously suggest that these should conform to the NGSPICE syntax. But not always possible.
Hence now the request to be able to have in essence a sub-circuit description which would vary based on the FREQ key.
G0101 P02 REF2 FREQ {V(P02)-V(REF2)} =
+ (1.000000000000000E+007,-6.014529198036472E+001,+9.000011680620938E+001)
+ (2.000000000000000E+007,-5.410289000931982E+001,+9.000099757630133E+001)
+ (3.000000000000000E+007,-5.054403079401348E+001,+9.000335153928184E+001)
+ (4.000000000000000E+007,-4.799349624618672E+001,+9.000793927491618E+001)
I've looked in the NGSPICE manual at chapter 12.2.16 (S-Domain Transfer Function). I believe this is what you refer to by saying s_xfer?
Maybe I'm not fully understanding this, but it has a single input, single output. For the example in the manual, I presume it takes the voltage at node 9 pass this through the transfer function at the current AC frequency and enforces this at node 22? If so, then how will I achieve applying this to the voltage difference V(P01)-V(REF) in my example above. I presume this node 9 and node 22 are both reference w.r.t. ground = 0.
a14 9 22 cheby_LP_3KHz
..
.model cheby_LP_3KHz s_xfer(in_offset=0.0 gain=1.0 int_ic=[0 0 0]
+ num_coeff=[1.0]
+ den_coeff=[1.0 1.42562 1.51620])
I've looked, there are options available in MATLAB zp2tf, ss2tf, etc. But I would first just understand how to actually incorporate this into my main SPICE circuit.
Thank you for the help.
Marlize
From: marcel hendrix [mailto:mhx_at_sf@users.sf.net]
Sent: 02 July 2013 01:27 PM
To: [ngspice:feature-requests]
Subject: [ngspice:feature-requests] #24 Support frequency-domain behaviour using the key FREQ
Hi Marlize,
Look at XSPICE's s_xfer block. It has a different syntax but is much more powerful (e.g. also works in TRAN mode). To use it, you must be able to define a transfer function given a frequency/phase characteristic. There's probably a Matlab function that can do this for you.
-marcel
[feature-requests:#24]http://sourceforge.net/p/ngspice/feature-requests/24/ Support frequency-domain behaviour using the key FREQ
Status: open
Created: Tue Jul 02, 2013 09:55 AM UTC by Marlize Schoeman
Last Updated: Tue Jul 02, 2013 09:55 AM UTC
Owner: nobody
It seems that NGSPICE does not have the possibility to describe frequency-domain behaviours using the key FREQ.
It is a pitty, because this is a very interesting possibility that many SPICE-like solvers have included and that perfectly suits frequency-domain EM codes.
Would it be possible to extend NGSPICE to support this?
Kind regards,
Marlize
Please see attached link:
http://www.ecircuitcenter.com/SPICEsummary.htm
ANALOG BEHAVIORAL MODELLING
FREQ
E|G{name} {+node} {-node} FREQ {expression} (freq, gain, phase)*
Examples:
EAMP 5 0 FREQ {V(1)} (1KZ, 10DB, 0DEG) (10KHZ, 0DB, -90DEG)
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/ngspice/feature-requests/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Robert Larice
2013-07-04
Hello, in the manual chapter 5.1 Bxxxx: Nonlinear dependent source (ASRC) you will find something along that line. but per 5.1.2 Special B-Source Variables time, temper, hertz the variable is called "hertz" instead of "freq" i'm sure though, that such expressions will work for ac analysis only, not for transient. the E,H,G,F sources should work too, but I'd have to try myself to be sure. furthermore I hope one can use imaginary expressions to make that usefull. Regards
marcel hendrix
2013-07-08
furthermore I hope one can use imaginary expressions
to make that usefull.
How would you synthesize the prescribed phase response?
As long as the circuit is linear, both variable amplitude
and phase of sources can be added by a post processing step.
Are you suggesting that such a step is easily done with NGSPICE?
-marcel
Robert Larice
2013-07-08
We have "complex" values in the .control .endc section
.control print (0,2)*(9,2) .endc
And I did hope you can use such values in the expression
of ASRC elements, like
B1 1 0 I = {v(1,0)/((0,1)*hertz)}
But i checked the source, the evaluator for ASRC is `real' only.
Just for experiments, I've appended some pieces of .cir
to give an idea, what "hertz" might be used for.
Note there is one example which indeed describes a
"imaginary" expression.
Robert
various frequency dependent impedances * (compile "w32/src/ngspice tmp-complex-c.cir" t) * four examples * a plain real constant valued resistance * a ASRC model of a real valued sqrt(f) proportional resistance * a R model with a frequency dependent resistance * a hack implementing a imaginary sqrt(f) proportional impedance * the later three do work only with AC analysis v1 1 0 ac=1 r1 1 0 10k v2 2 0 ac=1 b2 2 0 i = {-v(2,0)/(1k*sqrt(hertz))} v3 3 0 ac=1 r3 3 0 {1.1k*sqrt(hertz)} * I would expect complex valued constant values * might be usable for ac analysis * but this doesn't work * (0,1) would have denoted the imaginary unit *v4 4 0 ac=1 *b4 4 0 i = {-v(4,0)/(1.2k*sqrt(hertz)*(0,1))} * here a rather artificial work around v5 5 0 ac=1 c5 5 0 {1/((6.283*hertz) * (1.2k * sqrt(hertz)))} .control * this is a multiplication of two `complex' expressions print (0,2)*(0,2) ac dec 5 100 1000 plot abs(v(1)/v1#branch) abs(v(2)/v2#branch) abs(v(3)/v3#branch) plot abs(v(1)/v1#branch) abs(v(2)/v2#branch) abs(v(5)/v5#branch) * show the phase of the real resistor * and the modeled imaginary resistor plot ph(-v(1)/v1#branch) ph(-v(5)/v5#branch) .endc .end