Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#219 bug exist in resistor expression

closed-rejected
Holger Vogt
None
5
2012-12-03
2012-10-30
Simon Y.H Chen
No

Dear friend,

Here comes a netlist which can be process by old version of ngspice.
However it fail in the latest code.

Please have a check,
Thanks,
Simon

--------------------------------------------------
*bug exist in r1
.temp 25.000000
.option noacct
vsource in 0 dc 1v
.param _p1=1k
.param temper=26
r1 in out '_p1*(0.5*(temper-25))'
r2 in out '1k*(0.5*(temper-25))'
vout out 0 dc 0v
.op
.print op i(vout)
.end

Discussion

  • marcel hendrix
    marcel hendrix
    2012-10-30

    This looks OK to me (r1 and r2 evaluate to 500 Ohms each, making the load across 1V 250 Ohms , giving a current of 4 mA).

    Title: * bug exist in r1
    Date: Tue Oct 30 12:51:43 2012
    Plotname: Operating Point
    Flags: real
    No. Variables: 4
    No. Points: 1
    Variables:
    0 in voltage
    1 out voltage
    2 i(vout) current
    3 i(vsource) current
    Values:
    0 1.000000000000000e+000
    0.000000000000000e+000
    4.000000000000003e-003
    -4.000000000000003e-003

     
  • marcel hendrix
    marcel hendrix
    2012-10-30

    However, the result becomes interesting when the input file define temper=25:

    .param temper=25

    Some SPICEs do not allow resistors of 0 Ohms.

    -marcel

     
  • Holger Vogt
    Holger Vogt
    2012-10-30

    • assigned_to: nobody --> h_vogt
    • status: open --> open-accepted
     
  • Holger Vogt
    Holger Vogt
    2012-10-30

    Simon,

    your example has been running in ngspice-24 just by chance. There are restrictions on parameter names (they must begin with a alphabetic character, followed by other alpabetic or speial characters or numbers). The variables time, temper and hetz are not allowed as legal parameter names.

    You may select the value for temper by the .temp statement.

    I have made an update to the manual to clarify these restrictions.

    Holger

     
  • Holger Vogt
    Holger Vogt
    2012-10-30

    • status: open-accepted --> open-rejected
     
  • Simon Y.H Chen
    Simon Y.H Chen
    2012-10-31

    Dear Holger,

    We would like you to keep the behavior in ngspice-24.
    1.parameter must begin with a alphabetic character (including special characters like "_" )
    2. temper could be used as an parameter name to describe temperature dependent device.

    However, your comment : "You may select the value for temper by the .temp statement" is not true in the most updated git code.

    try this:
    ------------------------------------------
    --------------------------------------------------
    *bug exist in r2
    .temp 26.000000
    .option noacct
    vsource in 0 dc 1v
    .param _p1=1k
    r2 in out '1k*(0.5*(temper-25))'
    vout out 0 dc 0v
    .op
    .print op i(vout)
    .end
    ------------------------------------------------------
    error message:
    Original line no.: 8, new internal line no.: 9:
    Undefined number [TEMPER]
    Original line no.: 8, new internal line no.: 9:
    Expression err: temper-25
    Original line no.: 8, new internal line no.: 9:
    Cannot compute substitute

     
  • Simon Y.H Chen
    Simon Y.H Chen
    2012-10-31

    Dear mhx_at_sf,

    Did you try the updated code from git?
    The result in my site is:

    Preparing B line for numparam
    What is this?
    _p1*(0.5*(temper-25)) )

    Circuit: *transformed modelcard

    Original line no.: 0, new internal line no.: 10:
    Undefined number [P1]
    Original line no.: 0, new internal line no.: 10:
    Cannot compute substitute
    Copies=15 Evals=15 Placeholders=1 Symbols=2 Errors
    Numparam expansion errors: Run Spice anyway? y/n ?

    Please have a check.

    Regards,
    Simon

     
  • Holger Vogt
    Holger Vogt
    2012-12-03

    • status: open-rejected --> closed-rejected