Sample Files

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.

SAM files

  • Photovoltaic microinverter example (SAM 346 KB)
  • Parametric Quick Setup examples with explanatory notes (SAM 1.1 MB)

LK Script Cookbook

The following script examples are for specific tasks you might want to include in your LK scripts and macros.

  1. Work with the "Specify desired array size" and "Specify modules and inverters" sizing modes for the Detailed Photovoltaic model. (LK 4.6 KB)
  2. Convert an hourly weather file in SAM CSV format from hourly to 15-minute data by replicating the data in each hour for each of the four 15-minute time steps in the hour. (LK 1.37 KB)
  3. Work with solar resource data files. Use the use_specific_weather_file and user_specified_weather_file variables to either choose a file from SAM's built-in solar resource library, or to choose a file stored on disk. Also demonstrates how to use the choose_file() function to browse files on your computer (LK 3.4 KB).
  4. Convert SolarAnywhere file to SAM CSV format. Automatically detects whether the file is in the SolarAnywhere format, or SolarAnywhere TMY3 format. For files with historical data over a multi-year period, the script converts each year of data into a separate SAM CSV file and appends the year to the file name so that SAM's P50/P90 simulation feature will recognize the files (LK 13.5 KB)
  5. Run a set of simulations for multiple weather files using either sequential simulations 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).
  6. Calculate and display a table of monthly totals of hourly data, and define a function (LK 1.2 KB)
  7. Use csvread() and csvwrite() to work with CSV files (LK 3.6 KB)
  8. Run CSP power tower SolarPILOT heliostat field optimization from LK (LK 6 KB)
  9. Use the dview() function to display time series data in the data viewer (ZIP 545 KB)
  10. Use lhs()parsim() and 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)
  11. Use 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)
  12. Use plot() and related functions to create histograms. To use this sample script, download both the and histdata.csv files, and place them in the same folder on your computer. (LK 2 KB, CSV 3 KB)
  13. Run the 6parsolve compute module from an LK script in SAM to caclulate input parameters for the CEC module model from manufacturer data sheet parameters. (LK 1 KB)

3-D Shading Scenes

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.

Exchanging Data between SAM Inputs and Excel

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:

  • SAM file for Excel Exchange example (SAM 105 KB)
  • Excel file for Excel Exchange example (XLSX 55 KB)

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:

  • LK script demonstrating how to exchange data with an Excel file (LK 2 KB)

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer