@@ -27,7 +27,9 @@ corresponding procedural code.
27
27
28
28
Let's use each of these pvlib modeling paradigms
29
29
to calculate the yearly energy yield for a given hardware
30
- configuration at a handful of sites listed below ::
30
+ configuration at a handful of sites listed below.
31
+
32
+ .. ipython :: python
31
33
32
34
import pandas as pd
33
35
@@ -38,36 +40,44 @@ configuration at a handful of sites listed below ::
38
40
(35 , - 105 , ' Albuquerque' ),
39
41
(40 , - 120 , ' San Francisco' ),
40
42
(50 , 10 , ' Berlin' )]
41
-
42
- None of these examples are complete!
43
- Should replace the clear sky assumption with TMY or similar
44
- (or leave as an exercise to the reader?).
43
+
44
+ import pvlib
45
+
46
+ sandia_modules = pvlib.pvsystem.retrieve_sam(' SandiaMod' )
47
+ sapm_inverters = pvlib.pvsystem.retrieve_sam(' sandiainverter' )
48
+ module = sandia_modules[' Canadian_Solar_CS5P_220M___2009_' ]
49
+ inverter = sapm_inverters[' ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_' ]
45
50
46
51
47
52
Procedural
48
53
^^^^^^^^^^
49
54
50
- Procedural code can be used to for all modeling steps in pvlib-python.
55
+ The straightforward procedural code can be used for all modeling
56
+ steps in pvlib-python.
51
57
52
58
The following code demonstrates how to use the procedural code
53
- to accomplish our system modeling goal: ::
54
-
55
- import pvlib
59
+ to accomplish our system modeling goal:
60
+
61
+ .. ipython :: python
56
62
57
63
system = {' module' : module, ' inverter' : inverter,
58
- 'surface_azimuth': 180, **other_params }
64
+ ' surface_azimuth' : 180 }
59
65
60
66
energies = {}
61
67
for latitude, longitude, name in coordinates:
68
+ system[' surface_tilt' ] = latitude
62
69
cs = pvlib.clearsky.ineichen(times, latitude, longitude)
63
70
solpos = pvlib.solarposition.get_solarposition(times, latitude, longitude)
64
- system['surface_tilt'] = latitude
65
- total_irrad = pvlib.irradiance.total_irradiance(**solpos, **cs, **system)
66
- temps = pvlib.pvsystem.sapm_celltemp(**total_irrad, **system)
67
- dc = pvlib.pvsystem.sapm(**temps, **total_irrad, **system)
68
- ac = pvlib.pvsystem.snlinverter(**system, **dc)
69
- annual_energy = power.sum()
71
+ airmass = pvlib.atmosphere.relativeairmass(solpos[' apparent_zenith' ])
72
+ aoi = pvlib.irradiance.aoi(system[' surface_tilt' ], system[' surface_azimuth' ], solpos[' apparent_zenith' ], solpos[' azimuth' ])
73
+ total_irrad = pvlib.irradiance.total_irrad(** solpos, ** cs, ** system)
74
+ temps = pvlib.pvsystem.sapm_celltemp(total_irrad[' poa_global' ], 0 , 20 )
75
+ dc = pvlib.pvsystem.sapm(module, total_irrad[' poa_direct' ], total_irrad[' poa_diffuse' ], temps[' temp_cell' ], airmass, aoi)
76
+ ac = pvlib.pvsystem.snlinverter(inverter, dc[' v_mp' ], dc[' p_mp' ])
77
+ annual_energy = ac.sum()
70
78
energies[name] = annual_energy
79
+
80
+ print (energies)
71
81
72
82
# energies = pd.DataFrame(energies)
73
83
# energies.plot()
@@ -93,7 +103,9 @@ The following code demonstrates how to use
93
103
:class: `Location <pvlib.location.Location> `,
94
104
:class: `PVSystem <pvlib.pvsystem.PVSystem> `, and
95
105
:class: `ModelChain <pvlib.modelchain.ModelChain> `
96
- objects to accomplish our system modeling goal: ::
106
+ objects to accomplish our system modeling goal:
107
+
108
+ .. ipython :: python
97
109
98
110
from pvlib.pvsystem import PVSystem
99
111
from pvlib.location import Location
@@ -126,10 +138,15 @@ a power plant that already exists.
126
138
127
139
The following code demonstrates how to use a
128
140
:class: `LocalizedPVSystem <pvlib.pvsystem.LocalizedPVSystem> `
129
- object to accomplish our modeling goal: ::
141
+ object to accomplish our modeling goal:
142
+
143
+ .. ipython :: python
130
144
131
145
from pvlib.pvsystem import PVSystem, LocalizedPVSystem
132
146
147
+ module =
148
+ inverter =
149
+ other_system_params = {} # sometime helpful to break apart
133
150
base_system = PVSystem(module, inverter, ** other_system_params)
134
151
135
152
energies = {}
0 commit comments