KatInterview

Steady-State Junction Temperature With and Without Heatsink

Math & Bit ManipulationAuto-graded · 17 test cases
EasyAuto-gradedMath & Bit Manipulationthermal-modelingarithmeticembedded-systems

Last updated

Compute a component's junction temperature from power dissipation and series thermal resistances, both before and after adding a heatsink.

Steady-state junction temperature

An electronic component generates heat that flows outward through a chain of thermal resistances into the surrounding air. In steady state you can model this chain exactly like resistors in series:

  • The dissipated power power_w (in watts) plays the role of current, and is the same through every element.
  • Each thermal resistance (in °C per watt) plays the role of a resistor.
  • Each element therefore drops the temperature by power_w × resistance, and these drops stack on top of the ambient temperature.

You are given a junction-to-case resistance r_jc_c_per_w and a baseline case-to-ambient resistance r_ca_c_per_w. The ambient temperature is ambient_c. A heatsink is then fitted, which replaces the case-to-ambient path with a new resistance heatsink_r_ca_c_per_w; the junction-to-case resistance stays the same.

Write a function that returns a list of two numbers, in this order:

  1. The junction temperature with the original (no-heatsink) case-to-ambient resistance.
  2. The junction temperature with the heatsink resistance substituted in.

Both values are computed as ambient_c + power_w × (r_jc_c_per_w + r_ca), where r_ca is respectively the original or the heatsink value. No rounding is applied.

The resistances are added in series in all cases, even if the "heatsink" value is larger than the original (the arithmetic is unchanged).

Constraints

  • 0 <= power_w <= 1000 (may be a float)
  • 0 <= r_jc_c_per_w, r_ca_c_per_w, heatsink_r_ca_c_per_w <= 1000 (may be floats)
  • -100 <= ambient_c <= 1000 (may be a float)
  • Return exactly two values, original first, heatsink second, with no rounding.

Examples

Example 1

Input: junction_temperatures(5, 2, 5, 25, 2)

Output: [60, 45]

Example 2

Input: junction_temperatures(1, 10, 4, 20, 1)

Output: [34, 31]

Example 3

Input: junction_temperatures(2.5, 3.2, 6.8, 30, 2.4)

Output: [55, 44]

Hints

Hint 1

Heat flow through the package and heatsink behaves like current through series resistors: the temperature drops add up.

Hint 2

The total temperature rise above ambient is power times the sum of the two resistances on the path.

Hint 3

Only the case-to-ambient resistance changes when the heatsink is added; the junction-to-case value is untouched.