Cannot measure current in expression -- help

2012-12-15
2013-06-12
  • Amal Banerjee

    Amal Banerjee - 2012-12-15

    Could some hgspice guru please help ? I am using ngspice 23.
    I have in a netlist:
    VCURRENT 3 8 DC 0.0 AC 0.0
    ……
    ……
    EVCALCULSOC 9 0 value={(k*v(10)*I(vcurrent)/3600)-(D*SOCm*v(13)/3600)}

    At runtime, I get an error as:
    Original line no.: 0, new internal line no.: 22:
    Undefined number _
    Original line no.: 0, new internal line no.: 22:
    Expression err: k*v(10)*i(vcurrent)/3600
    Original line no.: 0, new internal line no.: 22:
    Expression err: (k*v(10)*i(vcurrent)/3600)-(d*socm*v(13)/3600)
    Original line no.: 0, new internal line no.: 22:
    Cannot compute substitute
    Copies=31 Evals=30 Placeholders=9 Symbols=8 Errors=4
    Numparam expansion errors: Run Spice anyway? y/n ?
    n
    Fatal error in NGSPICE - Return

    I am wondering why the current through this zero voltage
    source cannot be evaluated inside the expression,
    and what would be an alternative way to evaluate
    it. Thanks in advance for your help.
    _

     
  • Robert Larice

    Robert Larice - 2012-12-15

    dakuu,

      use this as an example, which works
        well with the current git ngspice.

    an example
    * (compile "w32/src/ngspice tmptmp1.cir" t)
    
    .param kkk = 3
    Vfoo  1 0  DC 42.0
    Rload 1 0  42k
    Ebar 2 0 value={kkk*v(1)*I(Vfoo)}
    Bbaz 3 0 v={kkk*v(1)*I(Vfoo)}
    .control
    op
    print v(2) 3*42*1m v(3)
    .endc
    .end
    

      the

    Exx ...  value=...
    

      might not be supported on ngspice-23, I can't remember.
      But the alternative Bxx=… should work even with ngspice-23.

      don't use `k', which might interfere with the Boltzmann constant,
       (though it doesn't seem to interfere right now,
          but don't stress this for no good reason)

    Robert

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks