コード例 #1
0
    pm.check_increment([value[0], value[1]], key, min_failures=value[2])

# Compute QCI only using columns defined in the translation dictionary
mask = pm.mask
col = [item for sublist in pm.trans.values() for item in sublist]
QCI = pecos.metrics.qci(mask[col], pm.tfilter)

# Generate a performance model using observed POA, wind speed, and air temp.
# Remove data points that failed a previous quality control test before running the model (using 'mask').
# Check range on DC power relative error and normlized efficiency.
# Compute PV metrics.
poa = pm.df[pm.trans['POA']][mask[pm.trans['POA']]]
wind = pm.df[pm.trans['Wind Speed']][mask[pm.trans['Wind Speed']]]
temp = pm.df[pm.trans['Ambient Temperature']][mask[
    pm.trans['Ambient Temperature']]]
pv_metrics = pv_model.sapm(pm, poa, wind, temp, sapm_parameters, location)
metrics = pd.concat([QCI, pv_metrics], axis=1)

# Generate graphics
test_results_graphics = pecos.graphics.plot_test_results(
    pm.df, pm.test_results, pm.tfilter)
pm.df[pm.trans['DC Power']].plot(figsize=(7, 3.5))
plt.savefig('custom1.png', format='png', dpi=500)
pm.df[['Diffuse_Wm2_Avg', 'Direct_Wm2_Avg',
       'Global_Wm2_Avg']].plot(figsize=(7, 3.5))
plt.savefig('custom2.png', format='png', dpi=500)

# Write metrics, test results, and report files
pecos.io.write_metrics(metrics)
pecos.io.write_test_results(pm.test_results)
pecos.io.write_monitoring_report(
コード例 #2
0
ファイル: pv_example.py プロジェクト: sandialabs/pecos
for key, value in range_bounds.items():
    value[0] = pecos.utils.evaluate_string(value[0], specs=sapm_parameters)
    value[1] = pecos.utils.evaluate_string(value[1], specs=sapm_parameters)
    pm.check_range(value, key)

# Check increment
for key, value in increment_bounds.items():
    pm.check_increment([value[0], value[1]], key, min_failures=value[2])

# Compute QCI
QCI = pecos.metrics.qci(pm.mask, pm.tfilter)

# Run the SAPM and compute metrics. Remove data points that failed a previous
# quality control test before running the model (using pm.cleaned_data). Check range
# on DC power relative error and normalized efficiency. Compute PV metrics.
metrics = pv_model.sapm(pm, sapm_parameters, location)

# Add QCI to the metrics
metrics['QCI'] = QCI.mean()
metrics = pd.Series(metrics)

# Generate graphics
test_results_graphics = pecos.graphics.plot_test_results(
    pm.data, pm.test_results, pm.tfilter)
pm.data[pm.trans['DC Power']].plot(figsize=(7, 3.5))
plt.savefig('custom1.png', format='png', dpi=500)
pm.data[['Diffuse_Wm2_Avg', 'Direct_Wm2_Avg',
         'Global_Wm2_Avg']].plot(figsize=(7, 3.5))
plt.savefig('custom2.png', format='png', dpi=500)

# Write test results and report files
コード例 #3
0
ファイル: pv_example.py プロジェクト: cedricleroy/pecos
for key,value in increment_bounds.items():
    pm.check_increment([value[0], value[1]], key, min_failures=value[2]) 
    
# Compute QCI only using columns defined in the translation dictionary
mask = pm.get_test_results_mask()
col = [item for sublist in pm.trans.values() for item in sublist]
QCI = pecos.metrics.qci(mask[col], pm.tfilter)

# Generate a performance model using observed POA, wind speed, and air temp.
# Remove data points that failed a previous quality control test before running the model (using 'mask').
# Check range on DC power relative error and normlized efficiency.
# Compute PV metrics.  
poa = pm.df[pm.trans['POA']][mask[pm.trans['POA']]]
wind = pm.df[pm.trans['Wind Speed']][mask[pm.trans['Wind Speed']]]
temp = pm.df[pm.trans['Ambient Temperature']][mask[pm.trans['Ambient Temperature']]]
pv_metrics = pv_model.sapm(pm, poa, wind, temp, sapm_parameters, location)
metrics = pd.concat([QCI, pv_metrics], axis=1)

# Define output files and directories
results_directory = 'Results'
if not os.path.exists(results_directory):
    os.makedirs(results_directory)
graphics_file_rootname = os.path.join(results_directory, 'test_results')
custom_graphics_file_rootname = os.path.join(results_directory, 'custom')
metrics_file = os.path.join(results_directory, system_name + '_metrics.csv')
test_results_file = os.path.join(results_directory, system_name + '_test_results.csv')
report_file =  os.path.join(results_directory, system_name + '.html')

# Generate graphics
test_results_graphics = pecos.graphics.plot_test_results(graphics_file_rootname, pm)
custom_graphics = pv_graphics.graphics(custom_graphics_file_rootname, pm)