Menu

#672 Undefined Parameter Cannot compute substitute

v1.0 (example)
open
nobody
None
2
2024-05-02
2024-04-24
No

Hello,

I am new to Ngspice and I was using it with Qucs software. I have installed Ngspice and unzipped the package in C:\Spice64

When I do a simulation, specifying any element (source, lumped element, anything) with a variable (let's say a resistor, I called it RL), and then I add an equation statement and name RL= 10 kOhm, when I run any simulation type, Ngspice complains that it can't subsitiute the variable and hence the simulation fails.

I am using ngspice42_64 and Qucs 5.15.8 versions.

1 Attachments

Discussion

  • Karim ElSabry

    Karim ElSabry - 2024-04-24

    I am using Windows 11 as well.

     
  • marcel hendrix

    marcel hendrix - 2024-04-24

    Add { } ?

     
  • Karim ElSabry

    Karim ElSabry - 2024-04-25

    Hi Marcel, in the netlist, {} are added already. I have appended a netlist example for RL variable.

     
  • Karim ElSabry

    Karim ElSabry - 2024-04-25

    Log file is added as well.

     
  • marcel hendrix

    marcel hendrix - 2024-04-25

    This appears to work. I have to admit to be rusty with ngspice, so maybe
    it can be done better ( .csparam? ) .

    I changed some file extensions so that it fitted my plotter and editor.

    Please write "rl = 10kOhm" not "rl =10 kOhm" and all will fall into place.

    I think you wanted a column with RL values in the output but that won't work.

    Don't destroy if you still want a .TRAN (or reparse).

    I think "set appendwrite" will work in an unwanted way (?) if there is a file
    with that name in the directory already (make sure the host dir is empty for the test).

    -marcel

    * Qucs 24.2.1  C:/Users/m3nm49/Desktop/Qucs/Common Source_prj/CS.sch
    
    * ?????  .INCLUDE "C:/Program Files (x86)/Qucs-S/share/qucs-s/xspice_cmlib/include/ngspice_mathfunc.inc"
    
    .param rl=10k
    VDS  _net0 0     DC 5
    VPr1 OUT   _net1 DC 0
    MT1  _net1 _net2 0 0 MMOD_T1 L=5e-07 W=2e-05 Ad=0 As=0 Pd=0 Ps=0 Temp=26.85
    VGS  _net2 0     DC 0 SIN(0 3 10K 0 0 0) AC 3 ACPHASE 0
    RL   OUT   _net0  {rl} tc1=0.0 tc2=0.0
    .MODEL MMOD_T1 NMOS (Vt0=1 Kp=2e-05 Gamma=0 Phi=0.6 Lambda=0 Rd=0 Rs=0 Is=1e-14 Ld=0 Tox=1e-07 Cgso=0 Cgdo=0 Cgbo=0 Cbd=0 Cbs=0 Pb=0.8 Mj=0.5 Fc=0.5 Cjsw=0 Mjsw=0.33 Tpg=1 Uo=600 Rsh=0 Cj=0 Js=0 Kf=0 Af=1 Tnom=26.85 )
    
    .control
        op
        let RL = 10kOhm
        print v(OUT) i(VPr1)  RL > spice4qucs.dc1.ngspice.dc.print
        destroy all
        reset
        set filetype=ascii
    
        let number_rl = 0
        echo "STEP sw1.rl" > spice4qucs.sw1.cir.txt
        foreach  rl_act 1000 2514.87 6324.56 15905.4 40000
            alter RL = $rl_act
            dc vgs 0 30 0.30303
            let RL = 10kOhm
            set appendwrite
            echo "$&number_rl  $rl_act" >> spice4qucs.sw1.cir.txt
            let number_rl = number_rl + 1
        end
    
        write spice4qucs.sw1._swp.raw v(OUT) VPr1#branch  $ RL
        unset appendwrite
    
        tran 5.02513e-06 0.001 0 5e-6 UIC
        let RL = 10kOhm
        write spice4qucs.tr1.raw v(OUT) VPr1#branch $ RL
    
        quit
    .endc
    .END
    
     

    Last edit: marcel hendrix 2024-04-25
  • Karim ElSabry

    Karim ElSabry - 2024-04-29

    Hi Marcel,
    I have tried the following: RL= 10kOhm, RL=10k but both didn't work. I have to say that the created netlist is from Qucs itself and I haven't written it myself. So for the commands you have mentioned, I don't know why they will created in the first place. Please have a look at the schematic and let me know if you see anything wrong there.

     
    • marcel hendrix

      marcel hendrix - 2024-04-29

      I'm afraid you will have to take this up with the Qucs maintainers/community.
      In this stage it is not at all clear what you want to see happen.

      From the shown schematic, I think (I don't use Qucs) that, with my modifications, NGSPICE is doing what it is asked . Thus I must conclude the Qucs script implementation is incorrect and (maybe) the combination of features requested ( "ALL" ) was not yet tested.

      Why did you put an AC voltage source between gate and source of the MOS? Didn't you mean a pulse source?

      -marcel

       
  • Dietmar Warning

    Dietmar Warning - 2024-04-29

    You speak about Qucs-S, not Qucs.
    I think your equation block is obsolete. Don't know what you really want with your setup but this works for me:

     
  • Karim ElSabry

    Karim ElSabry - 2024-05-02

    Hi Marcel, Dietmar,
    my provided testbench was an example on what I have encountered.
    From educational videos about Qucs-S, I have learnt to add a variable on any element (let's say a resistor with R = RL), and then declare the value of this variable in the equation hub. However, it looks like that this was working in older versions of Qucs-s but I am not sure, so I thought that there could be a problem in my setup.

     
    • marcel hendrix

      marcel hendrix - 2024-05-02

      If it works for you it is OK, but I have not ever seen a video about a technical tool that was more useful than its link to the manual at the bottom.

       

Log in to post a comment.