示例python项目
swc的Python项目详细描述
SWC
这是我为使用系统顾问模型和nsrdb api而编写的代码。
如何安装
pip install swc
开发者安装/配置
pipenv安装
在MacOS中
brew install pipenv
使用pipenv安装virtualenv
pipenv install --three
如何使用
以太阳辐射数据为输入,实现了一种简单的配置参数修改方法来模拟光伏系统的性能。
配置
首先你需要一个api。阅读https://developer.nrel.gov/signup/。一旦拥有它,请在工作文件夹下创建一个.env文件,其中包括:
API_KEY=YOUR API_KEY_GOES_HERE
就这样!
太阳辐射数据
从Jupyter笔记本或控制台从NSRB获取太阳辐射数据
importswc.nsrdbasnsrdbsite_info={'lat':18.3,'lng: -99.3,'api_key':'YOUR_API_KEY','force_download':False,'year':'2014'}df=nsrdb.get_nsrdb(**site_info)
sam模拟
使用来自nsrdb的数据执行sam模拟
importswc.sam_simulationassamsimulation_params={'lat':site_info['lat'],'lng':site_info['lng'],'losses':4.3,'dc_ac_ratio':1.2,'inv_eff':96.,'tilt':20,'system_capacity':100,'elevation':1100,'timezone':-6,'configuration':0,# 0 For fixed tilt, 2 for 1-axis and 4 for 2-axis'gcr':0.4,'azimuth':100,}output_data,output_params=sam.sam_simulation(df,**simulation_params)
LCoE计算
使用输出数据(带每小时生成的pd.dataframe)
fromsrc.solarimportlcoeprint(lcoe(output_gen))
作者
- 比索
- 塞尔吉奥·卡斯特拉诺斯
待办事项
- 从nsrdb api更改请求方法
- 在
performance_simulation
中添加更多输入
重要信息
我做这个代码是为了我个人使用。该代码将nsrdb-api和sam-sdk合并在一个简单的代码中。我没有任何上述软件。 如果您想了解更多关于SAM-SDK或NSRDB-API的信息,请访问他们各自的网站。