Use InpEvaluate() instead of strtod to enable ngspice numbers
with scale factors Meg k m u n p f etc.
This commit is contained in:
parent
3be5926f2c
commit
4e03efacb7
|
|
@ -5,12 +5,12 @@ R2 in 0 47.5k
|
||||||
R1 Net-_Q1-Pad2_ in 1k
|
R1 Net-_Q1-Pad2_ in 1k
|
||||||
R5 +32 Net-_P1-Pad1_ 1k
|
R5 +32 Net-_P1-Pad1_ 1k
|
||||||
R3 Net-_P3-Pad1_ 0 10
|
R3 Net-_P3-Pad1_ 0 10
|
||||||
R4 0 Net-_P3-Pad1_ 10
|
R4 0 Net-_P3-Pad3_ 10
|
||||||
R6 Net-_P2-Pad1_ -32 1k
|
R6 Net-_P2-Pad1_ -32 1k
|
||||||
R7 out Net-_P3-Pad1_ 220
|
R7 out Net-_P3-Pad1_ 220
|
||||||
R8 out Net-_P3-Pad1_ 220
|
R8 out Net-_P3-Pad1_ 220
|
||||||
R9 out Net-_P3-Pad1_ 220
|
R9 out Net-_P3-Pad3_ 220
|
||||||
R10 out Net-_P3-Pad1_ 220
|
R10 out Net-_P3-Pad3_ 220
|
||||||
R11 Net-_R11-Pad1_ Net-_P1-Pad1_ 2.2k
|
R11 Net-_R11-Pad1_ Net-_P1-Pad1_ 2.2k
|
||||||
R13 Net-_Q3-Pad2_ Net-_P1-Pad1_ 47.5
|
R13 Net-_Q3-Pad2_ Net-_P1-Pad1_ 47.5
|
||||||
R15 Net-_Q5-Pad2_ Net-_P2-Pad1_ 47.5
|
R15 Net-_Q5-Pad2_ Net-_P2-Pad1_ 47.5
|
||||||
|
|
@ -25,7 +25,7 @@ R19 +32 Net-_D4a1-Pad1_ 1
|
||||||
R23 Net-_D2a1-Pad2_ -32 1
|
R23 Net-_D2a1-Pad2_ -32 1
|
||||||
R20 +32 Net-_D4a1-Pad1_ 1
|
R20 +32 Net-_D4a1-Pad1_ 1
|
||||||
R24 Net-_D2a1-Pad2_ -32 1
|
R24 Net-_D2a1-Pad2_ -32 1
|
||||||
Rl1 out 0 4
|
Ra2 Net-_Ra1-Pad2_ 0 4
|
||||||
D3a1 +32 Net-_D3a1-Pad1_ DMOD
|
D3a1 +32 Net-_D3a1-Pad1_ DMOD
|
||||||
D1a1 Net-_D1a1-Pad2_ -32 DMOD
|
D1a1 Net-_D1a1-Pad2_ -32 DMOD
|
||||||
D3b1 +32 Net-_D3a1-Pad1_ DMOD
|
D3b1 +32 Net-_D3a1-Pad1_ DMOD
|
||||||
|
|
@ -34,12 +34,12 @@ D4a1 +32 Net-_D4a1-Pad1_ DMOD
|
||||||
D2a1 Net-_D2a1-Pad2_ -32 DMOD
|
D2a1 Net-_D2a1-Pad2_ -32 DMOD
|
||||||
D4b1 +32 Net-_D4a1-Pad1_ DMOD
|
D4b1 +32 Net-_D4a1-Pad1_ DMOD
|
||||||
D2b1 Net-_D2a1-Pad2_ -32 DMOD
|
D2b1 Net-_D2a1-Pad2_ -32 DMOD
|
||||||
XP3 Net-_P3-Pad1_ 0 Net-_P3-Pad1_ RPOT value=200 ratio=0.85
|
XP3 Net-_P3-Pad1_ 0 Net-_P3-Pad3_ RPOT value=200 ratio={rp3}
|
||||||
XP1 Net-_P1-Pad1_ +32 +32 RPOT value=5k ratio=0.18
|
XP1 Net-_P1-Pad1_ +32 +32 RPOT value=5k ratio={rp1}
|
||||||
XP2 Net-_P2-Pad1_ -32 -32 RPOT value=5k ratio=0.18
|
XP2 Net-_P2-Pad1_ -32 -32 RPOT value=5k ratio={rp2}
|
||||||
V3 in 0 dc 0 ac 1 sin(0 2 1k)
|
V3 in 0 dc 0 ac 1 sin(0 2 1k 5m)
|
||||||
JQ1 Net-_P1-Pad1_ Net-_Q1-Pad2_ Net-_P3-Pad1_ 2SK170
|
JQ1 Net-_P1-Pad1_ Net-_Q1-Pad2_ Net-_P3-Pad1_ 2SK170
|
||||||
JQ2 Net-_P2-Pad1_ Net-_Q1-Pad2_ Net-_P3-Pad1_ 2SJ74
|
JQ2 Net-_P2-Pad1_ Net-_Q1-Pad2_ Net-_P3-Pad3_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1 Net-_Rc2-Pad2_ 0 {envtemp}
|
||||||
Cc1 Q3hs 0 1
|
Cc1 Q3hs 0 {hscc}
|
||||||
Cc2 Q4hs 0 1
|
Cc3 Q5hs 0 {hscc}
|
||||||
Cc3 Q5hs 0 1
|
Cc4 Q6hs 0 {hscc}
|
||||||
Cc4 Q6hs 0 1
|
V1 +32 0 dc 32 ; pulse(0 32 0.4m 2m 2m 100 200)
|
||||||
V1 +32 0 32 ; pulse(0 32 1m 1m 1m 100 200)
|
V2 -32 0 dc -32 ; pulse(0 -32 0.4m 2m 2m 100 200)
|
||||||
V2 -32 0 -32 ; pulse(0 -32 1m 1m 1m 100 200)
|
|
||||||
XTH2 Net-_D1a1-Pad2_ Q5hs Net-_R12-Pad1_ th R25=4.7k
|
XTH2 Net-_D1a1-Pad2_ Q5hs Net-_R12-Pad1_ th R25=4.7k
|
||||||
XTH1 Net-_D3a1-Pad1_ Q3hs Net-_R11-Pad1_ th R25=4.7k
|
XTH1 Net-_D3a1-Pad1_ Q3hs Net-_R11-Pad1_ th R25=4.7k
|
||||||
MQ3 out Net-_Q3-Pad2_ Net-_D3a1-Pad1_ Q3tj Q3tc IRFP9240 thermal
|
MQ3 out Net-_Q3-Pad2_ Net-_D3a1-Pad1_ Q3tj Q3tc IRFP9240 thermal
|
||||||
*.tran 20u 5
|
Vs1 Net-_S1-Pad3_ 0 dc 0 pulse(0 5 6 1m 1m 20 20)
|
||||||
|
XS1 Net-_Ra1-Pad2_ 0 Net-_S1-Pad3_ 0 genrelay
|
||||||
|
Cc2 Q4hs 0 {hscc}
|
||||||
|
Ra1 out Net-_Ra1-Pad2_ 4
|
||||||
|
.tran 20u 5
|
||||||
|
.param envtemp=40
|
||||||
|
.param chs=1
|
||||||
|
.param hs=1.2
|
||||||
|
.param hscc=1
|
||||||
|
.param rp2=0.21
|
||||||
|
.param rp1=0.36
|
||||||
|
.param rp3=0.505
|
||||||
.end
|
.end
|
||||||
|
|
|
||||||
|
|
@ -12,27 +12,28 @@ else
|
||||||
* Start optran without first iteration,
|
* Start optran without first iteration,
|
||||||
* without gmin stepping and without src stepping
|
* without gmin stepping and without src stepping
|
||||||
* optran step size 10 ms, duration 40s,
|
* optran step size 10 ms, duration 40s,
|
||||||
optran 1 0 0 1e-2 4 0
|
optran 1 0 0 10m 40 0
|
||||||
|
* check the first 10 ms, input is switched on after 5 ms
|
||||||
tran 1u 10m
|
tran 1u 10m
|
||||||
echo
|
echo
|
||||||
* output power
|
* output power
|
||||||
let po = @rl1[i] * v(out)
|
let po = @ra1[i] * v(out)
|
||||||
meas tran power_rms rms po from=5m to=10m
|
meas tran power_rms rms po from=5m to=10m
|
||||||
echo
|
echo
|
||||||
rusage
|
rusage
|
||||||
* temperature transistor Q6
|
* temperature transistor Q6
|
||||||
set xbrushwidth=4
|
set xbrushwidth=4
|
||||||
settype temperature q6tj q6tc q6hs
|
settype temperature q6tj q6tc q6hs
|
||||||
plot q6tj q6tc q6hs ylimit 0 150
|
plot q6tj q6tc q6hs q3tj q3tc q3hs ylimit 40 140
|
||||||
set xbrushwidth=1
|
set xbrushwidth=2
|
||||||
* input and output voltages
|
* input and output voltages
|
||||||
plot in out
|
plot in out
|
||||||
* power supply currents
|
* power supply currents
|
||||||
*plot V1#branch V2#branch ylimit -50 50
|
*plot V1#branch V2#branch ylimit -50 50
|
||||||
plot V1#branch V2#branch ylimit -15 15
|
plot V1#branch V2#branch ylimit -10 10
|
||||||
* output current
|
* output current
|
||||||
plot @rl1[i]
|
plot @ra1[i]
|
||||||
*plot @rl1[i] xlimit 0 5m ylimit -0.3 0.3
|
*plot @ra1[i] xlimit 0 5m ylimit -0.3 0.3
|
||||||
* resistance of thermistor2 TH1, TH2
|
* resistance of thermistor2 TH1, TH2
|
||||||
let rth1 = (v("net-_d3a1-pad1_") - v("net-_r11-pad1_")) / (@b.xth1.brtherm[i] + 1n)
|
let rth1 = (v("net-_d3a1-pad1_") - v("net-_r11-pad1_")) / (@b.xth1.brtherm[i] + 1n)
|
||||||
let rth2 = (v("net-_d1a1-pad2_") - v("net-_r12-pad1_")) / (@b.xth2.brtherm[i] + 1n)
|
let rth2 = (v("net-_d1a1-pad2_") - v("net-_r12-pad1_")) / (@b.xth2.brtherm[i] + 1n)
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ static double opramptime = 0.;
|
||||||
void com_optran(wordlist* wl) {
|
void com_optran(wordlist* wl) {
|
||||||
wordlist* wltmp = wl;
|
wordlist* wltmp = wl;
|
||||||
char* stpstr;
|
char* stpstr;
|
||||||
|
int err;
|
||||||
/* current circuit */
|
/* current circuit */
|
||||||
if (!ft_curckt) {
|
if (!ft_curckt) {
|
||||||
fprintf(cp_err, "Error: no circuit loaded\n");
|
fprintf(cp_err, "Error: no circuit loaded\n");
|
||||||
|
|
@ -80,16 +81,19 @@ void com_optran(wordlist* wl) {
|
||||||
if ((errno == ERANGE) || (*stpstr != '\0'))
|
if ((errno == ERANGE) || (*stpstr != '\0'))
|
||||||
goto bugquit;
|
goto bugquit;
|
||||||
wltmp = wltmp->wl_next;
|
wltmp = wltmp->wl_next;
|
||||||
opstepsize = strtod(wltmp->wl_word, &stpstr);
|
stpstr = wltmp->wl_word;
|
||||||
if ((errno == ERANGE) || (*stpstr != '\0'))
|
opstepsize = INPevaluate(&stpstr, &err, 1);
|
||||||
|
if (err || (*stpstr != '\0'))
|
||||||
goto bugquit;
|
goto bugquit;
|
||||||
wltmp = wltmp->wl_next;
|
wltmp = wltmp->wl_next;
|
||||||
opfinaltime = strtod(wltmp->wl_word, &stpstr);
|
stpstr = wltmp->wl_word;
|
||||||
if ((errno == ERANGE) || (*stpstr != '\0'))
|
opfinaltime = INPevaluate(&stpstr, &err, 1);
|
||||||
|
if (err || (*stpstr != '\0'))
|
||||||
goto bugquit;
|
goto bugquit;
|
||||||
wltmp = wltmp->wl_next;
|
wltmp = wltmp->wl_next;
|
||||||
opramptime = strtod(wltmp->wl_word, &stpstr);
|
stpstr = wltmp->wl_word;
|
||||||
if ((errno == ERANGE) || (*stpstr != '\0'))
|
opramptime = INPevaluate(&stpstr, &err, 1);
|
||||||
|
if (err || (*stpstr != '\0'))
|
||||||
goto bugquit;
|
goto bugquit;
|
||||||
if (opstepsize > opfinaltime) {
|
if (opstepsize > opfinaltime) {
|
||||||
fprintf(stderr, "Error: Step size larger than final time.\n");
|
fprintf(stderr, "Error: Step size larger than final time.\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue