The files below are intended to serve as examples to help you learn how to use different SAM features. The data in the files is fictitious, and not intended to represent costs or designs of any particular project or system.
The following script examples are for specific tasks you might want to include in your LK scripts and macros.
simulate()or parallel simulations
parsim(). Display simulation error messages when simulations fail. Works with a photovoltaic or CSP case. Weather files include a "broken" one with 8759 rows instead of 8760 to demonstrate simulation error reporting. Script (LK 4 KB), Sample weather files (ZIP 806 KB).
csvwrite()to work with CSV files (LK 3.6 KB)
dview()function to display time series data in the data viewer (ZIP 545 KB)
parout()to generate parametric values with Latin hypercube sampling for PV array tilt and azimuth inputs and run parallel simulations. Works with either a detailed photovoltaic or PVWatts case. (LK 1.72 KB)
plot()and related functions to create graphs and save graph image to file. Examples include line graph with two y axes, tornado-style graph, stacked bar chart, and changing thickness of line and scatter plots. (LK 2.71 KB)
plot()and related functions to create histograms. To use this sample script, download both the histplot.lk and histdata.csv files, and place them in the same folder on your computer. (LK 2 KB, CSV 3 KB)
6parsolvecompute module from an LK script in SAM to caclulate input parameters for the CEC module model from manufacturer data sheet parameters. (LK 1 KB)
The following files are files that you can import to SAM's photovoltaic shade calculator to learn how to use objects to create a three-dimensional representation of a photovoltaic array, buildings, and nearby shading objects.
The following files demonstrate two ways you can set the value of SAM inputs to values in an Excel file, or set the value of cells in Excel to values of SAM inputs.
Example using SAM's Excel Exchange feature. Download the Excel file and SAM file and put them in the same folder on your computer. Then open the SAM file, and run a simulation. See the note on the System Costs page in the SAM file and the Excel Exchange topic in SAM's help system for details:
Example using SAM's LK scripting language. Download the LK script along with the SAM file and Excel file above, and put all three files in the same folder on your computer. Then open the SAM file, and open the LK script from SAM's start menu: