pvedu / photovoltaic

GNU General Public License v3.0
49 stars 12 forks source link

module 'photovoltaic.si' has no attribute 'equilibrium_carrier' #2

Open MarcvdSluys opened 5 years ago

MarcvdSluys commented 5 years ago

When I'm running semiconductor_examples.py out of the box, I get:

Thermal voltage 25 degC (V): 0.02569257041324195 Thermal voltage 300 K (V): 0.02585199102456007 Silicon ni at 25 degC 8.305e+09 cm-3 Silicon ni at 300 K 9.696e+09 cm-3 n-type cell with doping level of 2e15 Traceback (most recent call last): File "./semiconductor_examples.py", line 13, in <module> n0, p0 = pv.si.equilibrium_carrier(2e15, ni) # n-type dioping at 1e15 AttributeError: module 'photovoltaic.si' has no attribute 'equilibrium_carrier'

trautsned commented 5 years ago

It should be pv.semi.equilibrium_carrrier. I am upgrading the examples so they are in Jupyter ipynb and standard .py and will post soon.

Stuart.

From: Marc van der Sluys notifications@github.com Sent: Tuesday, August 27, 2019 12:35 PM To: trautsned/photovoltaic photovoltaic@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [trautsned/photovoltaic] module 'photovoltaic.si' has no attribute 'equilibrium_carrier' (#2)

When I'm running semiconductor_examples.py out of the box, I get:

Thermal voltage 25 degC (V): 0.02569257041324195 Thermal voltage 300 K (V): 0.02585199102456007 Silicon ni at 25 degC 8.305e+09 Silicon ni at 300 K 9.696e+09 cm-3 n-type cell with doping level of 2e15 Traceback (most recent call last): File "./semiconductor_examples.py", line 13, in n0, p0 = pv.si.equilibrium_carrier(2e15, ni) # n-type dioping at 1e15 AttributeError: module 'photovoltaic.si' has no attribute 'equilibrium_carrier'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_trautsned_photovoltaic_issues_2-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DADDAQRTNPCV3VTZOYD6T3NDQGV6X7A5CNFSM4IQKTXQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHXWE3A&d=DwMCaQ&c=l45AxH-kUV29SRQusp9vYR0n1GycN4_2jInuKy6zbqQ&r=qaFUVG_CZswcGn8D9MVsRpRKfFSmgymf66zaFnFGdTU&m=YBtR038VkpaqJKojZbrrrRiSWi7BBx4fGUTD90qblwc&s=703vvSAy2G0ByPgeCTpvmbcLL5L-z6RCMDRN-_8OBO4&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ADDAQRTQA3TU3726ECG6NJLQGV6X7ANCNFSM4IQKTXQQ&d=DwMCaQ&c=l45AxH-kUV29SRQusp9vYR0n1GycN4_2jInuKy6zbqQ&r=qaFUVG_CZswcGn8D9MVsRpRKfFSmgymf66zaFnFGdTU&m=YBtR038VkpaqJKojZbrrrRiSWi7BBx4fGUTD90qblwc&s=JH4CQqU59aTuTjRgEQf_oa6TPryEod4uKhCEPeuLIUA&e=.

MarcvdSluys commented 5 years ago

Thanks for the quick response - that works.

I created Pull request #3 with this fix and some more. Note that I could not ascertain the correct name for all failing function calls (pv.u_Si_e/h_maj/min()) and that I did not check the notebook files.

Thanks a lot in general for the website and the code - it is much appreciated!

JwBPhD commented 4 years ago

Hi MarcvdSluys,

After digging around in photovoltaic/si/ and taking a look at Thurber's model, I think I may have found a solution.

Thurber's model: def mob_thurber(N, p_type=True, majority=True): """Return the mobility of carriers (cm²/Vs) in silicon according to the model of Thurbur as a function of doping Where: N - doping level (cm-3) p_type is True or 1 for p doped material and False or 0 for n-type. majority is True or 1 for majority carriers and False or 0 for minority carriers. https://archive.org/details/relationshipbetw4006thur""" i = 2 * p_type + majority # n-type minority, n-type majority, p-type minority, p-type majority umax = [1417, 1417, 470, 470][i] umin = [160, 60, 155, 37.4][i] Nref = [5.6e16, 9.64E16, 1e17, 2.82E17][i] a = [0.647, 0.664, 0.9, 0.642][i] return umin + (umax - umin) / (1 + ((N / Nref) ** a))

It would seem logical that you are able to use: pv.si.mob_thurber(N, p_type=True/False, majority=True/False) In the following way:
plt.plot(N_D, pv.si.mob_thurber(N_D, False, True), label='Electron Majority') plt.plot(N_D, pv.si.mob_thurber(N_D, False, False), label='Electron Minority') plt.plot(N_D, pv.si.mob_thurber(N_D, True, True), label='Hole Majority') plt.plot(N_D, pv.si.mob_thurber(N_D, True, False), label='Hole Minority')

Entire working code: # -*- coding: utf-8 -*- """ Created on Wed Apr 29 14:00:34 2020

@author: JWB """ import photovoltaic as pv import numpy as np import matplotlib.pyplot as plt

N_D = np.logspace(12, 21, 200) # sweep the doping in the base (cm-3)

# plot the resisitivity plt.figure() plt.plot(N_D, pv.si.resistivity_Si_n(N_D), label='n-type') plt.plot(N_D, pv.si.resistivity_Si_p(N_D), label='p-type') plt.loglog() plt.legend() plt.title('Resisitivity of Silicon as a Function of Dopant Concentration') plt.xlabel('Dopant Concentration (cm$^{-3}$)') plt.ylabel('Resistivity (ohm·cm)') plt.xlim(1e12, 1e21) plt.ylim(1e-4, 1e4) plt.show()

# plot the mobilities plt.plot(N_D, pv.si.mob_thurber(N_D, False, True), label='Electron Majority') plt.plot(N_D, pv.si.mob_thurber(N_D, False, False), label='Electron Minority') plt.plot(N_D, pv.si.mob_thurber(N_D, True, True), label='Hole Majority') plt.plot(N_D, pv.si.mob_thurber(N_D, True, False), label='Hole Minority') plt.semilogx() plt.legend(loc='upper right') plt.title('Carrier Mobilities in Silicon') plt.xlabel('Dopant Concentration (cm$^3$)') # add axis labels and plot title plt.ylabel('Carrier Mobility (cm$^2$/V·s)') plt.show()

The resulting plots: Resistivity Mobility

I hope this helps. JWB