In [13]:
%load_ext autoreload
%autoreload 2
%matplotlib inline

from smarts import *
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from pypvcell.solarcell import SQCell,MJCell


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [36]:
times=pd.date_range(start='2016-12-01 04:00',end='2016-12-10 23:00',freq='15T',tz='Japan')
df=get_clear_sky(times)
print(df.head())


                           WVLGTH  ET_SPCTRUM   BEAM_NORMAL    BEAM_NORM+  \
time                                                                        
2016-12-01 06:45:00+09:00   300.0      0.5200  7.466000e-28  7.466000e-28   
2016-12-01 06:45:00+09:00   302.0      0.5468  2.534000e-26  2.534000e-26   
2016-12-01 06:45:00+09:00   304.0      0.5871  5.658000e-25  5.658000e-25   
2016-12-01 06:45:00+09:00   306.0      0.6154  9.159000e-24  9.159000e-24   
2016-12-01 06:45:00+09:00   308.0      0.6337  1.124000e-22  1.124000e-22   

                             GLOB_HORIZ    GLOBL_TILT  
time                                                   
2016-12-01 06:45:00+09:00  5.630000e-07  5.085000e-07  
2016-12-01 06:45:00+09:00  1.425000e-06  1.287000e-06  
2016-12-01 06:45:00+09:00  3.593000e-06  3.246000e-06  
2016-12-01 06:45:00+09:00  8.195000e-06  7.404000e-06  
2016-12-01 06:45:00+09:00  1.621000e-05  1.465000e-05  

In [37]:
df.to_hdf('store_tl.h5',key='df',mode='w')

In [47]:
ndf=pd.read_hdf('store_tl.h5')
df=ndf

In [48]:
# Set up a basic solar cells
ingap_cell=SQCell(1.9,297,rad_eta=0.001)
gaas_cell=SQCell(1.42,297,rad_eta=0.01)

si_cell=SQCell(1.12,297,rad_eta=0.001)
si_cell.set_description("Si")

future_si_cell=SQCell(1.12,297,rad_eta=0.01)
future_si_cell.set_description("future Si")

future_backplane_cell=SQCell(1.42,297,rad_eta=0.01)
future_backplane_cell.set_description("fp-GaAs")

ge_cell=SQCell(0.67,297,rad_eta=0.0001)
one_ev_cell=SQCell(1.0,297,rad_eta=1e-5)

twoj_cell=MJCell([ingap_cell,gaas_cell])
twoj_cell.set_description("2J")
threej_cell=MJCell([ingap_cell,gaas_cell,ge_cell])
threej_cell.set_description("3J")

fourj_cell=MJCell([ingap_cell,gaas_cell,one_ev_cell,ge_cell])
fourj_cell.set_description("4J")

In [49]:
# some of the time index does not have sun spectrum because azimuthal angle < , we need to filter out this
new_time=pd.unique(df.index)

In [50]:
new_time


