Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help me understand what is happening with my NGSPICE coding..

Status
Not open for further replies.

sr13579

Member
The thing is, I am confused with rawfile and .print card (spice.out file).
There are like 3 options for rawfile generation: NONE,COMPACT and ACCURATE. While I am using NONE with the .print card the result is going inside a .out file without generating a rawfile. But when I am using ACCURATE or COMPACT the print card is ignored and showing some no listing warning. The rawfile is generated but the code is ignoring print card which means I am not getting any analytical result. How to fix this problem?(The code is:
Voltage divider
r1 1 2 10k
r2 2 3 5k
r3 3 4 4k
r4 4 0 3k
v 1 0 dc 4
.dc v 4 4 1
.print dc v(1,2) v(2,3) v(3,4) v(4)
.op
.end
 

Attachments

  • Screenshot_20180127-000512.png
    Screenshot_20180127-000512.png
    65.3 KB · Views: 232
  • Screenshot_20180127-000205.png
    Screenshot_20180127-000205.png
    59 KB · Views: 232
hi

I use LTspice but the code should work.

This is all you need:
<-----I had to put a blank line here for the code to work.
r1 1 2 10k
r2 2 3 5k
r3 3 4 4k
r4 4 0 3k
v1 1 0 dc 4 <---I renamed the voltage source for clairity
;.dc v1 4 4 1 <---don't need this because it defines a DC sweep
.op
;.print dc v(1,2) v(2,3) v(3,4) v(4) <--don't need this because .op prints out all voltage and currents.

Results from LTspice:

--- Operating Point ---
V(1): 4 voltage
V(2): 2.18182 voltage
V(3): 1.27273 voltage
V(4): 0.545455 voltage
I(R4): 0.000181818 device_current
I(R3): 0.000181818 device_current
I(R2): 0.000181818 device_current
I(R1): 0.000181818 device_current
I(V1): -0.000181818 device_current


eT
 
hi

I use LTspice but the code should work.

This is all you need:
<-----I had to put a blank line here for the code to work.
r1 1 2 10k
r2 2 3 5k
r3 3 4 4k
r4 4 0 3k
v1 1 0 dc 4 <---I renamed the voltage source for clairity
;.dc v1 4 4 1 <---don't need this because it defines a DC sweep
.op
;.print dc v(1,2) v(2,3) v(3,4) v(4) <--don't need this because .op prints out all voltage and currents.

Results from LTspice:

--- Operating Point ---
V(1): 4 voltage
V(2): 2.18182 voltage
V(3): 1.27273 voltage
V(4): 0.545455 voltage
I(R4): 0.000181818 device_current
I(R3): 0.000181818 device_current
I(R2): 0.000181818 device_current
I(R1): 0.000181818 device_current
I(V1): -0.000181818 device_current


eT
See that is what I was talking about. It won't generate a printed file .This is what is painful.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top