-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adding the Loss Factors Model and Mechanistic Performance Models to PVLIB #925
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
Comments
@steve-ransome looking forward to hosting this function. Have you thought about the function's signature? What are the inputs, what is output? I should look at your PVSC paper again, refresh my memory, but Sandia is blocking your website. Would you mind sending it to me directly? |
Thanks Cliff. I've been writing Python code for myself and clients for a few years. I am not yet familiar with these collaborative efforts although I am learning. The python I added is just simple, sample code,to calculate some of the LFM coefficients and show my naming convention which allows variables to be identified as "reference, measured or normalised" and also "uncorrected or temperature corrected" (e.g. "nIsc_T") so need an idea if this is OK to use as the naming convention document just allows names like i_sc and v_oc. Basically the LFM function will transform measured values from an IV curve to normalised values Inputs Normalised Outputs The MPM function fits up to n=6 normalised coefficients to predict a normalised LFM output such as nIdc or nVoc nLFM = fn ( Gi, Tmod, WS, C1 .. Cn) I've been reading up on some of the coding examples such as the 1-diode model to get an idea of the sort of style used for comments, layout etc. and hope to follow that. Maybe if I follow https://www.python.org/dev/peps/pep-0362/ I can get you code that will be closer to what's needed, Here are my Chicago files uploaded - please tell me if you can get them 1906_PVSC46_Chicago_Ransome_ppt_Presented.pdf 1906_PVSC46_Chicago_Ransome.pdf Is anyone else blocked from www.steveransome,com ? Does Sandia give a reason why my website is blocked? Perhaps you could ask them to unblock it, or give me a reason why not I appreciate the amount of work you guys have done already over the years and will try to contribute as best as I can - even though I don't understand all the stuff mentioned in github. |
We can work through naming conventions for these new quantities with the pull request. It really helps to see the variables in context.
I don't think we are using PEP-362. By "signature" I only meant a list of inputs and outputs. I can get the files from here, thank you. www.steveransome.com is not blocked, but the links to the hosted files are blocked here. Hard to say why without a dozen phone calls. |
Thanks. Maybe I can send some code over in a few days where I've tried to follow everything and made clear when I can't achieve something (like naming) as it is. As it's Python it should be clear what it is I am trying to do but I do add comments too. You can see the basics from the first py file I sent |
I presented a virtual talk at "August 5, 2020 PVPMC Webinar on PV Performance Modeling Methods" "How to use the Loss Factors and Mechanistic Performance Models effectively with PVPMC/PVLIB" After receiving some positive feedback I'll soon be to be able to upload code as described in slides 15 and 16. What's the best way to go about this? I've followed as many of the hints and tips as I can find for coding, documentation and naming but I'm sure there will be changes needed I am not familiar with the procedures you've already been using and welcome suggestions and links. |
Hi Steve, This is very exciting and welcome news! Thank you for offering your contributions to pvlib! The best source of info would be the contributing section of the pvlib documentation. Here are the salient points:
Here are some more references to help you get started: |
Here are the additional notes where I left asterisks
|
Thanks @mikofski , I'll try that over the weekend, there's a lot to take in! |
Thanks @mikofski , I've been through all of your documentation but am still struggling to get this set up properly. I've used tortoisegit I've tried to add my mlfm files in a directory pvlib_python\pvlib\mlfm. There are a notebook (mlfm_pvpmc1.ipynb), library (mlfm_lib_1.py) then reference (ref, test and matrix.csv) and measurement files (*.csv) and a graphs directory where it automatically saves generated .png files. The ipynb and .py files have a lot of documentation. I've just put in the first couple of graphs and once it's working can update and add more. Please can anyone help let me know if this is OK or what else I should do. |
@pvlib/pvlib-maintainer @steve-ransome has sent me some refactored code for the module loss factor model (MLFM) that, with some attention to formatting and variable names, could be considered for pvlib-python. I'm soliciting your views on if/how it could be added. Summary: MLFM uses empirical expressions to predict normalized IV curves at irradiance and temperature conditions of interest. In this regard it is similar to the single diode models in pvlib (e.g. desoto). MLFM requires that the expressions be fit to input IV curve data. Arguments in favor:
Arguments against:
MLFM might also be considered for pvlib/pvanalytics but would be an entirely new dimension for that project. As far was where to put MLFM (assuming we agree it belongs in pvlib) I think a new code module in pvlib/ivtools makes most sense. |
I don't have any personal interest in using or maintaining MLFM code. I'll hazard a guess that requiring IV curve inputs is a prohibitive obstacle for the majority of pvlib users. I wouldn't stand in the way if someone else is interested in adding it though. If it doesn't seem like a good fit for |
[SRCL] [Cliff] [SRCL] I'm working on the formatting and variable names at the moment. I'm using the pvlib naming convention but will need to extend it [Cliff] [SRCL] The MLFM is a little closer to the SAPM approach than the single diode model in that it "predicts points from measurements, not a full IV curve". The SAPM doesn't use resistances r_sc (= -1/(di/dv)@v=0) or r_oc (= -1/(di/dv)@i=0) but the mlfm does as they can be important in finding losses and degradation due to r_shunt and r_series respectively. [Cliff] [SRCL] There's a lot of functionality in the MLFM regarding performance limitation identification (e.g. "rsc too low"), stability/degradation/astability etc. that I haven't seen in any other models [Cliff] [SRCL] what I've submitted so far hasn't linked to existing pvlib. [cliff] [SRCL] It predicts normalised points e.g. "meas_imp/ref_imp/poa_global_kwm2" and "meas_vmp/ref_vmp" rather than iv curves. [Cliff] [srcl] I don't have any comments [cliff] [srcl] I think that's a good idea. While I am getting all the non essential calculations coding out there must be some graphical stuff in a pvlib module, things like the stacked loss charts are too difficult for users to do for themselves each time. I'm attaching some graphs from my proposed tutorial to help demonstrate some of the capabilities. One graph shows a Gantner study with 6 points from IV curves, the others show 4 point studies from Marion's NREL dataset (without r_sc and r_oc) and an IEC 61853 indoor matrix test to prove useful information can be got without iv_curves. Please feel free to ask for more information as it can analyse measurements in ways other models don't seem to be able to do and does not require iv curves (although they give more information) |
I support adding MLFM provided that someone else is willing to be the primary maintainer. I am happy to help with python stuff but I don't want to commit to learning the nuances of a model right now. No concerns here over a need for PVSystem/ModelChain integration. |
Perhaps only certain base functions need to be in pvlib per se, and the graphical analysis could go into one or more example notebooks? |
Thanks for the comments. I'm happy to maintain the python code, however I would need help on any github, testing and decisions on library. I've had several useful comments from Cliff Hansen already and am trying to follow them all where possible. Here's a zip file with all the relevant mlfm code and 3 reference files, the html files show the output from running each file. Cliff suggested having different pandas data files e.g. meas[i_sc .. v_oc], norm[i_sc .. v_oc], stack[i_sc .. v_oc] rather than the way I had done it adding new columns to the same frame e.g. data[meas_i_sc .. meas_v_oc, norm_i_sc .. norm_v_oc, stack_i_sc .. stack_v_oc]. I can see the positives with doing this but I have problems when doing joins as I then have to rename several i_sc columns to have the correct prefix e.g. meas_ and norm_. Thanks Anton for your comment, that's basically what I am trying to do to keep as little mlfm specific code as possible in the py file, I can do simple graphics such as figs 6,7 and 8 by defining them in the ipynb tutorial, however figs 3 and 5 are far more complex and I wonder if there could be a library for more complicated graphics. I welcome all comments and suggestions! |
I agree that appending more and more columns to a DataFrame may not be the best way. If you do need to do joins, there are rsuffix and lsuffix arguments that will help to avoid column name conflicts. For overall code structure/organization, perhaps you can split your current py file into two: one with pure model functions (no matplotlib and no printing), and one with the rest. Perhaps that second file can then just be considered part of the example/tutorial. |
Thanks Anton. Will try to adopt all your suggestions. I had forgotten about the suffix options, they should work on the joins. |
I've rewritten the mlfm code now so it follows the helpful suggestions made. mlfm_lib_code_0_41.py
mlfm_lib_graphs_0_41.py
There are now three different dataframes : dmeas, dnorm and dstack There are three different measurement files and one for testing, as I've taken out the print statements this is selected by setting meas_file
This is the new version that replaces everything in version 04 I've included an html file showing how it looks running the 0Gantner data, Again, any thoughts or comments welcome. |
Time flies! I think this is better for sure, but I think we need some more guidance from the maintainers here. Is it close enough to have a PR? |
I think so. Python modules should be put into a new folder |
What's the next stage to get this going? If I move the python modules to pvlib.mlfm can someone do a PR? I had problems last time I tried and would appreciate some help. |
@steve-ransome the next step is a PR so all maintainers can review. What problems did you have? Git has a learning kerb, for sure. |
Thanks Cliff. I reported problems on 18 Aug 2020 further up this thread, I couldn't seem to understand what I was doing re github, tortoise git and the PR despite Mark's @mikofski instructions |
@steve-ransome my concern about creating the PR for you, is that someone will still need to use git to submit changes during the review. My workload is such that I don't think I can edit the PR to completion. |
Thanks Cliff. I will contact you as requested. |
I'll be adding the Loss Factors Models and Mechanistic Performance Models to PVLIB, .
See http://www.steveransome.com/PUBS/1906_PVSC46_Chicago_Ransome.pdf for more details on what they do
I hope it should be ready by the conference in Salt Lake in May
I've uploaded a couple of graphs and some sample code and Initially I'm looking for feedback and comments as I will need to enhance the present naming convention
With the LFM I have been using prefix and suffix letters to describe the type of measurement and any corrections. For example this Python 3 code shows the naming I have been using and does normalised LFM and temperature correction.
I have just shown nIsc and nVoc for clarity but will upload code for all variables soon plus graphs and MPM fits.
Once I have this in a correct form I can add more of features
MLFM_SRCL_200302.py.txt
Any feedback is welcome
Steve
The text was updated successfully, but these errors were encountered: