Samul guide Introduction to the SAM User Language National Renewable Energy Laboratory September Abstract The SAM User Language SamUL is a built-in scripting language that allows a user to automate tasks and perform more complex analyses directly from wit

Introduction to the SAM User Language National Renewable Energy Laboratory September Abstract The SAM User Language SamUL is a built-in scripting language that allows a user to automate tasks and perform more complex analyses directly from within SAM This guide assumes some rudimentary facility with basic programming concepts and familiarity with the SAM interface capabilities and general work ow The System Advisor Model SAM provides a consistent framework for analyzing and comparing system performance and costs across a wide range of renewable energy technologies and markets from residential photovoltaic systems to utility scale concentrating solar power plants System Advisor is based on an hourly simulation engine that interacts with performance cost and ?nance models to calculate energy output costs and cash ows including the e ?ect of incentives CContents Introduction Why use SamUL Entering a SamUL Script Hello world Why SamUL instead of VBA Data Variables General Syntax Variables Arithmetic Simple Input and Output Data Types and Conversion Special Characters Flow Control Comparison Operators Branching if Statements else Construct Multiple if Tests Single line ifs Looping while Loops Counter-driven Loops for Loops Loop Control Statements Quitting Arrays of Data Initializing and Indexing Array Length Processing Arrays Multidimensional Arrays Managing Array Storage Multiple Advance Declarations Functions Calls User Functions De ?nition Returning a Value Parameters Variable Scope Built-in SamUL Functions Input Output and System Access C Working with Text Files File System Functions Standard Dialogs Calling Other Programs Interfacing With SAM Analyses Getting Started Changing Input Values Simulating and Saving Output Batching Weather Files Library Reference Type Data Manipulation Input Output String Manipulation Math SAM Functions C Introduction Why use SamUL Suppose you are an energy analyst and your client asks for a custom map of the United States showing the levelized cost of energy LCOE at several hundred locations in the country for a speci ?c photovoltaic system Since you are familiar with the Solar Advisor Model and have access to weather data for all the requested locations the task falls to you to generate the LCOE values for the custom map With the PV system speci ?cations you succeed in setting up a ? base case ? simulation in SAM for one location You could run a SAM analysis for each weather ?le individually recording the results in a spreadsheet You could even set up many locations in a parametric simulation Either way would be tedious and error prone at best for several hundred iterations Even worse when your client decides to change even just one speci ?cation of the system you would have to start all over As others have done in the past you could extract the generated PV simulator setup ?les and write a program in C or Excel VBAScript to call the TRNSYS simulation engine that sits behind SAM to loop over the various weather ?les This too proves troublesome because if any speci ?cations change you would have to edit the complicated TRNSYS input ?les by hand Furthermore processing the large amounts of data

  • 27
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Aucune attribution requise
Partager
  • Détails
  • Publié le Fev 08, 2022
  • Catégorie Management
  • Langue French
  • Taille du fichier 114.1kB