// =================================================================== // Sun Safe LLC / sunsafepv.com ยท SAM check script v332 (Nov 24, 2026; values unchanged since v330) // Example: the balcony system, Denver, Colorado // Bright Saver 180 W kit: 1 x 180 W panel, 360 VA microinverter, // panel upright (90 deg) on the balcony rail, facing 178 deg (south). // // Made for NREL's System Advisor Model (SAM) 2026.7.3 or later. // HOW TO RUN: open SAM > File > Scripting > Open script... pick this // file > press Run (F5). SAM asks for a weather file: // - In the NSRDB download box, enter 39.73, -104.98 // and pick the TMY file (PSM V3, tmy-2020 or newer). // - Already have one? Cancel the box and pick your own CSV. // The script makes a new "PVWatts - Residential" case, fills in // every input below, runs it and shows the yearly kWh. // // What you should see (checked with SAM's engine, NSRDB cell 484137): // No extra shade ......... about 202 to 206 kWh per year // With Designer's 5 % shade about 198 to 202 kWh per year // Sun Safe Designer: 198.1 kWh (no extra shade), 194.0 kWh (5 % shade) // Nothing here is sent anywhere. Sun Safe never sees your files. // =================================================================== // ---- 1. Weather file (SAM's own NREL download box) ---------------- wf = nsrdbquery(); if (wf == "") { wf = choose_file("", "Pick a weather file (SAM CSV)", "CSV files (*.csv)|*.csv"); } if (wf == "") { msgbox("No weather file picked. Nothing was run."); exit; } // ---- 2. New case with the balcony system ------------------------------- create_case("PVWatts", "Residential", "Sun Safe check - balcony system, Denver v332"); set("use_specific_weather_file", 1); // without these two lines SAM set("user_specified_weather_file", wf); // quietly keeps its sample city set("solar_resource_file", wf); set("system_capacity", 0.18); // kW DC: one 180 W panel set("module_type", 0); // Standard set("array_type", 0); // Fixed - open rack (balcony rail) set("tilt", 90); // degrees: upright on the rail set("azimuth", 178); // degrees: 180 = due south set("dc_ac_ratio", 0.5); // 180 W DC / 360 VA inverter set("inv_eff", 96); // percent, PVWatts default set("bifaciality", 0); // one-sided panel // ---- 3. Run without extra shade (PVWatts default losses 14.08 %) -- set("losses", 14.08); m1 = ""; ok1 = simulate(m1, true); e1 = get("annual_energy"); // ---- 4. Run with the Designer's 5 % shade ------------------------- // PVWatts' 14.08 % already counts 3 % shade. Swap 3 % for 5 %: // 1 - (1 - 0.1408) x 0.95 / 0.97 = 15.85 % set("losses", 15.85); m2 = ""; ok2 = simulate(m2, true); e2 = get("annual_energy"); msgbox("Sun Safe check v332 - balcony system, Denver\n\n" + "Weather file: " + wf + "\n\n" + "No extra shade: " + (round(e1 * 10) / 10) + " kWh/yr (Designer 198.1)\n" + "With 5 % shade: " + (round(e2 * 10) / 10) + " kWh/yr (Designer 194.0)\n\n" + "The Designer is built to land within -3.8 % to +2.6 % of PVWatts.\n" + "Case left at 5 % shade. Change 'losses' on the Losses page to rerun.");