TcslinearFresnel pysam not working

  • SebaSAM
  • Topic Author
More
18 Oct 2023 16:06 #12569 by SebaSAM
TcslinearFresnel pysam not working was created by SebaSAM
Hello!

I am trying to make a simulation in pysam using the TcslinearFresnel module and I am having problems.
The problem is that it doesn´t matters what nameplate capacity do I put, or what Tou values or TES hours I put in the inputs, it doesn´t change the generation output, giving the same values all the time and wrong ones in my opinion.

This doesn´t happens to me using the PySAM.TroughPhysical or PySAM.TcsmoltenSalt modules, and I haven't found much information on fresnel.


The code is the next one:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math
import csv
get_ipython().run_line_magic('matplotlib', 'inline')

import PySAM.TcslinearFresnel as tcf
system_model_fresnel = tcf.default('DSLFSingleOwner')

S_M=2.5
tshours=14

system_model_fresnel.Weather.file_name="CollahuasiCSV.csv"


#Capacidad máxima de la turbina kW
Nameplate_capacity=5500
system_model_fresnel.LinearFresnelr.system_capacity=Nameplate_capacity

#Horas de TES
system_model_fresnel.Solarfield.tes_hours=tshours
#Solar Multiple
system_model_fresnel.Solarfield.solarm=S_M

# **LinearFresnel TouTranslator Group**

Lista_4 = [[9] * 24 for _ in range(12)]
Lista_4pd=pd.DataFrame(Lista_4)


#Tou:Time of use

system_model_fresnel.TouTranslator.weekday_schedule=Lista_4pd.values.tolist()
system_model_fresnel.TouTranslator.weekend_schedule=Lista_4pd.values.tolist()

system_model_fresnel.execute()

system_model_fresnel.Outputs.gen

 

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

  • pgilman
More
19 Oct 2023 18:32 #12571 by pgilman
Replied by pgilman on topic TcslinearFresnel pysam not working
Hi Sebastian,

The variable 'P_ref' is equivalent to the "Reference output electric power at design condition" input on the Power Cycle page for the Molten Salt Linear Fresnel model. I think you should change that variable instead of 'system_capacity'.

The weekday and weekend schedules won't have an effect on the results if you don't also change the dispatch control inputs (see the Thermal Storage page in SAM to see what I mean). Those inputs have names like 'tslogic_a', 'tslogic_b', 'tslogic_c', and 'ffrac'. I recommend using the SAM code generator to see those variables in the JSON file as described here: nrel-pysam.readthedocs.io/en/main/inputs-from-sam.html

Best regards,
Paul.


 

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

  • SebaSAM
  • Topic Author
More
24 Oct 2023 14:29 - 25 Oct 2023 02:11 #12577 by SebaSAM
Replied by SebaSAM on topic TcslinearFresnel pysam not working
Dear Paul,

Thank you for the response! I've tried doing exactly what the link sent by you says and I have an AttributeError. The code is the next one:

import json
import PySAM.TcslinearFresnel as fsl
import PySAM.Grid as Grid
import PySAM.Utilityrate5 as UtilityRate
import PySAM.Cashloan as Cashloan

fr = fsl.new()
grid = Grid.from_existing(fr)
ur = UtilityRate.from_existing(fr)
cl = Cashloan.from_existing(fr)

dir = "C:/Users/seba_/Desktop/Tesis/Codigo Python/Fresnel/"
file_names = ["Fresnel_tcsMSLF","Fresnel_grid","Fresnel_utilityrate5","Fresnel_singleowner"]
modules = [fr, grid, ur, cl]

for f, m in zip(file_names, modules):
    with open(dir + f + ".json", 'r') as file:
        data = json.load(file)
        # loop through each key-value pair
        for k, v in data.items():
            if k != "number_inputs":
                m.value(k, v)


The file names are these ones:
 


And it gives me the next message:
Attachments:
Last edit: 25 Oct 2023 02:11 by pgilman. Reason: Pasting images into message does not work. Please attach image file and then insert into message.

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

  • pgilman
More
25 Oct 2023 02:14 #12583 by pgilman
Replied by pgilman on topic TcslinearFresnel pysam not working
Hi Sebastian,

Please attach images as files to your post and then insert them. Pasting the image into the editor does not always work.

I could not see the text of the error message. Please paste the text of the message into your post.

If you would like help troubleshooting, please attach a .zip file with your script and supporting files and I will see if I can help.

Best regards,
Paul.

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

  • SebaSAM
  • Topic Author
More
30 Oct 2023 14:45 - 07 Nov 2023 17:47 #12596 by SebaSAM
Replied by SebaSAM on topic TcslinearFresnel pysam not working
Dear Paul,

I attached the files in this post.
The error message is the follwing one:
 

File Attachment:

File Name: Fresnel.zip
File Size:7,920 KB
Last edit: 07 Nov 2023 17:47 by pgilman.

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

Moderators: pgilman
Powered by Kunena Forum