Out[50]:
array(['2016-11-30T21:45:00.000000000', '2016-11-30T22:00:00.000000000',
       '2016-11-30T22:15:00.000000000', '2016-11-30T22:30:00.000000000',
       '2016-11-30T22:45:00.000000000', '2016-11-30T23:00:00.000000000',
       '2016-11-30T23:15:00.000000000', '2016-11-30T23:30:00.000000000',
       '2016-11-30T23:45:00.000000000', '2016-12-01T00:00:00.000000000',
       '2016-12-01T00:15:00.000000000', '2016-12-01T00:30:00.000000000',
       '2016-12-01T00:45:00.000000000', '2016-12-01T01:00:00.000000000',
       '2016-12-01T01:15:00.000000000', '2016-12-01T01:30:00.000000000',
       '2016-12-01T01:45:00.000000000', '2016-12-01T02:00:00.000000000',
       '2016-12-01T02:15:00.000000000', '2016-12-01T02:30:00.000000000',
       '2016-12-01T02:45:00.000000000', '2016-12-01T03:00:00.000000000',
       '2016-12-01T03:15:00.000000000', '2016-12-01T03:30:00.000000000',
       '2016-12-01T03:45:00.000000000', '2016-12-01T04:00:00.000000000',
       '2016-12-01T04:15:00.000000000', '2016-12-01T04:30:00.000000000',
       '2016-12-01T04:45:00.000000000', '2016-12-01T05:00:00.000000000',
       '2016-12-01T05:15:00.000000000', '2016-12-01T05:30:00.000000000',
       '2016-12-01T05:45:00.000000000', '2016-12-01T06:00:00.000000000',
       '2016-12-01T06:15:00.000000000', '2016-12-01T06:30:00.000000000',
       '2016-12-01T06:45:00.000000000', '2016-12-01T07:00:00.000000000',
       '2016-12-01T07:15:00.000000000', '2016-12-01T07:30:00.000000000',
       '2016-12-01T21:45:00.000000000', '2016-12-01T22:00:00.000000000',
       '2016-12-01T22:15:00.000000000', '2016-12-01T22:30:00.000000000',
       '2016-12-01T22:45:00.000000000', '2016-12-01T23:00:00.000000000',
       '2016-12-01T23:15:00.000000000', '2016-12-01T23:30:00.000000000',
       '2016-12-01T23:45:00.000000000', '2016-12-02T00:00:00.000000000',
       '2016-12-02T00:15:00.000000000', '2016-12-02T00:30:00.000000000',
       '2016-12-02T00:45:00.000000000', '2016-12-02T01:00:00.000000000',
       '2016-12-02T01:15:00.000000000', '2016-12-02T01:30:00.000000000',
       '2016-12-02T01:45:00.000000000', '2016-12-02T02:00:00.000000000',
       '2016-12-02T02:15:00.000000000', '2016-12-02T02:30:00.000000000',
       '2016-12-02T02:45:00.000000000', '2016-12-02T03:00:00.000000000',
       '2016-12-02T03:15:00.000000000', '2016-12-02T03:30:00.000000000',
       '2016-12-02T03:45:00.000000000', '2016-12-02T04:00:00.000000000',
       '2016-12-02T04:15:00.000000000', '2016-12-02T04:30:00.000000000',
       '2016-12-02T04:45:00.000000000', '2016-12-02T05:00:00.000000000',
       '2016-12-02T05:15:00.000000000', '2016-12-02T05:30:00.000000000',
       '2016-12-02T05:45:00.000000000', '2016-12-02T06:00:00.000000000',
       '2016-12-02T06:15:00.000000000', '2016-12-02T06:30:00.000000000',
       '2016-12-02T06:45:00.000000000', '2016-12-02T07:00:00.000000000',
       '2016-12-02T07:15:00.000000000', '2016-12-02T07:30:00.000000000',
       '2016-12-02T21:45:00.000000000', '2016-12-02T22:00:00.000000000',
       '2016-12-02T22:15:00.000000000', '2016-12-02T22:30:00.000000000',
       '2016-12-02T22:45:00.000000000', '2016-12-02T23:00:00.000000000',
       '2016-12-02T23:15:00.000000000', '2016-12-02T23:30:00.000000000',
       '2016-12-02T23:45:00.000000000', '2016-12-03T00:00:00.000000000',
       '2016-12-03T00:15:00.000000000', '2016-12-03T00:30:00.000000000',
       '2016-12-03T00:45:00.000000000', '2016-12-03T01:00:00.000000000',
       '2016-12-03T01:15:00.000000000', '2016-12-03T01:30:00.000000000',
       '2016-12-03T01:45:00.000000000', '2016-12-03T02:00:00.000000000',
       '2016-12-03T02:15:00.000000000', '2016-12-03T02:30:00.000000000',
       '2016-12-03T02:45:00.000000000', '2016-12-03T03:00:00.000000000',
       '2016-12-03T03:15:00.000000000', '2016-12-03T03:30:00.000000000',
       '2016-12-03T03:45:00.000000000', '2016-12-03T04:00:00.000000000',
       '2016-12-03T04:15:00.000000000', '2016-12-03T04:30:00.000000000',
       '2016-12-03T04:45:00.000000000', '2016-12-03T05:00:00.000000000',
       '2016-12-03T05:15:00.000000000', '2016-12-03T05:30:00.000000000',
       '2016-12-03T05:45:00.000000000', '2016-12-03T06:00:00.000000000',
       '2016-12-03T06:15:00.000000000', '2016-12-03T06:30:00.000000000',
       '2016-12-03T06:45:00.000000000', '2016-12-03T07:00:00.000000000',
       '2016-12-03T07:15:00.000000000', '2016-12-03T07:30:00.000000000',
       '2016-12-03T22:00:00.000000000', '2016-12-03T22:15:00.000000000',
       '2016-12-03T22:30:00.000000000', '2016-12-03T22:45:00.000000000',
       '2016-12-03T23:00:00.000000000', '2016-12-03T23:15:00.000000000',
       '2016-12-03T23:30:00.000000000', '2016-12-03T23:45:00.000000000',
       '2016-12-04T00:00:00.000000000', '2016-12-04T00:15:00.000000000',
       '2016-12-04T00:30:00.000000000', '2016-12-04T00:45:00.000000000',
       '2016-12-04T01:00:00.000000000', '2016-12-04T01:15:00.000000000',
       '2016-12-04T01:30:00.000000000', '2016-12-04T01:45:00.000000000',
       '2016-12-04T02:00:00.000000000', '2016-12-04T02:15:00.000000000',
       '2016-12-04T02:30:00.000000000', '2016-12-04T02:45:00.000000000',
       '2016-12-04T03:00:00.000000000', '2016-12-04T03:15:00.000000000',
       '2016-12-04T03:30:00.000000000', '2016-12-04T03:45:00.000000000',
       '2016-12-04T04:00:00.000000000', '2016-12-04T04:15:00.000000000',
       '2016-12-04T04:30:00.000000000', '2016-12-04T04:45:00.000000000',
       '2016-12-04T05:00:00.000000000', '2016-12-04T05:15:00.000000000',
       '2016-12-04T05:30:00.000000000', '2016-12-04T05:45:00.000000000',
       '2016-12-04T06:00:00.000000000', '2016-12-04T06:15:00.000000000',
       '2016-12-04T06:30:00.000000000', '2016-12-04T06:45:00.000000000',
       '2016-12-04T07:00:00.000000000', '2016-12-04T07:15:00.000000000',
       '2016-12-04T07:30:00.000000000', '2016-12-04T22:00:00.000000000',
       '2016-12-04T22:15:00.000000000', '2016-12-04T22:30:00.000000000',
       '2016-12-04T22:45:00.000000000', '2016-12-04T23:00:00.000000000',
       '2016-12-04T23:15:00.000000000', '2016-12-04T23:30:00.000000000',
       '2016-12-04T23:45:00.000000000', '2016-12-05T00:00:00.000000000',
       '2016-12-05T00:15:00.000000000', '2016-12-05T00:30:00.000000000',
       '2016-12-05T00:45:00.000000000', '2016-12-05T01:00:00.000000000',
       '2016-12-05T01:15:00.000000000', '2016-12-05T01:30:00.000000000',
       '2016-12-05T01:45:00.000000000', '2016-12-05T02:00:00.000000000',
       '2016-12-05T02:15:00.000000000', '2016-12-05T02:30:00.000000000',
       '2016-12-05T02:45:00.000000000', '2016-12-05T03:00:00.000000000',
       '2016-12-05T03:15:00.000000000', '2016-12-05T03:30:00.000000000',
       '2016-12-05T03:45:00.000000000', '2016-12-05T04:00:00.000000000',
       '2016-12-05T04:15:00.000000000', '2016-12-05T04:30:00.000000000',
       '2016-12-05T04:45:00.000000000', '2016-12-05T05:00:00.000000000',
       '2016-12-05T05:15:00.000000000', '2016-12-05T05:30:00.000000000',
       '2016-12-05T05:45:00.000000000', '2016-12-05T06:00:00.000000000',
       '2016-12-05T06:15:00.000000000', '2016-12-05T06:30:00.000000000',
       '2016-12-05T06:45:00.000000000', '2016-12-05T07:00:00.000000000',
       '2016-12-05T07:15:00.000000000', '2016-12-05T07:30:00.000000000',
       '2016-12-05T22:00:00.000000000', '2016-12-05T22:15:00.000000000',
       '2016-12-05T22:30:00.000000000', '2016-12-05T22:45:00.000000000',
       '2016-12-05T23:00:00.000000000', '2016-12-05T23:15:00.000000000',
       '2016-12-05T23:30:00.000000000', '2016-12-05T23:45:00.000000000',
       '2016-12-06T00:00:00.000000000', '2016-12-06T00:15:00.000000000',
       '2016-12-06T00:30:00.000000000', '2016-12-06T00:45:00.000000000',
       '2016-12-06T01:00:00.000000000', '2016-12-06T01:15:00.000000000',
       '2016-12-06T01:30:00.000000000', '2016-12-06T01:45:00.000000000',
       '2016-12-06T02:00:00.000000000', '2016-12-06T02:15:00.000000000',
       '2016-12-06T02:30:00.000000000', '2016-12-06T02:45:00.000000000',
       '2016-12-06T03:00:00.000000000', '2016-12-06T03:15:00.000000000',
       '2016-12-06T03:30:00.000000000', '2016-12-06T03:45:00.000000000',
       '2016-12-06T04:00:00.000000000', '2016-12-06T04:15:00.000000000',
       '2016-12-06T04:30:00.000000000', '2016-12-06T04:45:00.000000000',
       '2016-12-06T05:00:00.000000000', '2016-12-06T05:15:00.000000000',
       '2016-12-06T05:30:00.000000000', '2016-12-06T05:45:00.000000000',
       '2016-12-06T06:00:00.000000000', '2016-12-06T06:15:00.000000000',
       '2016-12-06T06:30:00.000000000', '2016-12-06T06:45:00.000000000',
       '2016-12-06T07:00:00.000000000', '2016-12-06T07:15:00.000000000',
       '2016-12-06T07:30:00.000000000', '2016-12-06T22:00:00.000000000',
       '2016-12-06T22:15:00.000000000', '2016-12-06T22:30:00.000000000',
       '2016-12-06T22:45:00.000000000', '2016-12-06T23:00:00.000000000',
       '2016-12-06T23:15:00.000000000', '2016-12-06T23:30:00.000000000',
       '2016-12-06T23:45:00.000000000', '2016-12-07T00:00:00.000000000',
       '2016-12-07T00:15:00.000000000', '2016-12-07T00:30:00.000000000',
       '2016-12-07T00:45:00.000000000', '2016-12-07T01:00:00.000000000',
       '2016-12-07T01:15:00.000000000', '2016-12-07T01:30:00.000000000',
       '2016-12-07T01:45:00.000000000', '2016-12-07T02:00:00.000000000',
       '2016-12-07T02:15:00.000000000', '2016-12-07T02:30:00.000000000',
       '2016-12-07T02:45:00.000000000', '2016-12-07T03:00:00.000000000',
       '2016-12-07T03:15:00.000000000', '2016-12-07T03:30:00.000000000',
       '2016-12-07T03:45:00.000000000', '2016-12-07T04:00:00.000000000',
       '2016-12-07T04:15:00.000000000', '2016-12-07T04:30:00.000000000',
       '2016-12-07T04:45:00.000000000', '2016-12-07T05:00:00.000000000',
       '2016-12-07T05:15:00.000000000', '2016-12-07T05:30:00.000000000',
       '2016-12-07T05:45:00.000000000', '2016-12-07T06:00:00.000000000',
       '2016-12-07T06:15:00.000000000', '2016-12-07T06:30:00.000000000',
       '2016-12-07T06:45:00.000000000', '2016-12-07T07:00:00.000000000',
       '2016-12-07T07:15:00.000000000', '2016-12-07T07:30:00.000000000',
       '2016-12-07T22:00:00.000000000', '2016-12-07T22:15:00.000000000',
       '2016-12-07T22:30:00.000000000', '2016-12-07T22:45:00.000000000',
       '2016-12-07T23:00:00.000000000', '2016-12-07T23:15:00.000000000',
       '2016-12-07T23:30:00.000000000', '2016-12-07T23:45:00.000000000',
       '2016-12-08T00:00:00.000000000', '2016-12-08T00:15:00.000000000',
       '2016-12-08T00:30:00.000000000', '2016-12-08T00:45:00.000000000',
       '2016-12-08T01:00:00.000000000', '2016-12-08T01:15:00.000000000',
       '2016-12-08T01:30:00.000000000', '2016-12-08T01:45:00.000000000',
       '2016-12-08T02:00:00.000000000', '2016-12-08T02:15:00.000000000',
       '2016-12-08T02:30:00.000000000', '2016-12-08T02:45:00.000000000',
       '2016-12-08T03:00:00.000000000', '2016-12-08T03:15:00.000000000',
       '2016-12-08T03:30:00.000000000', '2016-12-08T03:45:00.000000000',
       '2016-12-08T04:00:00.000000000', '2016-12-08T04:15:00.000000000',
       '2016-12-08T04:30:00.000000000', '2016-12-08T04:45:00.000000000',
       '2016-12-08T05:00:00.000000000', '2016-12-08T05:15:00.000000000',
       '2016-12-08T05:30:00.000000000', '2016-12-08T05:45:00.000000000',
       '2016-12-08T06:00:00.000000000', '2016-12-08T06:15:00.000000000',
       '2016-12-08T06:30:00.000000000', '2016-12-08T06:45:00.000000000',
       '2016-12-08T07:00:00.000000000', '2016-12-08T07:15:00.000000000',
       '2016-12-08T07:30:00.000000000', '2016-12-08T22:00:00.000000000',
       '2016-12-08T22:15:00.000000000', '2016-12-08T22:30:00.000000000',
       '2016-12-08T22:45:00.000000000', '2016-12-08T23:00:00.000000000',
       '2016-12-08T23:15:00.000000000', '2016-12-08T23:30:00.000000000',
       '2016-12-08T23:45:00.000000000', '2016-12-09T00:00:00.000000000',
       '2016-12-09T00:15:00.000000000', '2016-12-09T00:30:00.000000000',
       '2016-12-09T00:45:00.000000000', '2016-12-09T01:00:00.000000000',
       '2016-12-09T01:15:00.000000000', '2016-12-09T01:30:00.000000000',
       '2016-12-09T01:45:00.000000000', '2016-12-09T02:00:00.000000000',
       '2016-12-09T02:15:00.000000000', '2016-12-09T02:30:00.000000000',
       '2016-12-09T02:45:00.000000000', '2016-12-09T03:00:00.000000000',
       '2016-12-09T03:15:00.000000000', '2016-12-09T03:30:00.000000000',
       '2016-12-09T03:45:00.000000000', '2016-12-09T04:00:00.000000000',
       '2016-12-09T04:15:00.000000000', '2016-12-09T04:30:00.000000000',
       '2016-12-09T04:45:00.000000000', '2016-12-09T05:00:00.000000000',
       '2016-12-09T05:15:00.000000000', '2016-12-09T05:30:00.000000000',
       '2016-12-09T05:45:00.000000000', '2016-12-09T06:00:00.000000000',
       '2016-12-09T06:15:00.000000000', '2016-12-09T06:30:00.000000000',
       '2016-12-09T06:45:00.000000000', '2016-12-09T07:00:00.000000000',
       '2016-12-09T07:15:00.000000000', '2016-12-09T07:30:00.000000000',
       '2016-12-09T22:00:00.000000000', '2016-12-09T22:15:00.000000000',
       '2016-12-09T22:30:00.000000000', '2016-12-09T22:45:00.000000000',
       '2016-12-09T23:00:00.000000000', '2016-12-09T23:15:00.000000000',
       '2016-12-09T23:30:00.000000000', '2016-12-09T23:45:00.000000000',
       '2016-12-10T00:00:00.000000000', '2016-12-10T00:15:00.000000000',
       '2016-12-10T00:30:00.000000000', '2016-12-10T00:45:00.000000000',
       '2016-12-10T01:00:00.000000000', '2016-12-10T01:15:00.000000000',
       '2016-12-10T01:30:00.000000000', '2016-12-10T01:45:00.000000000',
       '2016-12-10T02:00:00.000000000', '2016-12-10T02:15:00.000000000',
       '2016-12-10T02:30:00.000000000', '2016-12-10T02:45:00.000000000',
       '2016-12-10T03:00:00.000000000', '2016-12-10T03:15:00.000000000',
       '2016-12-10T03:30:00.000000000', '2016-12-10T03:45:00.000000000',
       '2016-12-10T04:00:00.000000000', '2016-12-10T04:15:00.000000000',
       '2016-12-10T04:30:00.000000000', '2016-12-10T04:45:00.000000000',
       '2016-12-10T05:00:00.000000000', '2016-12-10T05:15:00.000000000',
       '2016-12-10T05:30:00.000000000', '2016-12-10T05:45:00.000000000',
       '2016-12-10T06:00:00.000000000', '2016-12-10T06:15:00.000000000',
       '2016-12-10T06:30:00.000000000', '2016-12-10T06:45:00.000000000',
       '2016-12-10T07:00:00.000000000', '2016-12-10T07:15:00.000000000',
       '2016-12-10T07:30:00.000000000'], dtype='datetime64[ns]')

In [51]:
df.loc[new_time[5],:].head()


Out[51]:
WVLGTH ET_SPCTRUM BEAM_NORMAL BEAM_NORM+ GLOB_HORIZ GLOBL_TILT
time
2016-12-01 08:00:00+09:00 300.0 0.5200 2.564000e-07 2.647000e-07 0.000024 0.000022
2016-12-01 08:00:00+09:00 302.0 0.5468 1.435000e-06 1.481000e-06 0.000077 0.000070
2016-12-01 08:00:00+09:00 304.0 0.5871 6.378000e-06 6.579000e-06 0.000219 0.000200
2016-12-01 08:00:00+09:00 306.0 0.6154 2.330000e-05 2.402000e-05 0.000577 0.000530
2016-12-01 08:00:00+09:00 308.0 0.6337 7.113000e-05 7.330000e-05 0.001376 0.001267

In [52]:
plot_df=df.loc[new_time[10],:]
plt.plot(plot_df['WVLGTH'],plot_df['GLOB_HORIZ'])


Out[52]:
[<matplotlib.lines.Line2D at 0x10c339c50>]

In [53]:
eta_array=[]
test_cell=fourj_cell
for t in new_time:
    time_spec=df.loc[t,:]
    spec_d=spec_data_to_spec_class(time_spec)
    ill=spec_d['direct_exp']
    test_cell.set_input_spectrum(ill)
    eta=test_cell.get_eta()
    eta_array.append(eta)

