Which heat equation should I choose if I want to toggle between conductive and convective heat transfer? I have a science project where I have an aluminum cylinder, filled with oil, with a diode chain floating inside of it. The diode chain has a bimetallic temperature switch on it that turns off the current once the diodes reach 160 degrees Celsius. My power source is a DC power supply, constant current (2 Amps). The main idea is that the diodes generate heat, the oil convectively carries the heat to the surface of the aluminum can, which heats up. It's a bit confusing, so I drew a picture of what the entire model looks like below:

I want to calculate how much heat is produced over time by the diodes, and how hot the surface of the aluminum can will get over time. I have data and a regression line for the data here:
Regression Line:
y= 2.9094536932569152E+01  * sin(pi * (x - 2.2509532590923411E+02) / 3.0384034005581145E+02 ) + 1.4659016821752695E+02

I have no idea what heat equation to use, and help would be appreciated. Thank you!
 A: This problem is a little tricky because you have both heat transfer from small components into a relatively large environment (the diodes to the oil) and heat transfer from that environmental into a still larger environment (the can to the room).
For modeling one of these mechanisms, I'd recommend starting with a lumped-component model. It looks like this approach would fit your data pretty well, and there's some theoretical justification.
The lumped-component model assumes that the entire component is compact enough, and with a suitably high internal thermal conductivity, that it can be represented by a single temperature (i.e., internal temperature differences are minimal). The relevant heat transfer (e.g., conduction, convection, and radiation) occurs almost entirely at the surface. It's assumed that the environment remains at a constant temperature
This assumption is reasonable for the diode at a time scale of probably a fraction of a second to several seconds and for the can at a time scale of many minutes or more. As I noted, the tricky part is that you have the two heat transfer mechanisms (i.e., diode to oil and can to room) operating in conjunction over an intermediate time scale.
For a step increase in current, the temperature change for a single lumped component would be
$$\Delta T(t)=\Delta T_\mathrm{final}\left(1-e^{-rt}\right)$$
where $\Delta T_\mathrm{final}$ is the temperature difference obtained after a long time. I'd expect this value to scale with the dissipated power.
What this equation tells us is that the temperature change starts at zero and ends, after a long time, at an equilibrium value where the heat generation is approximately equal to the heat dissipated to the environment (of course, that environment might be a few cubic millimeters of oil after a second or two or a few cubic meters of the room after many minutes). The change occurs in an exponential fashion mediated by a time constant that depends on the material, geometry, and heat transfer.
Specifically, $r$ is typically taken as $hA/C$, where $h$ is the relevant natural convective coefficient, $A$ is the relevant surface area, and $C$ is the relevant heat capacity. This parameter has units of inverse time, and $1/r$ can be thought of as the time constant of the system, or the time it takes for most of the temperature change  to be completed. After a few time constants, the system has nearly reached its equilibrium temperature.
Once we know the temperature function for the unit step, we know the temperature for any input (assuming that the model conditions are still met). To do this, we calculate the transfer function by taking the Laplace transform of the temperature and dividing by the Laplace transform of a unit step, or $1/s$ (as obtained from inputting LaplaceTransform[1-Exp[-(r t)], t, s]/(1/s) in Wolfram Cloud, for example):
$$\mathcal{L}\left[\Delta T_\mathrm{final}\left(1-e^{-rt}\right)\right]\left(\frac{1}{s}\right)^{-1}=\Delta T_\mathrm{final}\left(1-\frac{s}{r+s}\right)$$
Now we multiply by the Laplace transform of a step up at $t=0$, a step down at $t=t_1$, a step up at $t=t_2$, and a step down at $t=t_3$, as indicated by your data:
$$\Delta T_\mathrm{final}\left(1-\frac{s}{r+s}\right)\left(\frac{1}{s}-\frac{e^{t_1}{s}}{s}+\frac{e^{t_2}{s}}{s}-\frac{e^{t_3}{s}}{s}\right)$$
The inverse Laplace transform of this, plotted via Wolfram Cloud for $r=1/(200\,\mathrm{s})$ and having the current change every 400 s, relative to its maximum value, is

The full code on Wolfram Cloud would be
LaplaceTransform[1-Exp[-(r t)], t, s]/(1/s)
InverseLaplaceTransform[%(1/s-Exp[-t1 s]/s+Exp[-t2 s]/s-Exp[-t3 s]/s),s,t]
Plot[%/.{r->1/200,t1->400,t2->800,t3->1200},{t,0,2000}]

where % uses the previous output.
For these long times, you're probably observing the characteristics of heat transfer from the can to the environment. If you applied the current pulses at a frequency of 1 Hz (for example), you'd likely see a similar sawtooth pattern, with the time constant reflecting the heat transfer from the diode to the oil.
To model the complete system more accurately (i.e., covering the relevant time scales of both the diodes and the can), you may wish to move to a finite element model of transient heat transfer, as the analytical model at this point becomes unwieldy (as discussed in Crank's textbook on diffusion, for instance).
A: If you want to know how much heat is produced over time, why not just use the power (watts) delivered by the dc power source (2 amp x dc voltage) during the on time of each thermostat cycle and average it out over the cycle. 
As far as the aluminum can temperature is concerned, your graph shows the temperature of the oil at the location of the thermostat (not necessarily the same as the temperature of each of the diodes). Once thermal equilibrium is reached, the temperature of the can should roughly follow the temperature of the oil.
To try and do all this with heat equations would be difficult. You have heat transfer from the diodes to the oil by convection and heat transfer from the oil to the can by convention and then heat transfer from the can to the air surrounding it by convection. All of these convective transfers are complex.
Hope this helps.
