Pvsamv1 CEC Performance Model with User Entered Specifications Option and PySAM

  • pgilman
  • Topic Author
More
11 Dec 2024 10:56 #13677 by pgilman
Hi Jesus,

Thank you for sending the .sam file.

The UTF-8 error is being caused by trying to assign a value to a PySAM variable that does not exist.

The case in your SAM file uses the "PV-Battery / Residential" configuration, which is the same as PySAM's "PVBatteryResidential" configuration. As described in the PySAM documentation for that configuration , this configuration requires the following compute modules:

Belpe
Pvsamv1
Grid
Utilityrate5
Cashloan

When you run SAM's code generator for your .sam file, it generates several JSON files. This one contains inputs for all of the compute modules:

PV_Bat_CIEMAT.json

These contain inputs for each compute module:

PV_Bat_CIEMAT_belpe.json
PV_Bat_CIEMAT_cashloan.json
PV_Bat_CIEMAT_grid.json
PV_Bat_CIEMAT_pvsamv1.json
PV_Bat_CIEMAT_utilityrate5.json

Line 35 of your Python code 'with open(...' reads data from the "PV_Bat_CIEMAT.json" file that contains inputs for all of the compute modules (Belpe, Cashloan, Grid, Pvsamv1 and Utilityrate5).

Line 38 'pv_model=pv.new()' creates a new instance of a Pvsamv1 module.

The For loop starting in Line 43 'for k, v in ...' reads data from the JSON and attempts to assign values to the Pvsamv1 module. When it encounters a variable for Belpe, Cashloan, Grid, or Utilityrate5 it fails because the variable is not valid for Pvsamv1.

To fix this problem, Line 35 should open the "PV_Bat_CIEMAT_pvsamv1.json" file that only contains inputs for the Pvsamv1 module.

Best regards,
Paul.
 

Please Log in or Create an account to join the conversation.

  • jesus.polo@ciemat.es
More
11 Dec 2024 12:39 #13679 by jesus.polo@ciemat.es
Hi Paul

Thanks so much; I finally understood the working mode of the modules; OK I have to read individually the different modules for the objects created by each module; so in case of pv_model I have to read the parameters from the corresponding json file

Now it is clear

Thanks a lot again and best wishes

Jesus

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum