### PySAM Installation and Getting Started Source: https://nrel-pysam.readthedocs.io/en/main/index Guides on how to install PySAM via PyPI and provides examples for building models from SAM or defaults. ```python # Installation via PyPI # pip install PySAM # Example 1: Build a Model from SAM # ... code to build model from SAM ... # Example 2: Build a Model from Defaults # ... code to build model from defaults ... ``` -------------------------------- ### PySAM Getting Started Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/6.0 A guide to help users begin using PySAM, likely covering basic model instantiation and execution. ```python # Example: Import a PySAM model from PySAM.Pvwattsv8 import Pvwattsv8 # Instantiate a model system = Pvwattsv8() # Set parameters (example) system.SystemOutput.ac_annual_gross_energy = 10000 # Run the model system.execute() # Get results (example) annual_energy = system.SystemOutput.ac_annual_net_energy ``` -------------------------------- ### PySAM Installation and Usage Guide Source: https://nrel-pysam.readthedocs.io/en/main/sam-configurations Provides guidance on installing PySAM and getting started with its usage. Covers basic setup and initial steps for users. ```python # Installation instructions would typically be here, e.g.: # pip install nrel-pysam # Getting started examples would follow, demonstrating basic usage. ``` -------------------------------- ### Example 2: Build a Model from Defaults Source: https://nrel-pysam.readthedocs.io/en/main/getting-started This example illustrates how to build a PySAM model directly from default configurations without needing to run SAM. While this method is quicker, it can make troubleshooting more challenging compared to exporting from SAM. ```python # This section describes the process, but no direct code snippet is provided in the input text. # Refer to the documentation for detailed code examples: # https://nrel-pysam.readthedocs.io/en/main/getting-started.html#example-2-build-a-model-from-defaults # https://nrel-pysam.readthedocs.io/en/main/defaults.html ``` -------------------------------- ### NREL-PySAM Getting Started Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/4.1 A guide to help new users begin using NREL-PySAM. It covers basic concepts and initial steps for modeling renewable energy systems. ```python # Example of initializing a model from PySAM.PySAM import PySAM # Initialize a PVWatts model system = PySAM.PVWatts() # Set input parameters system.SystemCapacity = 100 system.LandCost = 1000 # Run the model system.execute() ``` -------------------------------- ### Example 1: Build a PVWatts model in SAM and export inputs Source: https://nrel-pysam.readthedocs.io/en/main/getting-started This example demonstrates the recommended approach of building a PVWatts model within SAM and then exporting its inputs to be used in PySAM. This method facilitates easier troubleshooting and understanding of model configurations. ```python # This section describes the process, but no direct code snippet is provided in the input text. # Refer to the documentation for detailed code examples: # https://nrel-pysam.readthedocs.io/en/main/getting-started.html#create-a-pvwatts-model-in-sam # https://nrel-pysam.readthedocs.io/en/main/inputs-from-sam.html ``` -------------------------------- ### NREL-PySAM Installation Guide Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/4.1 Provides instructions on how to install the NREL-PySAM library. This typically involves using pip. ```python pip install nrel-pysam ``` -------------------------------- ### PySAM Pvwattsv8 Example Source: https://nrel-pysam.readthedocs.io/en/main/_sources/getting-started This snippet demonstrates how to create a PVWatts Single Owner configuration using PySAM. It initializes the Pvwattsv8 module with defaults, creates instances of related modules (Grid, Utilityrate5, Singleowner), sets a weather file, executes the modules, and prints the annual AC output and Net Present Value. ```python import os import PySAM.Pvwattsv8 as pv import PySAM.Grid as gr import PySAM.Utilityrate5 as ur import PySAM.Singleowner as so system_model = pv.default('PVWattsSingleOwner') grid_model = gr.from_existing(system_model, 'PVWattsSingleOwner') utilityrate_model = ur.from_existing(system_model, 'PVWattsSingleOwner') financial_model = so.from_existing(system_model, 'PVWattsSingleOwner') filename = os.path.expanduser('~') + '/SAM Downloaded Weather Files/denver_co_39.7385_-104.985_psm3-tmy_60_tmy.csv' system_model.SolarResource.solar_resource_file = filename system_model.execute() grid_model.execute() utilityrate_model.execute() financial_model.execute() print( 'Annual AC Output in Year 1 = {:,.3f} kWh'.format( system_model.Outputs.ac_annual ) ) print( 'Net Present Value = ${:,.2f}'.format(financial_model.Outputs.project_return_aftertax_npv) ) ``` -------------------------------- ### Run PySAM Pvwattsv8 Module with JSON Inputs Source: https://nrel-pysam.readthedocs.io/en/main/getting-started This Python script demonstrates how to create a Pvwattsv8 model instance, load inputs from a JSON file, set module values, execute the simulation, and print the results. It requires the PySAM library and a JSON file containing model inputs. ```python import json import PySAM.Pvwattsv8 as pv # import the PVWatts module from PySAM # create a new instance of the Pvwattsv8 module pv_model = pv.new() # get the inputs from the JSON file with open( 'untitled_pvwattsv8.json', 'r') as f: pv_inputs = json.load( f ) # iterate through the input key-value pairs and set the module inputs for k, v in pv_inputs.items(): if k != 'number_inputs': pv_model.value(k, v) # run the module pv_model.execute() # print results print('Annual AC output for {capacity:,.2f} kW system is {output:,.0f} kWh.\n'.format(capacity = pv_model.value('system_capacity'), output = pv_model.Outputs.ac_annual) ) ``` -------------------------------- ### Run PVWatts Model with JSON Inputs and Vary Capacity Source: https://nrel-pysam.readthedocs.io/en/main/_sources/getting-started This Python script demonstrates how to load inputs from a JSON file exported from SAM, run the PySAM Pvwattsv8 module, and then re-run the module with a modified system capacity. It shows how to interact with PySAM modules, set input values, execute the model, and access output variables. ```python import json import PySAM.Pvwattsv8 as pv # import the PVWatts module from PySAM # create a new instance of the Pvwattsv8 module pv_model = pv.new() # get the inputs from the JSON file with open( 'untitled_pvwattsv8.json', 'r') as f: pv_inputs = json.load( f ) # iterate through the input key-value pairs and set the module inputs for k, v in pv_inputs.items(): if k != 'number_inputs': pv_model.value(k, v) # run the module pv_model.execute() # print results print('Annual AC output for {capacity:,.2f} kW system is {output:,.0f} kWh.\n'.format(capacity = pv_model.value('system_capacity'), output = pv_model.Outputs.ac_annual) ) # run PVWatts for a series of nameplate capacities capacities = [10, 100, 1000] for c in capacities: # change the value of the system_capacity input pv_model.value('system_capacity',c) # run the module pv_model.execute() # print some results ``` -------------------------------- ### PySAM Help Resources Source: https://nrel-pysam.readthedocs.io/en/main/getting-help This section details the various resources available for users seeking help with PySAM. It includes links to community forums, the SAM website for SDK information, PySAM-specific pages, the official documentation, the GitHub repository for source code and installation instructions, and the GitHub issues page for reporting bugs and providing feedback. ```APIDOC PySAM Help Resources: 1. SDK/PySAM forum on SAM website: URL: https://sam.nrel.gov/forum/forum-sdk.html Description: Search for existing answers or post new questions and answers. 2. SDK page on SAM website: URL: https://sam.nrel.gov/software-development-kit-sdk.html Description: Information about the SAM Software Development Kit (SDK), including the SAM Code Generator and SDKtool, with video demonstrations. 3. PySAM page on SAM website: URL: https://sam.nrel.gov/software-development-kit-sdk/pysam.html Description: High-level overview of PySAM with links to webinar recordings and supporting documents. 4. PySAM documentation: URL: https://nrel-pysam.readthedocs.io Description: Comprehensive documentation for PySAM. 5. PySAM GitHub repository: URL: https://github.com/NREL/pysam Description: Access the PySAM source code, including instructions for building and installing custom versions. 6. PySAM GitHub issues: URL: https://github.com/NREL/pysam/issues Description: Report bugs, suggest features, and provide feedback on PySAM documentation. ``` -------------------------------- ### Run PVWatts with Varying Capacities Source: https://nrel-pysam.readthedocs.io/en/main/getting-started This Python script demonstrates how to run the PVWatts model for a series of system nameplate capacities. It iterates through a list of capacities, updates the 'system_capacity' input for the PVWatts module, executes the model, and prints the annual AC output. This is useful for understanding how system size affects energy production. ```python importPySAM.Pvwattsv8 as pv capacities = [10, 100, 1000] for c in capacities: # change the value of the system_capacity input pv_model.value('system_capacity',c) # run the module pv_model.execute() # print some results print('Annual AC output for {capacity:,.2f} kW system is {output:,.0f} kWh.'.format(capacity = pv_model.value('system_capacity'), output = pv_model.Outputs.ac_annual) ) ``` -------------------------------- ### PySAM Installation Guide Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/6.0 Provides instructions on how to install the NREL-PySAM library. This typically involves using a package manager like pip. ```python pip install nrel-pysam ``` -------------------------------- ### NREL-PySAM Core Functionality Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/5.1 This section outlines the primary functionalities of NREL-PySAM, including installation, getting started with the library, and an overview of its capabilities. It serves as a starting point for new users. ```APIDOC Installing PySAM: - Instructions and prerequisites for installing the PySAM library. Getting Started: - A guide for new users to begin using PySAM, including basic examples and setup. PySAM Overview: - A high-level summary of PySAM's features, architecture, and its role in energy system modeling. ``` -------------------------------- ### First-time Setup for DAO-Tk PySAM Builds Source: https://nrel-pysam.readthedocs.io/en/main/pyssc-for-dao-tk Details on the initial setup required for building PySAM for DAO-Tk, covering both Windows and Linux environments. ```bash # General steps for first-time setup: # 1. Ensure necessary build tools are installed (e.g., C++ compiler, CMake). # 2. Clone the PySAM repository if building from source. # 3. Configure the build environment, potentially setting specific flags for DAO-Tk. # 4. Compile the library. ``` -------------------------------- ### PySAM SAM Configuration Examples Source: https://nrel-pysam.readthedocs.io/en/main/sam-configurations Demonstrates how to configure and run various SAM (System Advisor Model) technologies using PySAM. Includes examples for different financial models and system types. ```python # Example for Biomass Combustion – LCOE Calculator (FCR Method): # from PySAM.Biomass.Biomass import Biomass # biomass = Biomass() # biomass.BiomassCollection.lcoe_fcr_method = True # ... set other parameters ... # biomass.execute() # Example for PVWatts Wind Fuel Cell Battery Hybrid – Single Owner: # from PySAM.Hybrid.HybridPvWindBattery import HybridPvWindBattery # hybrid = HybridPvWindBattery() # hybrid.SystemOutput.system_capacity = 100 # ... set other parameters ... # hybrid.execute() ``` -------------------------------- ### Build PVWatts Single Owner Model from Defaults Source: https://nrel-pysam.readthedocs.io/en/main/getting-started This Python script shows how to build a complete PVWatts - Single Owner configuration using PySAM's default settings. It imports necessary compute modules, creates instances for PVWatts, Grid, Utility Rate, and Single Owner financial models, sets a weather file path, and executes the modules in the correct order. Finally, it prints key simulation results like Annual AC Output and Net Present Value. ```python importos importPySAM.Pvwattsv8aspv importPySAM.Gridasgr importPySAM.Utilityrate5asur importPySAM.Singleownerasso # create an instance of the Pvwattsv8 module with defaults from the PVWatts - Single Owner configuration system_model = pv.default('PVWattsSingleOwner') # create instances of the other modules with shared data from the PVwattsv8 module grid_model = gr.from_existing(system_model, 'PVWattsSingleOwner') utilityrate_model = ur.from_existing(system_model, 'PVWattsSingleOwner') financial_model = so.from_existing(system_model, 'PVWattsSingleOwner') # use weather file downloaded from SAM as "denver, co", you can replace this with a path to any valid weather file in the SAM CSV format filename = os.path.expanduser('~') + '/SAM Downloaded Weather Files/denver_co_39.7385_-104.985_psm3-tmy_60_tmy.csv' system_model.SolarResource.solar_resource_file = filename # run the modules in the correct order system_model.execute() grid_model.execute() utilityrate_model.execute() financial_model.execute() # display results print( 'Annual AC Output in Year 1 = {:,.3f} kWh'.format( system_model.Outputs.ac_annual ) ) print( 'Net Present Value = ${:,.2f}'.format(financial_model.Outputs.project_return_aftertax_npv) ) ``` -------------------------------- ### Subsequent Setup for DAO-Tk PySAM Builds Source: https://nrel-pysam.readthedocs.io/en/main/pyssc-for-dao-tk Instructions for setup after the initial build of PySAM for DAO-Tk, applicable to both Windows and Linux. ```bash # General steps for subsequent setup (after first-time): # 1. If modifications were made, recompile the necessary components. # 2. Ensure the Python environment is correctly configured to find the built PySAM library. # 3. Re-install if necessary using pip with the local build. ``` -------------------------------- ### Generate REopt API Inputs with PySAM Source: https://nrel-pysam.readthedocs.io/en/main/examples This example demonstrates how to prepare inputs for a REopt API call using PySAM. It shows the integration of PV and battery storage modules, including setting up the system, financial, and battery models, and utilizing the `Reopt_size_battery_post()` function to generate the necessary dictionary for the API. It also mentions the need for `Utilityrate5` and `Cashloan` modules for a complete model. ```python import PySAM.Utilityrate5 as ur import PySAM.Pvsamv1 as pvsam import PySAM.StandAloneBattery as stbt system_model = pvsam.default("FlatPlatePVCommercial") financial_model = ur.from_existing(system_model, "FlatPlatePVCommercial") battery_model = stbt.from_existing(system_model, "BatteryNone") # ReOpt requires lat/lon for downloading a weather file internally; custom weather files cannot be provided # so instead lat lon can be read from a weather file system_model.SolarResource.solar_resource_file = filename battery_model.Load.crit_load = [0] * 8760 post = system_model.Reopt_size_battery_post() ``` -------------------------------- ### PySAM Helper Tools and Examples Source: https://nrel-pysam.readthedocs.io/en/main/sam-configurations Details on helper functions and tools available in PySAM, along with code examples demonstrating various functionalities. Useful for advanced users and developers. ```python # Example of using a helper tool: # from PySAM.utils import get_pvwatts_defaults # defaults = get_pvwatts_defaults() # Code examples for specific use cases would be listed here. ``` -------------------------------- ### PySAM Code Examples Source: https://nrel-pysam.readthedocs.io/en/main/index Provides examples of using PySAM, including generating inputs for a REopt API call. ```python # Generate Inputs for a REopt API Call # ... code to generate REopt API inputs ... ``` -------------------------------- ### SixParsolve Initialization Examples Source: https://nrel-pysam.readthedocs.io/en/main/modules/SixParsolve Demonstrates how to initialize the SixParsolve module using different methods. ```python from PySAM.SixParsolve import SixParsolve # Load default configuration six_par_solve_default = SixParsolve.default() # Create from existing data (assuming 'existing_data' is defined) # six_par_solve_existing = SixParsolve.from_existing(existing_data) # Create a new instance six_par_solve_new = SixParsolve.new() # Wrap a PySSC data object (assuming 'ssc_data' is defined) # six_par_solve_wrapped = SixParsolve.wrap(ssc_data) ``` -------------------------------- ### Linux Docker Setup for PySAM Build Source: https://nrel-pysam.readthedocs.io/en/main/_sources/pyssc-for-dao-tk Instructions for setting up the Linux environment for PySAM builds using Docker. This involves installing Docker and pulling the manylinux1 container image. ```bash docker pull quay.io/pypa/manylinux1_x86_64 ``` -------------------------------- ### Install NREL-PySAM via PyPI Source: https://nrel-pysam.readthedocs.io/en/main/installation This command installs the NREL-PySAM package from the Python Package Index (PyPI). Ensure you have Python 3.8 to 3.13 installed. ```bash pip install nrel-pysam ``` -------------------------------- ### Install PySAM using pip Source: https://nrel-pysam.readthedocs.io/en/main/_sources/installation This command installs the PySAM library from the Python Package Index (PyPI). Ensure you have Python 3.8 or later installed. ```bash pip install nrel-pysam ``` -------------------------------- ### Belpe Module Initialization and Defaults Source: https://nrel-pysam.readthedocs.io/en/main/modules/Belpe Provides methods to initialize the Belpe module, load default configurations for various residential and third-party PV systems, and create new instances. ```python from PySAM.Belpe import Belpe # Load default configuration for a residential PV system belpe_instance = Belpe.default("FlatPlatePVResidential") # Create a new Belpe instance new_belpe_instance = Belpe.new() # Load data from an existing PySSC object # ssc_data = ... # Assume ssc_data is a valid PySSC data object # wrapped_belpe = Belpe.wrap(ssc_data) # Share data with an existing PySAM class # existing_data = ... # Assume existing_data is a dictionary or similar # belpe_from_existing = Belpe.from_existing(existing_data, "PVWattsResidential") ``` -------------------------------- ### Grid_PhotovoltaicWindBatteryHybridSingleOwner Total Installed Cost Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/6.0 Specifies the total installed cost for the Grid_PhotovoltaicWindBatteryHybridSingleOwner system. ```python ['total_installed_cost'] ``` -------------------------------- ### Windpower_PVWattsWindFuelCellBatteryHybridSingleOwner Total Installed Cost Source: https://nrel-pysam.readthedocs.io/en/main/version_changes/6.0 Specifies the total installed cost for the Windpower_PVWattsWindFuelCellBatteryHybridSingleOwner system. ```python ['total_installed_cost'] ``` -------------------------------- ### Total Installed Cost Source: https://nrel-pysam.readthedocs.io/en/main/modules/TcsmoltenSalt The total installed cost of the project in dollars. This output is a float. ```python total_installed_cost: float Total installed cost [$] ``` -------------------------------- ### Wfreader Initialization and Loading Source: https://nrel-pysam.readthedocs.io/en/main/modules/Wfreader Provides methods for initializing and loading Wfreader objects. This includes loading default configurations, creating instances from existing data, and wrapping PySSC data structures. Note that some inputs may require manual assignment of values. ```python PySAM.Wfreader.default(_config_) Load defaults for the configuration `config`. Available configurations are: * None PySAM.Wfreader.from_existing(_data_ , _optional config_) Share data with an existing PySAM class. If `optional config` is a valid configuration name, load the module’s defaults for that configuration. PySAM.Wfreader.new() Create a new Wfreader instance. PySAM.Wfreader.wrap(_ssc_data_t_) Load data from a PySSC object. Do not call PySSC.data_free on the ssc_data_t provided to `wrap()`. ``` -------------------------------- ### WindHybrid Class Initialization and Defaults Source: https://nrel-pysam.readthedocs.io/en/main/hybrids/WindHybrid Demonstrates how to create a new WindHybrid instance or load default configurations. The default method allows loading predefined settings for various hybrid system configurations. ```python from PySAM.Hybrids.WindHybrid import WindHybrid # Create a new instance wind_hybrid_instance = WindHybrid() # Load default configuration default_config = "PVWattsWindBatteryHybridHostDeveloper" wind_hybrid_instance_default = WindHybrid.default(default_config) ``` -------------------------------- ### Total Installed Cost Source: https://nrel-pysam.readthedocs.io/en/main/modules/TroughPhysical Reports the total installed cost of the project in US dollars ($). This is a float type output. ```python total_installed_cost = TroughPhysical.Outputs.total_installed_cost ``` -------------------------------- ### PVHybrid Class Initialization and Defaults Source: https://nrel-pysam.readthedocs.io/en/main/hybrids/PVHybrid Demonstrates how to initialize a PVHybrid system and load default configurations. The `new()` method creates an instance, while `default()` loads predefined settings for specific hybrid configurations like 'PhotovoltaicWindBatteryHybridHostDeveloper'. ```python from PySAM.Hybrids.PVHybrid import PVHybrid # Initialize a new PVHybrid system hybrid_system = PVHybrid.new() # Load default configuration for a specific system type defaults = PVHybrid.default("PhotovoltaicWindBatteryHybridHostDeveloper") ``` -------------------------------- ### Merchantplant Module Initialization and Methods Source: https://nrel-pysam.readthedocs.io/en/main/modules/Merchantplant Provides API documentation for the core Merchantplant class and its associated methods for creating, loading, and wrapping plant models. Includes details on interdependent variables. ```APIDOC PySAM.Merchantplant: default() Creates a default Merchantplant model. from_existing(filename, system_name='Merchantplant') Loads a Merchantplant model from an existing file. Parameters: filename (str): Path to the existing model file. system_name (str): The name of the system within the file (defaults to 'Merchantplant'). new(name='Merchantplant', **kwargs) Creates a new Merchantplant model with specified parameters. Parameters: name (str): The name for the new model (defaults to 'Merchantplant'). **kwargs: Additional parameters to initialize the model. wrap(system, **kwargs) Wraps an existing PySAM system object as a Merchantplant model. Parameters: system: The PySAM system object to wrap. **kwargs: Additional parameters to configure the wrapped model. Interdependent Variables: Details on how variables within the Merchantplant model relate to each other. ``` -------------------------------- ### Install DAO-Tk PySAM (Windows) Source: https://nrel-pysam.readthedocs.io/en/main/pyssc-for-dao-tk Steps to install the DAO-Tk version of PySAM in a fresh environment on Windows. ```bash # Example installation command for Windows # (Assumes a virtual environment is activated) pip install --no-cache-dir --force-reinstall --index-url https://pypi.org/simple/ --extra-index-url https://dspace.nrel.gov/mirror/pypi/simple pysam ``` -------------------------------- ### Communitysolar Module Initialization and Loading Source: https://nrel-pysam.readthedocs.io/en/main/modules/Communitysolar Provides methods for initializing and loading data into the Communitysolar module. This includes loading default configurations, creating new instances, and wrapping existing PySSC data. ```python PySAM.Communitysolar.default(_config_) Load defaults for the configuration `config`. Available configurations are: PVWattsCommunitySolar. PySAM.Communitysolar.from_existing(_data_ , _optional config_) Share data with an existing PySAM class. If `optional config` is a valid configuration name, load the module’s defaults for that configuration. PySAM.Communitysolar.new() Create a new instance of the Communitysolar module. PySAM.Communitysolar.wrap(_ssc_data_t_) Load data from a PySSC object. Warning: Do not call PySSC.data_free on the ssc_data_t provided to `wrap()`. ``` -------------------------------- ### Install DAO-Tk PySAM (Linux) Source: https://nrel-pysam.readthedocs.io/en/main/pyssc-for-dao-tk Steps to install the DAO-Tk version of PySAM in a fresh environment on Linux. ```bash # Example installation command for Linux # (Assumes a virtual environment is activated) pip install --no-cache-dir --force-reinstall --index-url https://pypi.org/simple/ --extra-index-url https://dspace.nrel.gov/mirror/pypi/simple pysam ``` -------------------------------- ### Install DAO-Tk Version of PySAM Source: https://nrel-pysam.readthedocs.io/en/main/_sources/pyssc-for-dao-tk This snippet shows how to install the DAO-Tk specific version of PySAM using Conda and pip. It involves creating a new Conda environment, activating it, and then installing the package using pip. This ensures the correct dependencies are met for the DAO-Tk version. ```bash conda create --name pysam_daotk python=3.7 -y ``` ```bash conda activate pysam_daotk ``` ```bash pip install nrel-pysam-dao-tk ``` -------------------------------- ### Install DAO-Tk PySAM Source: https://nrel-pysam.readthedocs.io/en/main/pyssc-for-dao-tk Steps to create a new Python environment and install the DAO-Tk version of PySAM and its stubs. ```python python=3.7 conda activate pysam_daotk pip install nrel-pysam-dao-tk nrel-pysam-dao-tk-stubs ``` -------------------------------- ### Merchantplant Module Initialization and Loading Source: https://nrel-pysam.readthedocs.io/en/main/modules/Merchantplant Provides methods for initializing and loading Merchantplant configurations. Includes loading defaults, creating new instances, and wrapping existing PySSC data. ```python PySAM.Merchantplant.default(_config_) Load defaults for the configuration `config`. Available configurations are: * _“BiopowerMerchantPlant”_ * _“CustomGenerationBatteryMerchantPlant”_ * _“CustomGenerationProfileMerchantPlant”_ * _“DSLFMerchantPlant”_ * _“EmpiricalTroughMerchantPlant”_ * _“FlatPlatePVMerchantPlant”_ * _“GenericCSPSystemMerchantPlant”_ * _“GeothermalPowerMerchantPlant”_ * _“HighXConcentratingPVMerchantPlant”_ * _“MSLFMerchantPlant”_ * _“MSPTMerchantPlant”_ * _“PVBatteryMerchantPlant”_ * _“PVWattsMerchantPlant”_ * _“PhysicalTroughMerchantPlant”_ * _“StandaloneBatteryMerchantPlant”_ * _“WindPowerMerchantPlant”_ PySAM.Merchantplant.from_existing(_data_ , _optional config_) Share data with an existing PySAM class. If `optional config` is a valid configuration name, load the module’s defaults for that configuration. PySAM.Merchantplant.new() Create a new Merchantplant instance. PySAM.Merchantplant.wrap(_ssc_data_t_) Load data from a PySSC object. Warning Do not call PySSC.data_free on the ssc_data_t provided to `wrap()` ``` -------------------------------- ### Pvwattsv5 Module Initialization and Data Loading Source: https://nrel-pysam.readthedocs.io/en/main/modules/Pvwattsv5 Provides methods to initialize the Pvwattsv5 model. This includes loading default configurations, creating new instances, and loading data from existing PySAM or PySSC objects. The `default` method loads predefined configurations, `from_existing` allows sharing data with other PySAM classes, `new` creates a fresh instance, and `wrap` loads data from a PySSC object. ```python PySAM.Pvwattsv5.default(_config_) Load defaults for the configuration `config`. Available configurations are: * None Note Some inputs do not have default values and may be assigned a value from the variable’s **Required** attribute. See variable attribute descriptions below. PySAM.Pvwattsv5.from_existing(_data_ , _optional config_) Share data with an existing PySAM class. If `optional config` is a valid configuration name, load the module’s defaults for that configuration. PySAM.Pvwattsv5.new() PySAM.Pvwattsv5.wrap(_ssc_data_t_) Load data from a PySSC object. Warning Do not call PySSC.data_free on the ssc_data_t provided to `wrap()` ``` -------------------------------- ### Create Photovoltaic Wind Battery Hybrid from Defaults Source: https://nrel-pysam.readthedocs.io/en/main/hybrids This example shows how to create a Photovoltaic Wind Battery hybrid system model from default configurations. It involves importing necessary PySAM modules, initializing the HybridSystem, loading default settings for a specific configuration, assigning weather resource files, executing the simulation, and then accessing outputs like annual energy production and NPV. This method is useful when you don't have SAM-generated inputs but want to use pre-defined system setups. ```python # get performance model for each subsystem importPySAM.Pvsamv1aspv_model importPySAM.Windpoweraswind_model importPySAM.Batteryasbattery_model # get function for managing hybrid variables and simulations fromPySAM.Hybrids.HybridSystemimport HybridSystem # create the hybrid system model using performance model names as defined by the import statements above # use the string 'hostdeveloper' or 'singleowner' for the financial model m = HybridSystem([pv_model, wind_model, battery_model], 'singleowner') # load defaults for the Photovoltaid Wind Battery Hybrid / Single Owner configuration m.default('PhotovoltaicWindBatteryHybridSingleOwner') # assign values to solar and wind resource files (these are not loaded with defaults) solar_resource_path = '/path-to-weather-file/your-solar-weather-file-goes-here.csv' wind_resource_path = '/path-to-weather-file/your-wind-weather-file-goes-here.csv' m.pv.SolarResource.solar_resource_file = solar_resource_path m.wind.Resource.wind_resource_filename = wind_resource_path # run a simulation print('running...') m.execute() # store some outputs # be careful to use the correct module names as defined by the HybridSystem() function: # pv, pvwatts, wind, custom, battery, fuelcell # _grid, singleowner, utilityrate5, host_developer pvannualenergy = m.pv.Outputs.annual_energy windannualenergy = m.wind.Outputs.annual_energy battrountripefficiency = m.battery.Outputs.average_battery_roundtrip_efficiency gridannualenergy = m._grid.SystemOutput.annual_energy npv = m.singleowner.Outputs.project_return_aftertax_npv # print outputs print(pvannualenergy) print(windannualenergy) print(battrountripefficiency) print(gridannualenergy) print(npv) ``` -------------------------------- ### MhkWave Initialization and Defaults Source: https://nrel-pysam.readthedocs.io/en/main/modules/MhkWave Provides methods for initializing and loading default configurations for the MhkWave module. The `default` method loads defaults based on a specified configuration name, while `from_existing` allows loading defaults from an existing PySAM class or a configuration name. The `new` method creates a new instance. ```python PySAM.MhkWave.default(_config_) Load defaults for the configuration `config`. Available configurations are: * _“MEwaveBatterySingleOwner”_ * _“MEwaveLCOECalculator”_ * _“MEwaveNone”_ * _“MEwaveSingleOwner”_ PySAM.MhkWave.from_existing(_data_ , _optional config_) Share data with an existing PySAM class. If `optional config` is a valid configuration name, load the module’s defaults for that configuration. PySAM.MhkWave.new() Create a new MhkWave instance. ``` -------------------------------- ### HybridSystem Initialization and Defaults Source: https://nrel-pysam.readthedocs.io/en/main/hybrids/HybridSystem Provides methods for creating and initializing a HybridSystem model. The `default` method allows setting up the system with predefined configurations for various hybrid energy system types. ```python from PySAM.Hybrids import HybridSystem # Create a new HybridSystem instance hybrid_system = HybridSystem.new() # Create a HybridSystem instance with default configurations # Available configurations include: # "CustomGenerationPVWattsWindFuelCellBatteryHybridHostDeveloper" # "CustomGenerationPVWattsWindFuelCellBatteryHybridSingleOwner" # "PVWattsWindBatteryHybridHostDeveloper" # "PVWattsWindBatteryHybridSingleOwner" # "PVWattsWindFuelCellBatteryHybridHostDeveloper" # "PVWattsWindFuelCellBatteryHybridSingleOwner" # "PhotovoltaicWindBatteryHybridHostDeveloper" # "PhotovoltaicWindBatteryHybridSingleOwner" hybrid_system_default = HybridSystem.default("PVWattsWindBatteryHybridHostDeveloper") ``` -------------------------------- ### Installing DAO-Tk PySAM Source: https://nrel-pysam.readthedocs.io/en/main/index Provides steps for installing the DAO-Tk version of PySAM in a fresh Python environment. This is useful for users who need this specific version for certain applications. ```bash python -m venv dao-tk-env source dao-tk-env/bin/activate pip install pysam[dao-tk] ``` -------------------------------- ### BatteryHybrid Class Initialization and Methods Source: https://nrel-pysam.readthedocs.io/en/main/_sources/hybrids/BatteryHybrid Provides documentation for the BatteryHybrid class, including its constructor, methods for loading default configurations, getting and setting values by name, assigning attributes from a dictionary, and exporting attributes. It also lists various system properties and references related sub-modules. ```APIDOC PySAM.Hybrids.BatteryHybrid.BatteryHybrid() Class that adds :mod:`PySAM.Battery.Battery` to :mod:`PySAM.Hybrids.HybridSystem.HybridSystem` new() -> BatteryHybrid Creates a new BatteryHybrid instance. default(config) -> BatteryHybrid Load defaults for the configuration config. Available configurations: "CustomGenerationPVWattsWindFuelCellBatteryHybridHostDeveloper" "CustomGenerationPVWattsWindFuelCellBatteryHybridSingleOwner" "PVWattsWindBatteryHybridHostDeveloper" "PVWattsWindBatteryHybridSingleOwner" "PVWattsWindFuelCellBatteryHybridHostDeveloper" "PVWattsWindFuelCellBatteryHybridSingleOwner" "PhotovoltaicWindBatteryHybridHostDeveloper" "PhotovoltaicWindBatteryHybridSingleOwner" value(name, value=None) -> None | float | dict | sequence | str Get or set by name a value in any of the variable groups. assign(input_dict) -> dict Assign attributes from nested dictionary, except for Outputs. Returns list of variables that weren't assigned. export() -> dict Export attributes into nested dictionary total_installed_cost: float Total installed cost for technology [$] om_fixed: sequence Fixed O&M annual amount [$/year] om_fixed_escal: float Fixed O&M escalation [%/year] om_production: sequence Production-based O&M amount [$/MWh] om_production_escal: float Production-based O&M escalation [%/year] om_capacity: sequence Capacity-based O&M amount [$/kWcap] om_capacity_escal: float Capacity-based O&M escalation [%/year] degradation: sequence Annual AC degradation [%]. If not provided, defaults to [0] Simulation: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Simulation` Lifetime: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Lifetime` BatterySystem: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatterySystem` SystemOutput: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.SystemOutput` Load: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Load` BatteryCell: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatteryCell` Inverter: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Inverter` BatteryDispatch: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatteryDispatch` Losses: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Losses` SystemCosts: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.SystemCosts` FuelCell: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.FuelCell` PriceSignal: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.PriceSignal` Revenue: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Revenue` ElectricityRates: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.ElectricityRates` GridLimits: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.GridLimits` Outputs: See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Outputs` Reopt_size_standalone_battery_post() ``` -------------------------------- ### PVHybrid Class Initialization and Configuration Source: https://nrel-pysam.readthedocs.io/en/main/_sources/hybrids/PVHybrid Provides methods for creating a new PVHybrid instance, loading default configurations, and accessing/modifying system parameters. ```python from PySAM.Hybrids.PVHybrid import PVHybrid # Create a new PVHybrid instance hybrid_system = PVHybrid() # Load default configuration for a specific system type default_config = "PhotovoltaicWindBatteryHybridHostDeveloper" hybrid_system.default(default_config) # Get or set a value by name # Example: Get the solar resource file path solar_file = hybrid_system.value('solar_resource_file') # Example: Set a value hybrid_system.value('system_capacity', 1000) ``` -------------------------------- ### Calculate Total Installed Cost Source: https://nrel-pysam.readthedocs.io/en/main/interdependent-variables This snippet demonstrates how to calculate the total installed cost by summing various cost components, including land cost adjusted by land area. ```python so.SystemCosts.total_installed_cost = cost_without_land + y * land_area ``` -------------------------------- ### Pvsandiainv Module Initialization and Data Loading Source: https://nrel-pysam.readthedocs.io/en/main/modules/Pvsandiainv Provides methods to initialize the Pvsandiainv module. This includes loading default configurations, creating instances from existing data, and wrapping PySSC data structures. Note that some inputs may require manual assignment of values. ```APIDOC PySAM.Pvsandiainv.default(_config_) Loads default configurations for the Pvsandiainv module. Parameters: _config_: Configuration name (e.g., 'None'). Returns: An instance of Pvsandiainv with default settings. PySAM.Pvsandiainv.from_existing(_data_, _optional config_) Shares data with an existing PySAM class and optionally loads defaults. Parameters: _data_: Existing data to share. _optional config_: Optional configuration name to load defaults. Returns: An instance of Pvsandiainv with shared data. PySAM.Pvsandiainv.new() Creates a new instance of the Pvsandiainv module. Returns: A new, empty instance of Pvsandiainv. PySAM.Pvsandiainv.wrap(_ssc_data_t_) Loads data from a PySSC object. Parameters: _ssc_data_t_: The PySSC data structure to wrap. Warning: Do not call PySSC.data_free on the ssc_data_t provided to wrap(). Returns: An instance of Pvsandiainv wrapping the PySSC data. ``` -------------------------------- ### PvGetShadeLossMpp Module Methods Source: https://nrel-pysam.readthedocs.io/en/main/modules/PvGetShadeLossMpp Provides methods to interact with the PvGetShadeLossMpp module. This includes loading default configurations, initializing from existing data, creating new instances, and wrapping PySSC data. ```APIDOC PvGetShadeLossMpp: default(_config_) Loads default configurations for the given config. Parameters: _config_: Available configurations (e.g., None). Returns: An instance of PvGetShadeLossMpp with default settings. from_existing(_data_, _optional config_) Shares data with an existing PySAM class. Parameters: _data_: Data to share. _optional config_: Optional configuration name to load defaults. Returns: An instance of PvGetShadeLossMpp initialized with provided data. new() Creates a new instance of PvGetShadeLossMpp. Returns: A new PvGetShadeLossMpp instance. wrap(_ssc_data_t_) Loads data from a PySSC object. Warning: Do not call PySSC.data_free on the ssc_data_t provided to wrap(). Parameters: _ssc_data_t_: The PySSC data structure to wrap. Returns: An instance of PvGetShadeLossMpp wrapping the PySSC data. ``` -------------------------------- ### PySAM WindObos Output Parameters Source: https://nrel-pysam.readthedocs.io/en/main/modules/WindObos This section details the various output parameters available from the PySAM WindObos module. Each parameter represents a specific metric related to the offshore wind farm's components and operations, such as fixed cable length, preparation time, free hanging cable length, mobilization/demobilization costs, mooring installation time, number of export cables, substructure and turbine counts per trip, soft costs, deck area, installation times for substructures and offshore substations, mass of substation piles and substructures, topside mass, installation costs for substations and substructures, floating system angle, and total costs/times for assembly, installation, development, electrical infrastructure, and engineering/management. All listed parameters are of type float. ```python fixCabLeng: Fixed Cable Length [m] Type: _float_ floatPrepTime: Floating Preparation Time [days] Type: _float_ freeCabLeng: Free Hanging Cable Length [m] Type: _float_ mob_demob_cost: Mobilization/Demobilization Cost [$] Type: _float_ moorTime: Mooring and Anchor System Installation Time [days] Type: _float_ nExpCab: Number of Export Cables Type: _float_ nSubPerTrip: Maximum Number of Substructures per Vessel Trip Type: _float_ nTurbPerTrip: Maximum Number of Turbines per Vessel Trip Type: _float_ soft_costs: Soft Costs [$] Type: _float_ subDeckArea: Deck Area Required per Substructure [m^2] Type: _float_ subInstTime: Substructure Installation Time [days] Type: _float_ subsInstTime: Offshore Substation Installation Time [days] Type: _float_ subsPileM: Offshore Substation Jacket Piles Mass [tonne] Type: _float_ subsSubM: Offshore Substation Substructure Mass [tonne] Type: _float_ subsTopM: Substation Topside Mass [tonne] Type: _float_ substation_install_cost: Substation Installation Cost [$] Type: _float_ substructure_install_cost: Substructure Install Cost [$] Type: _float_ systAngle: Floating System Angle [degrees] Type: _float_ totAnICost: Total Assembly & Installation Cost [$] Type: _float_ totDevCost: Total Development Cost [$] Type: _float_ totElecCost: Total Electrical Infrastructure Cost [$] Type: _float_ totEnMCost: Total Engineering & Management Cost [$] Type: _float_ totInstTime: Total Installation Time [days] Type: _float_ ``` -------------------------------- ### HostDeveloper Class Methods Source: https://nrel-pysam.readthedocs.io/en/main/modules/HostDeveloper Provides methods for interacting with the HostDeveloper class, including loading default configurations, creating instances from existing data, and wrapping PySSC objects. These methods are essential for setting up and utilizing the HostDeveloper financial model. ```APIDOC PySAM.HostDeveloper.default(_config_) Loads default configuration values for the HostDeveloper module. Available configurations: CustomGenerationBatteryHostDeveloper, CustomGenerationProfileHostDeveloper, CustomGenerationPVWattsWindFuelCellBatteryHybridHostDeveloper, FlatPlatePVHostDeveloper, PVBatteryHostDeveloper, PVWattsBatteryHostDeveloper, PVWattsWindBatteryHybridHostDeveloper, PVWattsWindFuelCellBatteryHybridHostDeveloper, PVWattsHostDeveloper, PhotovoltaicWindBatteryHybridHostDeveloper, StandaloneBatteryHostDeveloper. Note: Some inputs may require values from the variable's Required attribute. PySAM.HostDeveloper.from_existing(_data_, _optional config_) Creates a HostDeveloper instance from existing data. Optionally loads default configurations if `config` is provided and valid. PySAM.HostDeveloper.new() Creates a new, empty HostDeveloper instance. PySAM.HostDeveloper.wrap(_ssc_data_t_) Loads data from a PySSC object into a HostDeveloper instance. Warning: Do not call PySSC.data_free on the provided ssc_data_t. ``` -------------------------------- ### Saleleaseback Module Methods Source: https://nrel-pysam.readthedocs.io/en/main/modules/Saleleaseback Provides access to the core methods for the Saleleaseback module, including initialization, creation from existing models, and wrapping existing instances. ```python from PySAM.Saleleaseback import default, from_existing, new, wrap # Example usage: # model = default() # model = from_existing('path/to/existing/model') # model = new() # model = wrap(some_object) ```