User Guide For Monte Carlo Analysis

UserGuideForMonteCarloAnalysis

UserGuideForMonteCarloAnalysis

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 2

User Guide for Monte Carlo Analysis
Introduction
This application use a Monte Carlo analysis to calibrate Thorton and Running (TR) Rs
coefficients used in estimation of incident solar radiation using historic maximum, minimum and
dew point temperature and measure solar radiation. Intent of Monte Carlo Analysis is to
optimize estimation of the three coefficients (b0, b1, and b2).
This application has two modes: First, compute optimized B parameters for each station, export
them to an Excel workbook, and average them. If calibrating for a basin, place these parameters
into a TR equation and compare results with TR calculations that use standard parameters. This
process allows for determination of optimized TR Rs coefficients that are more accurate at
estimating Rs than standard coefficients for each basin.
Application can be configured two ways one that uses program specified data heading and
input units (C and MJ/m2/day) or user data headings, units
1
and other parameters from an
configuration (aka initialization) ini file.
Setup
1. Following is an inventory of files.
Application Manager(s)
run_solar_rad_opt.py or variation suited for given application
Code files
solar_radiation_opt.py
solar_config.py
emprso_w_tr.py
Data Files
Input time series file (text or workbook; see “RecordedMetData)
Optional ini file with user specifications
2. Place code files in a common folder. Manager(s), ini and time series files can be located
elsewhere. Code path, ini, and/or time series files need to be specified in manager(s).
3. Edit manager code for desired setup. Which arguments that need to be modified depend on if
an ini file is being using. If an ini file is being used, file_name specification is ini file;
otherwise it is time-series file. If using an ini file, time-series file is specified in ini file.
1
Default units are metric but user can specify English units. Internal and output units are always metric.
4. Set number of iterations by changing value of mc_iterations. Expect about 15 seconds of
runtime for every 1000 iterations. Experience has shown that a more consistent optimization
2
is
obtained with 20000 iteration.
Various manager setups and ini setups are included with application code.
Optimization
1. Ensure that comparison flag is set as:
comparison_flag = False
2. Run manger script. An analysis plot and “…log.txt” file are generated. In addition, if
save_flag is set to True, computed output are posted as a time series file.
3. Go into workspace and locate file with prefix same as time series file and ending with
"_Processed_Optimazation_log.txt" This output some iteration output, various statistics and
final Thorton and Running coefficients.
4. Run optimization for each station.
Comparisons
1. Place TR coefficients of individual stations into a workbook and compute their average.
Example workbook “MultiNode_OptTRResults” is provided.
2. Open emprso_w_tr.py and set values of b0, b1, and b2 arguments to averages of basin.
3. Set comparison_flag to True in an application manager.
4. Run manager.
5. Go into workspace and locate file with prefix same as time series file and ending with
"_Processed_Comparison_log.txt" This output some iteration output, various statistics and final
TR coefficients.
6. Post output into averaging workbook.
7. Repeat optimizations for each station
3
.
2
Because of randomness of Monte-Carlo process, the more iterations used the more repeatable results will be.
3
Optimization set can be done for an individual station.

Navigation menu