Hi,
I need some assistance using the .dc command to perform a parametric sweep analysis on a resistor. I've included the spice deck below, and attached the library file. The v(12) and v(14) state should change when RSENSOR is varied somewhere between 10k and 270k, but the output doesn't show the change. If I manually select RSENSOR values and run transient analyses I see the output change states.
Thanks,
Todd
.include nat_semi.lib LMC6484A/NS
//////////////////////
Air Separator Simulation *
//////////////////////*
190332 Sensor Board
U1A
XU1A 3 2 4 0 1 LMC6484A/NS
VCC 4 0 12
C73 2 0 .001u
R130 1 2 261k
R131 4 3 22.1k
R132 3 0 22.1k
R133 1 3 47.5k
U1B
XU1B 5 6 4 0 7 LMC6484A/NS
R145 6 0 1k
R146 6 7 4.99k
R136 5 16 2.2M
U1C
XU1C 10 9 4 0 8 LMC6484A/NS
R137 4 10 1k
R138 10 0 866
R139 7 9 619k
C74 9 0 33p
U1D
XUlD 12 13 4 0 14 LMC6484A/NS
R142 4 13 1k
R143 13 0 2k
R141 12 8 40.2k
C75 12 0 39n
Misc
C76 16 15 1u
R135 15 1 100k
R98 4 14 10k
RLOAD 14 0 10k
*AIR-WATCH load
NIVEAU-SENS Air Sensor
v(14) state changes when RSENSOR transitions between 10k and 270k
RSENSOR 16 0 10k
*High=Saline Backfill, Low=no Saline Backfill
.control
tran 1us 11ms 10ms
plot v(1)+48 v(7)+34 v(8)+20 v(12)+2 v(14)
.endc
.control
dc RSENSOR 1k 300k 1k
run
print v(12) v(14) >> result.txt
.endc
.end
Please edit your post and mark your input file contents as 'code'
Holger
What do you want to do?
Run a transient analysis with fixed RSENSOR
Run a dc sweep with varying resistor RSENSOR
Sweep the resistor RSENSOR, and each sweep step run a transient analysis
Last edit: Holger Vogt 2018-09-02
Hi Holger,
I want to run a dc sweep with the RSENSOR resistor, and monitor the v(12) and v(14) levels. I believe I'm not using the dc sweep correctly, as I see no change in those nodes. I left the transient analysis in the deck for troubleshooting purposes. Try removing the transient analysis asterisks, and running the transient analysis - try a couple different RSENSOR values (1k and 300k). You will see the resulting behavior with those two resistor values.
Best Regards,
Todd
From: Holger Vogt h_vogt@users.sourceforge.net
Sent: Sunday, September 2, 2018 9:25 PM
To: [ngspice:support-requests]
Subject: [ngspice:support-requests] #32 Resistor Parameter Sweep
What do you want to do?
Run a transient analysis with fixed RSENSOR
Run a dc sweep with varying resistor RSENSOR
Sweep the resistor RSENSOR, and each seep step run a transient analysis
[support-requests:#32]https://sourceforge.net/p/ngspice/support-requests/32/ Resistor Parameter Sweep
Status: open
Group: v1.0 (example)
Created: Sun Sep 02, 2018 06:43 PM UTC by Todd Gilbert
Last Updated: Sun Sep 02, 2018 09:18 PM UTC
Owner: nobody
Attachments:
Hi,
I need some assistance using the .dc command to perform a parametric sweep analysis on a resistor. I've included the spice deck below, and attached the library file. The v(12) and v(14) state should change when RSENSOR is varied somewhere between 10k and 270k, but the output doesn't show the change. If I manually select RSENSOR values and run transient analyses I see the output change states.
Thanks,
Todd
.include nat_semi.lib LMC6484A/NS
//////////////////////
Air Separator Simulation
//////////////////////
190332 Sensor Board
U1A
XU1A 3 2 4 0 1 LMC6484A/NS
VCC 4 0 12
C73 2 0 .001u
R130 1 2 261k
R131 4 3 22.1k
R132 3 0 22.1k
R133 1 3 47.5k
U1B
XU1B 5 6 4 0 7 LMC6484A/NS
R145 6 0 1k
R146 6 7 4.99k
R136 5 16 2.2M
U1C
XU1C 10 9 4 0 8 LMC6484A/NS
R137 4 10 1k
R138 10 0 866
R139 7 9 619k
C74 9 0 33p
U1D
XUlD 12 13 4 0 14 LMC6484A/NS
R142 4 13 1k
R143 13 0 2k
R141 12 8 40.2k
C75 12 0 39n
Misc
C76 16 15 1u
R135 15 1 100k
R98 4 14 10k
RLOAD 14 0 10k
*AIR-WATCH load
NIVEAU-SENS Air Sensor
v(14) state changes when RSENSOR transitions between 10k and 270k
RSENSOR 16 0 10k
*High=Saline Backfill, Low=no Saline Backfill
.control
tran 1us 11ms 10ms
plot v(1)+48 v(7)+34 v(8)+20 v(12)+2 v(14)
.endc
.control
dc RSENSOR 1k 300k 1k
run
print v(12) v(14) >> result.txt
.endc
.end
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/ngspice/support-requests/32/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Support Requests:
#32Hi Holger,
I want to run a dc sweep with the RSENSOR resistor, and monitor the v(12) and v(14) levels. I believe I'm not using the dc sweep correctly, as I see no change in those nodes. I left the transient analysis in the deck for troubleshooting purposes. Try removing the transient analysis asterisks, and running the transient analysis - try a couple different RSENSOR values (1k and 300k). You will see the resulting behavior with those two resistor values.
Best Regards,
Todd
//CODE//
.include nat_semi.lib LMC6484A/NS
//////////////////////
Air Separator Simulation
//////////////////////
190332 Sensor Board
U1A
XU1A 3 2 4 0 1 LMC6484A/NS
VCC 4 0 12
C73 2 0 .001u
R130 1 2 261k
R131 4 3 22.1k
R132 3 0 22.1k
R133 1 3 47.5k
U1B
XU1B 5 6 4 0 7 LMC6484A/NS
R145 6 0 1k
R146 6 7 4.99k
R136 5 16 2.2M
U1C
XU1C 10 9 4 0 8 LMC6484A/NS
R137 4 10 1k
R138 10 0 866
R139 7 9 619k
C74 9 0 33p
U1D
XUlD 12 13 4 0 14 LMC6484A/NS
R142 4 13 1k
R143 13 0 2k
R141 12 8 40.2k
C75 12 0 39n
Misc
C76 16 15 1u
R135 15 1 100k
R98 4 14 10k
RLOAD 14 0 10k
*AIR-WATCH load
NIVEAU-SENS Air Sensor
v(14) state changes when RSENSOR transitions between 10k and 270k
RSENSOR 16 0 10k
*High=Saline Backfill, Low=no Saline Backfill
.control
tran 1us 11ms 10ms
plot v(1)+48 v(7)+34 v(8)+20 v(12)+2 v(14)
.endc
.control
dc RSENSOR 1k 300k 1k
run
print v(12) v(14) >> result.txt
.endc
.end
Oops - didn't notice the asterisks had already been removed on the transient analysis.
I marked your file as code (using a string of three tildes above and below the section).
-marcel
Todd,
within this thread I now see 3 versions of your code. This is completely unnecessary!
When you have a look at your text describing the code, you may detect that the sorcefourge text editor has modified it! For example asterisks disappear in front of the text line, so their comment function for ngspice gets lost, the code becomes thus unusable.
When you your are logged in, you have several buttons on top of each post, for example the 'edit' button (in form of a pencil). When pushing this button, a text window opens with your previous post, however potentially already modified.
Then delete you original lines describing the ngspice input code. Then put in anew the complete code (from your ngspice text editor). Then mark this code text with your mouse. Then hit the
</>
botton above your text window to mark this text as code (i.e. the sourceforge text editor will not modifiy this part of the text, and write it out in a special typewriter font.If you fail to do so, any 'code' in a normal text window will probably become unreadable, useless for directly putting it to ngspice (e.g. for testing).
Holger
Thanks. Below is the result.txt file - v(12) and v(14) do not change. I've also attached transient analysis results using RSENSOR = 10K and RSENSOR = 300k demonstrating the circuit's behavior. I believe there is something wrong with how I'm capturing the v(12) and v(14) values in the dc sweep analysis.
-Todd
Index res-sweep v(12) v(14)
0 1.000000e+03 1.199869e+01 1.199831e+01
1 2.000000e+03 1.199869e+01 1.199831e+01
2 3.000000e+03 1.199869e+01 1.199831e+01
3 4.000000e+03 1.199869e+01 1.199831e+01
4 5.000000e+03 1.199869e+01 1.199831e+01
5 6.000000e+03 1.199869e+01 1.199831e+01
6 7.000000e+03 1.199869e+01 1.199831e+01
7 8.000000e+03 1.199869e+01 1.199831e+01
8 9.000000e+03 1.199869e+01 1.199831e+01
9 1.000000e+04 1.199869e+01 1.199831e+01
10 1.100000e+04 1.199869e+01 1.199831e+01
11 1.200000e+04 1.199869e+01 1.199831e+01
12 1.300000e+04 1.199869e+01 1.199831e+01
13 1.400000e+04 1.199869e+01 1.199831e+01
14 1.500000e+04 1.199869e+01 1.199831e+01
15 1.600000e+04 1.199869e+01 1.199831e+01
16 1.700000e+04 1.199869e+01 1.199831e+01
17 1.800000e+04 1.199869e+01 1.199831e+01
18 1.900000e+04 1.199869e+01 1.199831e+01
19 2.000000e+04 1.199869e+01 1.199831e+01
20 2.100000e+04 1.199869e+01 1.199831e+01
21 2.200000e+04 1.199869e+01 1.199831e+01
22 2.300000e+04 1.199869e+01 1.199831e+01
23 2.400000e+04 1.199869e+01 1.199831e+01
24 2.500000e+04 1.199869e+01 1.199831e+01
25 2.600000e+04 1.199869e+01 1.199831e+01
26 2.700000e+04 1.199869e+01 1.199831e+01
27 2.800000e+04 1.199869e+01 1.199831e+01
28 2.900000e+04 1.199869e+01 1.199831e+01
29 3.000000e+04 1.199869e+01 1.199831e+01
30 3.100000e+04 1.199869e+01 1.199831e+01
31 3.200000e+04 1.199869e+01 1.199831e+01
32 3.300000e+04 1.199869e+01 1.199831e+01
33 3.400000e+04 1.199869e+01 1.199831e+01
34 3.500000e+04 1.199869e+01 1.199831e+01
35 3.600000e+04 1.199869e+01 1.199831e+01
36 3.700000e+04 1.199869e+01 1.199831e+01
37 3.800000e+04 1.199869e+01 1.199831e+01
38 3.900000e+04 1.199869e+01 1.199831e+01
39 4.000000e+04 1.199869e+01 1.199831e+01
40 4.100000e+04 1.199869e+01 1.199831e+01
41 4.200000e+04 1.199869e+01 1.199831e+01
42 4.300000e+04 1.199869e+01 1.199831e+01
43 4.400000e+04 1.199869e+01 1.199831e+01
44 4.500000e+04 1.199869e+01 1.199831e+01
45 4.600000e+04 1.199869e+01 1.199831e+01
46 4.700000e+04 1.199869e+01 1.199831e+01
47 4.800000e+04 1.199869e+01 1.199831e+01
48 4.900000e+04 1.199869e+01 1.199831e+01
49 5.000000e+04 1.199869e+01 1.199831e+01
50 5.100000e+04 1.199869e+01 1.199831e+01
51 5.200000e+04 1.199869e+01 1.199831e+01
52 5.300000e+04 1.199869e+01 1.199831e+01
53 5.400000e+04 1.199869e+01 1.199831e+01
54 5.500000e+04 1.199869e+01 1.199831e+01
Here is the attachment referenced in the previous message.
Your circuit is an oscillator and at least 3 of the 4 opamps
are completely saturated all of the time. Also,
the main capacitor C76 has a triangular wave on it There is a cyclic
steady state, but .dc (opens capacitors, shortcircuits inductors) is
not designed for that.
What .DC will return when Rsensor is varied is the voltages in
either of the two saturated states, ~0 or ~12V. Not what you want.
-marcel
Hi Marcel,
Thank you for your careful analysis of the circuit. It is an unorthodox circuit. Not sure who designed it, but it was done several years ago. I'm attempting to simulate because of EOL component changes. I won't bore you with the details of the circuit, but there are a few items of importance: 1) NIVEAU-SENS is a sensor that is being modeled with a resistor (RSENSOR); 2) there is a performance zone where the node 8 pulse width is varying resulting in a relative node 12 voltage change; and 3) once this node rises above the node 13 8VDC threshold, node 14 switches to a constant 12VDC. Please review the .doc transient analysis plots in an earlier thread, which demonstrate the changes in output based on two RSENSOR values (10k and 300k).
Since I expect node 12 to vary in an unknown RSENSOR range, I'm attempting to perform a dc sweep. My dc sweep output shows no variance - v(12) and v(14) are 12V, regardless of the RSENSOR sweep value (see earlier thread). That lead me to wondering if I'm utilizing the dc sweep function correctly. What are your thoughts?
-Todd
I am quite sure DC analysis is not possible here.
You probably can get the information you need by
replacing Rsensor with a Voltage-controlled resistor
(this is a documented feature of NGSPICE's R and in the
manual). You control the new Rsensor with a very slowly
rising rampvoltage (see PULSE) and do a transient
analysis of the modified circuit. A plot of V(12)'s
and V(14)'s average value (if necessary add a low-pass
filter) versus the ramp voltage, or directly versus
Rsensor's controlled value, should tell you exactly
what you want to know.
Youi can also ALTERPARAM Rsensor in a looped .TRAN
script and only look at a given list of Rsensor
values.
-marcel