Is there a Scripting Language in Homer Pro to process "Results"?  

  RSS
(@thomasmerrill)
Active HOMER

All,

Is there a Scripting Language in Homer Pro to process "Results"

I need to Export a lot Tabular, Cash Flow Data for multiple Sensitivity/Optimization Cases.

Thanks,  Tom

 

 

ReplyQuote
Posted : April 13, 2017 1:06 pm
(@admin)
Noble HOMER Admin

There is not, however you can export your results as a CSV file and it can be helpful to sift through your results in a spreadsheet software like Excel.

- Andrew

ReplyQuote
Posted : April 13, 2017 2:59 pm
(@matthewsteen)
Trusted HOMER

@Tom Merrill,

I recommend Python as a scripting language for data analysis and manipulation and Jupyter (IPython) notebooks for writing and running code. Python is widely used for scientific computing and has many useful packages. See https://www.scipy.org/stackspec.html for the core ones, but also  https://salib.github.io/SALib/ for sensitivity analysis. In particular, I find Pandas and the "DataFrame.read_csv" method to be very useful. I've been using Python to generate inputs for HOMER and reformatting individual Simulation Results CSVs for viewing in DView ( https://beopt.nrel.gov/downloadDView).

ReplyQuote
Posted : June 20, 2017 1:15 pm
(@gabriel-oliveira)
Trusted HOMER

Nice Matt!

But, how does it effectively works? How do you perform sensitivity analysis from "outside" since the simulation engine runs "inside" Homer?

Do you have a script example on how to generate inputs for Homer?

Thank you!

ReplyQuote
Posted : June 23, 2017 2:50 pm
(@matthewsteen)
Trusted HOMER

I haven't used the SALib Python package and was merely pointing out some resources I know of for the original question. HOMER as you probably know has sensitivity variables for performing sensitivity analyses from "inside" (see http://www.homerenergy.com/support/docs/3.9/sensitivity_analysis.html).  

 

The Python module I wrote has several functions for extrapolating load or resource data that don't align with HOMER's timestep - e.g. daily peak load or annual daily hydro flow - into a format HOMER can use, which for my project's timestep of 60 min is a 1 column x 8760 row CSV file. Some of these can save time over creating these files manually (in Excel for example). 

 

I created a public GitHub repository for my HOMER scripts and will update it as I develop it and have time. 

ReplyQuote
Posted : June 23, 2017 3:53 pm
(@gabriel-oliveira)
Trusted HOMER

Matt,

I'm having trouble opening csv files exported from Homer in Dview. On file example is attached.

I get this message: "The selected file is not of the correct format, is corrupt, no longer exists, or you do not have permission to open it."

I  can open the same file in Excel or notepad.

Do you have any tip?

Thank you!

ReplyQuote
Posted : July 3, 2017 7:43 pm
(@matthewsteen)
Trusted HOMER

@Gabriel Oliveira,

 

The problem is the timestamp column, DView does not require one. Did you run my Python dview function on your simulation results CSV exported from HOMER? That should have deleted the timestamp column, which happens here:  https://github.com/MatthewSteen/homer/blob/master/homer.py#L98. If it didn't work, please send me the HOMER CSV file and/or open an issue for this on GitHub:  https://github.com/MatthewSteen/homer/issues.

 

Also, HOMER has a very nice built-in viewer for results that is comparable to DView. However, if you're sharing results, e.g. with clients, it's nice to have a free option that doesn't require a HOMER license. 

ReplyQuote
Posted : July 6, 2017 10:24 am
(@matthewsteen)
Trusted HOMER

Also, note that you're posting comments in the answer section.

ReplyQuote
Posted : July 6, 2017 10:30 am
(@gabriel-oliveira)
Trusted HOMER

Hi @Matt Steen

I'm trying to run your script with Spyder but I get this error:

>>> dview("C:\Users\Gabriel\OneDrive\Mestrado\Homer\Saidas\B-NM-N-Grid.csv")

  File "<stdin>", line 1

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

>>> 

 

The csv file is attached.

Any tip?

 

Thanks again

ReplyQuote
Posted : July 8, 2017 3:29 pm
(@matthewsteen)
Trusted HOMER

Single backslashes are interpreted as an escape character in Python strings. Try one of these:

 

1. Add an r at the beginning of the string:

dview(r"C:\Users\Gabriel\OneDrive\Mestrado\Homer\Saidas\B-NM-N-Grid.csv")

 

2. Add two backslashes to the path: 

dview("C:\\Users\\Gabriel\\OneDrive\\Mestrado\\Homer\\Saidas\\B-NM-N-Grid.csv")
ReplyQuote
Posted : July 11, 2017 11:25 am
(@gabriel-oliveira)
Trusted HOMER

Hello Matt, thank you for you help.

I managed to make it work using inverted backslashes.

ReplyQuote
Posted : July 22, 2017 6:28 pm
Share:
  
Working

Please Login or Register