Re: Re: [Help-gnucap] how to model sinusoidal dependence on charge?

"[email protected]" <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
Hello,

A long time ago I wrote a file to extend "Voltage controlled voltage source"
and Al Davis wrote :
 > I would prefer that it is done as 5 separate files, one for each 
function,
 > using "bm_tanh.cc" as a style guide.  If you can do this, I will 
include it
 > with the main distribution, along with posy and tanh that are already 
there.
Now I have done it and feel free to use it as you like.

E1 (out 0 in 0) expon                       means : out=e^(in)
E1 (out 0 in 0) expon(3.0,5.0)              means : out=e^(3.0*in+5.0)
E1 (out 0 in 0) sinus(314,-78.5)            means : out=sin(314*in 
-0,785) = -cos(314*in)
E1 (out 0 0 0) ramp                         means : out=t where t is the 
time of the simulation
V1 (out 0) ramp(2.0,3.0)                    means : out=2.0*t+3.0
E1 (out 0 0 0) ln(2.0,3.0)                  means : out=log(2.0 * in + 3.0)
E1 (out 0 0 0) tan(2.0,3.0)                 means : out=tan(2.0 * in + 3.0)

Default parameters are a=1.0 and b=0.0 for a*in+b, sin(a*in+b), 
exp(a*in+b),...

If you want to build the signal out = sin(3*t+5) e^(-6*t)  use :
V1 1 0 ramp
E1 (2 0 1 0) sinus(3.0,5.0)
E2 (3 0 1 0) expon(-6.0,0.0)
X1 2 3 4 Mul

Where the subckt Mul is defined by :
.SUBCKT Mul in1 in2 out
G1 1 0 in1 0 1.0
G2 1 0 VCR 0 in2 1.0
E1 out 0 1 0 1.0
.ENDS

It works but the names are quite ambiguous : exp!=expon, sin!=sinus, 
tan!=tanh
Morever, I don't know how such an extension fits with the convergence 
algorithm.
So I distribute it in the hope that it will be useful but WITHOUT ANY 
WARRANTY ;-)

Al Davis wrote :
 > 1. You don't need to change the makefile to use it.  Instead,
 > compile it as a shared object (.so on Linux) and use the "load"
 > command to bring it in.  This way, when the stable version comes
 > out, and the distros package it, you can add things like this
 > without recompiling the whole simulator.
 >
 > "g++ -shared -fPIC -o bm_func.so bm_func.cc"
 >
 > then from gnucap:
 >
 > "load /full/path/to/bm_func.so"
 >
 > or on the command line:
 >
 > "gnucap -a /full/path/to/bm_func.so  ......."

However, this doesn't work on cygwin/windows xp
I used g++ -shared -fPIC -c -o bm_xxx.so bm_xxx.cc
but I failed to load it in gnucap : cygwin Permission denied
So I changed two lines in the Makefile :

# behavioral modeling functions
BM_SRCS = \
bm_complex.cc bm_cond.cc bm_exp.cc bm_fit.cc bm_generator.cc \
bm_model.cc bm_poly.cc bm_posy.cc bm_pulse.cc bm_pwl.cc bm_sffm.cc \
bm_sin.cc bm_tanh.cc bmm_table.cc bmm_semi.cc bm_ramp.cc bm_expon.cc \
bm_ln.cc bm_sinus.cc bm_tan.cc

am__objects_5 = bm_complex.$(OBJEXT) bm_cond.$(OBJEXT) \
     bm_exp.$(OBJEXT) bm_fit.$(OBJEXT) bm_generator.$(OBJEXT) \
     bm_model.$(OBJEXT) bm_poly.$(OBJEXT) bm_posy.$(OBJEXT) \
     bm_pulse.$(OBJEXT) bm_pwl.$(OBJEXT) bm_sffm.$(OBJEXT) \
     bm_sin.$(OBJEXT) bm_tanh.$(OBJEXT) bmm_table.$(OBJEXT) \
     bmm_semi.$(OBJEXT) bm_ramp.$(OBJEXT) bm_expon.$(OBJEXT) \
     bm_ln.$(OBJEXT) bm_sinus.$(OBJEXT) bm_tan.$(OBJEXT)

The whole package is here : 
http://jacques.lecoupanec.free.fr/GnuCap/contrib.tar
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.