<@U01BJBTNN9E> I ran the resistor temperature simu...
# analog-design
@User I ran the resistor temperature simulations varying the temperature (
.temp 27
) and the parameter (
.param temp 27
) and still see no temperature effect on those suffix devices. So my hunch was wrong and it must be something else happening.
@yrrapt : What does your netlist look like? The devices all have
defined; e.g.,
.model resbody  r tc1 = {tc1rpolybody} tc2 = {tc2rpolybody} tnum = 30.0
tc1rpolybody = 0.514E-3
tc2rpolybody = 0.122E-5
. Are you getting any warnings out of ngspice?
@Tim Edwards this is the netlist https://github.com/xorbit/sky130-power-blocks/blob/yrrapt_resistors/primitive-test/resistor-tc.spice. basically the same as @Patrick Van Oosterwijck original one. I tried to do the for loop in ngspice control structure but couldn't get it working so in the end used a Python script that modifies the netlist to change the temperature (param and .temp) before each run
I've been looking further into it and believe I may have found the reason it's not working. I've distilled it down to this simple test:
Copy code
** Simplified test
.param temp=27

Rnov 0 r_nov 0 resbody r = {10e3}
Rv 0 r_v 0 resbody r = {10e3*(1 + v(0,r_v)*1e-6)}

.model resbody r tc1=1e-3 tc2=1e-6 tnom = 30.0

VRnov 0 r_nov dc 1
VRv 0 r_v dc 1

dc temp -40 120 10
plot 1/i(VRnov) 1/i(VRv)

When the resistor value includes a voltage measurement the temperature coefficients don't have any effect. The no suffix model uses a different resistor model which is based on physical dimensions (w, l, sheet resistance) which is why it's not affected. So it seems to me that either the temperature coefficient needs to be added algebraically to the resistor value expression and not count on setting separate tc's and/or ngspice probably needs to be changed to avoid this behaviour
Thanks for confirming @yrrapt