@@ -220,31 +220,73 @@ def test_PVSystem_creation():
220
220
221
221
222
222
def test_PVSystem_get_aoi ():
223
- raise Exception ('test me' )
223
+ system = pvsystem .PVSystem (surface_tilt = 32 , surface_azimuth = 135 )
224
+ aoi = system .get_aoi (30 , 225 )
225
+ assert np .round (aoi , 4 ) == 42.7408
224
226
225
227
226
228
def test_PVSystem_get_irradiance ():
227
- raise Exception ('test me' )
229
+ system = pvsystem .PVSystem (surface_tilt = 32 , surface_azimuth = 135 )
230
+ times = pd .DatetimeIndex (start = '20160101 1200-0700' ,
231
+ end = '20160101 1800-0700' , freq = '6H' )
232
+ location = Location (latitude = 32 , longitude = - 111 )
233
+ solar_position = location .get_solarposition (times )
234
+ irrads = pd .DataFrame ({'dni' :[900 ,0 ], 'ghi' :[600 ,0 ], 'dhi' :[100 ,0 ]},
235
+ index = times )
236
+
237
+ irradiance = system .get_irradiance (solar_position ['apparent_zenith' ],
238
+ solar_position ['azimuth' ],
239
+ irrads ['dni' ],
240
+ irrads ['ghi' ],
241
+ irrads ['dhi' ])
242
+
243
+ expected = pd .DataFrame (data = np .array (
244
+ [[ 883.65494055 , 745.86141676 , 137.79352379 , 126.397131 ,
245
+ 11.39639279 ],
246
+ [ 0. , - 0. , 0. , 0. , 0. ]]),
247
+ columns = ['poa_global' , 'poa_direct' ,
248
+ 'poa_diffuse' , 'poa_sky_diffuse' ,
249
+ 'poa_ground_diffuse' ],
250
+ index = times )
251
+
252
+ irradiance = np .round (irradiance , 4 )
253
+ expected = np .round (expected , 4 )
254
+ assert_frame_equal (irradiance , expected )
228
255
229
256
230
257
def test_PVSystem_localize_with_location ():
231
- raise Exception ('test me' )
258
+ system = pvsystem .PVSystem (module = 'blah' , inverter = 'blarg' )
259
+ location = Location (latitude = 32 , longitude = - 111 )
260
+ localized_system = system .localize (location = location )
261
+
262
+ assert localized_system .module == 'blah'
263
+ assert localized_system .inverter == 'blarg'
264
+ assert localized_system .latitude == 32
265
+ assert localized_system .longitude == - 111
232
266
233
267
234
268
def test_PVSystem_localize_with_latlon ():
235
- raise Exception ('test me' )
269
+ system = pvsystem .PVSystem (module = 'blah' , inverter = 'blarg' )
270
+ localized_system = system .localize (latitude = 32 , longitude = - 111 )
271
+
272
+ assert localized_system .module == 'blah'
273
+ assert localized_system .inverter == 'blarg'
274
+ assert localized_system .latitude == 32
275
+ assert localized_system .longitude == - 111
236
276
237
277
238
- # in principle, we should be retesting each of the models tested above
239
- # when they are attached to PVSystem
278
+ # we could retest each of the models tested above
279
+ # when they are attached to LocalizedPVSystem, but
280
+ # that's probably not necessary at this point.
240
281
241
282
242
283
def test_LocalizedPVSystem_creation ():
243
- localized_pv_system = pvsystem .LocalizedPVSystem (latitude = 30 ,
244
- longitude = - 110 ,
245
- module = 'blah' ,
246
- inverter = 'blarg' )
247
-
248
-
249
- def test_LocalizedPVSystem_do_stuff ():
250
- raise Exception ('test me' )
284
+ localized_system = pvsystem .LocalizedPVSystem (latitude = 32 ,
285
+ longitude = - 111 ,
286
+ module = 'blah' ,
287
+ inverter = 'blarg' )
288
+
289
+ assert localized_system .module == 'blah'
290
+ assert localized_system .inverter == 'blarg'
291
+ assert localized_system .latitude == 32
292
+ assert localized_system .longitude == - 111
0 commit comments