Tess Broos
Tess Broos

Reputation: 1

PySAM: CEC performance model with user entered specifications

I'm working in PySAM by creating a model in SAM, then exporting the JSON for use as inputs in my PySAM model in Python. However, I'm encountering an issue when trying to define a custom PV module. Although the module_model is set to 2 (indicating it should take values from user-specified inputs), it still appears to be using specifications from the module database.

From the JSON file, I can confirm it is referencing the specified values. According to the documentation, setting module_model to 1 should pull values from the database, while setting it to 2 should utilize user-specified inputs. Despite setting module_model to 2, it seems to default to the database values.


# Assign values from the single JSON to the respective models    
for key, value in data.items():
    # Attempt to assign based on which model has the key
    assigned = False
    for model_name, model_instance in models.items():
        for group_name, group in model_instance.export().items():
            if key in group:
                setattr(getattr(model_instance, group_name), key, value)
                assigned = True
                break
        if assigned:
            break


Upvotes: 0

Views: 11

Answers (0)

Related Questions