Skip to content

Issue17 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@



def systemdef(tmy_meta, surftilt, surfaz, albedo, series_modules,
def systemdef(meta, surftilt, surfaz, albedo, series_modules,
parallel_modules):
'''
Generates a dict of system paramters used throughout a simulation.

Parameters
----------

tmy_meta : dict
meta file generated from a TMY file using pvl_readtmy2 or pvl_readtmy3.
It should contain at least the following fields:
meta : dict
meta dict either generated from a TMY file using readtmy2 or readtmy3, or
a dict containing at least the following fields:

=============== ====== ====================
meta field format description
Expand Down Expand Up @@ -73,8 +73,8 @@ def systemdef(tmy_meta, surftilt, surfaz, albedo, series_modules,
* 'albedo'
* 'series_modules'
* 'parallel_modules'
* 'Lat'
* 'Long'
* 'latitude'
* 'longitude'
* 'TZ'
* 'name'
* 'altitude'
Expand All @@ -87,20 +87,20 @@ def systemdef(tmy_meta, surftilt, surfaz, albedo, series_modules,
'''

try:
name = tmy_meta['Name']
name = meta['Name']
except KeyError:
name = tmy_meta['City']
name = meta['City']

system = {'surftilt':surftilt,
'surfaz':surfaz,
'albedo':albedo,
'series_modules':series_modules,
'parallel_modules':parallel_modules,
'latitude':tmy_meta['latitude'],
'longitude':tmy_meta['longitude'],
'TZ':tmy_meta['TZ'],
'latitude':meta['latitude'],
'longitude':meta['longitude'],
'TZ':meta['TZ'],
'name':name,
'altitude':tmy_meta['altitude']}
'altitude':meta['altitude']}

return system

Expand Down Expand Up @@ -1098,4 +1098,4 @@ def snlinverter(inverter, Vmp, Pmp):
ACPower[ACPower > Paco] = Paco
ACPower[ACPower < Pso] = - 1.0 * abs(Pnt)

return ACPower
return ACPower
16 changes: 15 additions & 1 deletion pvlib/test/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
irrad_data = clearsky.ineichen(times, tus, solarposition_method='pyephem')
aoi = irradiance.aoi(0, 0, ephem_data['apparent_zenith'], ephem_data['apparent_azimuth'])
am = atmosphere.relativeairmass(ephem_data.apparent_zenith)
meta = { 'latitude': 37.8, 'longitude': -122.3, 'altitude': 10, 'Name': 'Oakland', 'State': 'CA', 'TZ': -8}

pvlib_abspath = os.path.dirname(os.path.abspath(inspect.getfile(tmy)))

Expand Down Expand Up @@ -58,6 +59,19 @@ def test_systemdef_tmy2():
'surfaz': 0,
'surftilt': 0}
assert_equals(expected, pvsystem.systemdef(tmy2_metadata, 0, 0, .1, 5, 5))

def test_systemdef_dict():
expected = {'TZ': -8, ## Note that TZ is float, but Location sets tz as string
'albedo': 0.1,
'altitude': 10,
'latitude': 37.8,
'longitude': -122.3,
'name': 'Oakland',
'parallel_modules': 5,
'series_modules': 5,
'surfaz': 0,
'surftilt': 5}
assert_equals(expected, pvsystem.systemdef(meta, 5, 0, .1, 5, 5))



Expand Down Expand Up @@ -130,4 +144,4 @@ def test_snlinverter():
pdcs = idcs * vdcs

pacs = pvsystem.snlinverter(inverters[testinv], vdcs, pdcs)