el-th-ngspice-tutorial
* chapt. 3, fig.1
* electrically heated resistor D2TO35 (Vishay, Pmax 35W)
* heat sink with tentative data

*****************************************************
* modified from KiCad netlist ('/' removed), because
* .ic v(/tj) = 40 will not do in ngspice-30
*****************************************************

***electrical circuit**********
*voltage V1 across resistor R1
V1 in 0 10

* Resistance of the power resistor
R1 in Net-_R1-Pad2_ 10

*measure the current through R1
Vmeas Net-_R1-Pad2_ 0 0

***thermal circuit*************
*power (heat flow) to current
Bq tj 0 I=V(in)*I(Vmeas)*(-1)

*thermal resistance from internal resistor to case
Rjc tcase tj 4.28

*thermal capacitance of resistor in TO263 package
Cj tj 0 3m

*thermal resistance of mouting the resistor (case to heat sink)
*use thermal grease to make it this small
Rch th tcase 0.1

*heat sink made of Al
Rha tamb th 5
Ch th 0 100m

*ambient temperature
Va tamb 0 40


*.dc V1 0 10 1
*.tran 0.02 2

* start temp at junction, needed for transient simulation
.ic v(tj) = 40

***simulation control**********
.control
*max. steady state temperature at max. power
op
print tj
print i(Vmeas) * v(in)
*vary voltage (power) in resistor
dc V1 0 10 1
settype temperature tj
plot tj
*dynamic simulation at max. power
tran 0.02 2
settype temperature tj
plot tj
.endc

.end
