I'm having some trouble in applying Anderson's rule to get a crude approximation for the band diagram of heterostructures. To make it more specific, I'm considering a donor-doped AlGaAs layer on top of an undoped GaAs layer. This is a type 1 (straddling gap) heterostructure. One region (AlGaAs) will be N type, with a fermi energy $E_F$ close to the conduction band, while for the other region it will simply lie in the middle of the band gap.
Now, I know that the rule typically works with electron affinities $\chi$. AlGaAs has a lower affinity and a higher band gap, and thus we get that the conduction band of GaAs will be lower by a conduction band offset $\Delta E_c$, while its valence band will be higher by an offset $\Delta E_v$. However, simply putting them next to each other like in the diagram below (which is for the same type of heterostructure, except that both sides are now N type, but it is prettier than the one I tried to draw myself) is obviously wrong, as the Fermi level is supposed to be constant throughout the heterostructure.
Okay, so what do I not understand. I get the basic idea that the fermi level is constant, and that to do so there is bending (related to the charge depletion of the donors, which causes an electric field). What I don't get, is how to know how to draw these discontinuities, and perhaps more importantly how to know where to draw the right conductance and valence band relative to the left one. Because if we compare the first image to the second, we see that the left side has remained the same, while the left side is now very different on the y-axis. I guess what I find weird is the change that has been made to $\chi_2$; it is much larger now, but what is it given by? How do you know how high to draw the right part of the conduction band?
I think that there is something very obvious that I'm missing, but I simply don't see it.