.subckt parameter passing

Help
craggan
2014-03-04
2014-03-05
  • craggan
    craggan
    2014-03-04

    Hi everybody,

    i've implemented a Qt5 surface on Linux64, using the shared
    library, which i a test at the moment. I use some test files
    from another simulator. Most of the simple examples work fine.
    At the moment i'm fighting with the ".SUBCKT" command, which
    uses a parameter in this case.

    The demo is a simple RC-circuit plugged to a rectangular voltage source.

    This one works:

    *rc.cir
    VV1 UREC 0 DC 0 PULSE ( 0 10 0 1p 1p 5m 10m )
    RR1 UREC UC 1k
    *XC1 UC 0 realcap C=1u
    *XC1 UC 0 realcap PARAMS: C=1u
    C1 UC 0  C=1u
    
    *.subckt realcap in out PARAMS: C=100n IC=0
    .subckt realcap in out C=100n IC=0
      C1 in out {C} IC={IC}
      R1 in out 500Meg
    .ends
    
    .TRAN 10u 10m 0 10u UIC
    EU_CURRENT_C U_CURRENT_C 0 UREC UC 1.0
    
    .END
    

    This one also:

    *rc.cir
    VV1 UREC 0 DC 0 PULSE ( 0 10 0 1p 1p 5m 10m )
    RR1 UREC UC 1k
    XC1 UC 0 realcap
    
    .subckt realcap in out 
      C1 in out 1u
      R1 in out 500Meg
    .ends
    
    .TRAN 10u 10m 0 10u UIC
    EU_CURRENT_C U_CURRENT_C 0 UREC UC 1.0
    
    .END
    

    This one fails, it doesn't show UC and the current in RR1(both combination of XC1 ):

    *rc.cir
    VV1 UREC 0 DC 0 PULSE ( 0 10 0 1p 1p 5m 10m )
    RR1 UREC UC 1k
    XC1 UC 0 realcap C=1u
    *XC1 UC 0 realcap PARAMS: C=1u
    
    *.subckt realcap in out PARAMS: C=100n IC=0
    .subckt realcap in out C=100n IC=0
      C1 in out {C} IC={IC}
      R1 in out 500Meg
    .ends
    
    *COMMANDS
    .TRAN 10u 10m 0 10u UIC
    EU_CURRENT_C U_CURRENT_C 0 UREC UC 1.0
    
    .END
    

    I can't guess why. Maybe there is a mistake i don't see, or parameter passing doesn't work. Is there anybody who has an idea?

    regards, Craggan

     
  • craggan
    craggan
    2014-03-04

    Meanwhile i've tested it with the NGSpice25 installation of my openSuse12.3. It works, the vectors are there. For the shared library i use the current git version from today (04.03.2014)???

     
  • craggan
    craggan
    2014-03-05

    Solved,

    the solution is in following thread:

    https://sourceforge.net/p/ngspice/discussion/127605/thread/0cf75cbe/

    It was the same reason.

    regards, Craggan