# Single-Diode Model ResistanceΒΆ

How do series and shunt resistance affect the shape of an I-V curve?

```import pvlib
import numpy as np
import matplotlib.pyplot as plt

G = 1000
T = 25

cec_db = pvlib.pvsystem.retrieve_sam('CECmod')
module = cec_db['Jinko_Solar_Co___Ltd_JKM400M_72HL']
```

Shunt resistance:

```fig, ax = plt.subplots()

for multiplier in np.logspace(-2, 2, 5):
params = pvlib.pvsystem.calcparams_cec(G, T, module['alpha_sc'], module['a_ref'],
module['I_L_ref'], module['I_o_ref'],
module['R_sh_ref']*multiplier, module['R_s'],
photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth = params

curve = pvlib.pvsystem.singlediode(photocurrent, saturation_current,
resistance_series, resistance_shunt,
nNsVth,
ivcurve_pnts=200,
method='lambertw')
ax.plot(curve['v'], curve['i'], label=multiplier)

ax.legend()
ax.set_xlabel('Voltage [V]')
ax.set_ylabel('Current [A]')
```

Out:

```Text(47.097222222222214, 0.5, 'Current [A]')
```

Series resistance:

```fig, ax = plt.subplots()

for multiplier in np.logspace(-2, 2, 5):
params = pvlib.pvsystem.calcparams_cec(G, T, module['alpha_sc'], module['a_ref'],
module['I_L_ref'], module['I_o_ref'],
module['R_sh_ref'], module['R_s']*multiplier,
photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth = params

curve = pvlib.pvsystem.singlediode(photocurrent, saturation_current,
resistance_series, resistance_shunt,
nNsVth,
ivcurve_pnts=200,
method='lambertw')
ax.plot(curve['v'], curve['i'], label=multiplier)

ax.legend()
ax.set_xlabel('Voltage [V]')
ax.set_ylabel('Current [A]')
```

Out:

```Text(47.097222222222214, 0.5, 'Current [A]')
```

Total running time of the script: ( 0 minutes 2.940 seconds)

Gallery generated by Sphinx-Gallery