Skip to content

Adding Mechanistic Performance and Loss Factors Models to pvlibMerge remote-tracking branch 'refs/remotes/pvlib/master' #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

steve-ransome
Copy link

@steve-ransome steve-ransome commented Aug 18, 2020

@codecov
Copy link

codecov bot commented Aug 18, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@8d56b2e). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1024   +/-   ##
=========================================
  Coverage          ?   95.61%           
=========================================
  Files             ?       67           
  Lines             ?     9037           
  Branches          ?        0           
=========================================
  Hits              ?     8641           
  Misses            ?      396           
  Partials          ?        0           
Flag Coverage Δ
#adder 95.61% <0.00%> (?)
#conda 95.61% <0.00%> (?)
#subtractor 95.61% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d56b2e...6c60dcc. Read the comment docs.

@mikofski
Copy link
Member

Hi @steve-ransome ,

Great job opening the PR. I've linked it to the original issue in the description above by using the issue number (925). Make sure to go through the rest of the items in the checklist.

Here are a couple of other items that will help move this PR:

  1. Can you please create a new branch and call it something like "loss-factor-model" ? You should do this at the HEAD of the branch that you're currently working on (which is currently master). I think you can use TortoiseGit by right clicking in the folder where your development version of pvlib is cloned. Remember to check the box that says, "check out new branch" or you'll still be on master and so you'll have to check out the new branch. You can also skip TortoiseGit and just enter the equivalent git commands in a terminal:

    (master) path/to/pvlib$ git checkout -b loss-factor-model
    
  2. Once you've checked out the new branch, push it up to your GitHub fork of pvlib python. Then you may need to edit this PR to point to the new branch, or just close it and open a new one from the new branch.

  3. You'll need to remove the desktop.ini file from your git repo and then ignore it. If it's important, you can just copy it somewhere else, then delete the file from the repo with TortoiseGit. The you can copy it back to your folder if it's important and ignore it using TortoiseGit. Just right click on the file and select ignore. This creates a new file in your folder called .gitignore. Right click on .gitignore and select Add. Then commit the changes to make them permanent. You can also use these git commands in a terminal:

    (loss-factor-model) path/to/pvlib$ git rm --cached desktop.ini
    (loss-factor-model) path/to/pvlib$ echo desktop.ini >> .gitignore
    (loss-factor-model) path/to/pvlib$ git add .gitignore
    (loss-factor-model) path/to/pvlib$ git commit -am "ignore desktop.ini"
    
  4. You need to remove all of the figures and add them either to a jupyter notebook or a gallery example. See the existing gallery examples as a guide. A Jupyter notebook might be easier. The Jupyter notebook should have the commands to call your code and create the figures. It would serve as an example or tutorial to new users.

  5. start working on the Stickler warnings that are in the checks above. The red X means that there are some style issues that don't follow the Python pep8 guidelines. If you run into issues, just post them here and we can help you through them.

I suggest you find someone in your timezone who you can have a chat / screen share with. Someone who has contributed to pvlib before like maybe @adriesse ?

Good luck!
Mark

@adriesse
Copy link
Member

Hi @steve-ransome and @mikofski ,

I don't think I'm the best person to the git/github mechanics, but before trying to please the various bots I would maybe first try to figure out how to integrate a little more into the pvlib structure. Ideally there would be some low-level model-related functions without graphics or user interaction, and then you could perhaps put the latter into a Jupyter Notebook? Not speaking as an expert here either because I rarely use Jupyter myself.

Anyway, it's good to get the ball rolling.

Anton

@steve-ransome
Copy link
Author

Thanks @mikofski and @adriesse for the help and advice.

The mlfm code explained in https://pvpmc.sandia.gov/download/7879/ was almost "self contained" in that it went from
raw measured inputs though normalisation, sanity checks, mlfm model fitting, parameter and degradation extraction and then showed performance and any degradation.

Most of the calculations, file handling and graphics are as python library functions in mlfm_lib.py rather than in the Jupyter notebook. These can be used independently such as the data normalisation routine e.g.

def mlfm_meas_to_norm (dref, dmeas, mod_row):
    ''' 
    converts 
    measured dataframe = meas(isc,rsc ... voc) (V,A,W,Ohms) 
    normalising by reference stc dataframe = ref(isc,rsc ... voc)
    to normalised value dataframe = norm(isc,rsc ... voc) (~1) 
    '''

In the Jupyter notenook the only operator inputs are

  1. what measurement datafile to read
  2. which mlfm parameter to analyse further.

Sensible defaults are given to some options (e.g. xaxis of graphs, irradiance or tmodule, yaxis scaling) and the user is shown how to alter those if they want.

The measurement data input, model curve fitting and power prediction side are most similar to the tmy_to_power tutorial so I can look at that approach to show how to use these lib functions, this table shows some of the similarity and maybe how best to get the mlfm code being compared and used

                                                    https://pvpmc.sandia.gov/download/7879/
                                                    slide 16
Stage                  tmy_to_power.ipynb           mlfm_pvpmc.ipynb
 
import met data        pvlib.iotools.read_tmy3      get_meas_filename() 
load stc data          pvlib.pvsystem.retrieve_sam  get_ref()
normalisation          n/a                          meas_to_norm()
model_fitting          e.g. pvusa                   mlfm_fit()
power_prediction       e.g. pvlib.pvsystem.sapm     mlfm()
                       power_pvusa
                       pvlib.pvsystem.singlediode
Loss and degradation   n/a

Any thoughts as to this approach?

@adriesse
Copy link
Member

Sorry, I didn't see the notebook previously as it is not listed as part of the PR. I wonder if it can be made viewable from the browser, like some others are?

It seems to make sense to go with the tutorial approach. Then the most important thing will be defining the low-level core functions. Reading your own file format is probably better placed within the tutorial portion, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding the Loss Factors Model and Mechanistic Performance Models to PVLIB
3 participants