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


1

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

 

 

 
0

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

 
0

@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).

 
0

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!

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. 

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

0

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!

@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. 

0

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

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")
0

Hello Matt, thank you for you help.

I managed to make it work using inverted backslashes.

 
  
Working

Please Login or Register