eta_array=np.array(eta_array)
plt.plot(new_time,eta_array)


Out[53]:
[<matplotlib.lines.Line2D at 0x10c3fcef0>]

In [54]:
eta_array=[]
test_cell=threej_cell
for t in new_time:
    time_spec=df.loc[t,:]
    spec_d=spec_data_to_spec_class(time_spec)
    ill=spec_d['direct_exp']
    test_cell.set_input_spectrum(ill)
    eta=test_cell.get_eta()
    eta_array.append(eta)

eta_array=np.array(eta_array)
plt.plot(new_time,eta_array)


Out[54]:
[<matplotlib.lines.Line2D at 0x10ceda9b0>]

In [55]:
eta_array=[]
test_cell=twoj_cell
for t in new_time:
    time_spec=df.loc[t,:]
    spec_d=spec_data_to_spec_class(time_spec)
    ill=spec_d['direct_exp']
    test_cell.set_input_spectrum(ill)
    eta=test_cell.get_eta()
    eta_array.append(eta)

eta_array=np.array(eta_array)
plt.plot(new_time,eta_array)


Out[55]:
[<matplotlib.lines.Line2D at 0x10ced7f28>]

In [56]:
eta_array=[]
test_cell=si_cell
for t in new_time:
    time_spec=df.loc[t,:]
    spec_d=spec_data_to_spec_class(time_spec)
    ill=spec_d['direct_exp']
    test_cell.set_input_spectrum(ill)
    eta=test_cell.get_eta()
    eta_array.append(eta)

eta_array=np.array(eta_array)
plt.plot(new_time,eta_array)


Out[56]:
[<matplotlib.lines.Line2D at 0x10d0a3fd0>]

In [ ]:


In [ ]: