Thursday, January 13, 2011


PEPE started out as a simple LCOE calculator aimed at modeling the economics of German photoelectric systems. I already know what you're thinking. LCOE modelling party at my house? Boy if I had a nickel for all the LCOE modelling parties I've thrown... Sigh... Anyways, I found the economics of the German market relatively easy to simulate with the exception of their self-consumption incentive. The problem I had with the self-consumption incentive was that I couldn't track down much information about what the typical self-consumption rates were. This bugged me. I figured a reasonable way to tie up this issue would be to estimate hourly power production and compare this value against hourly power consumption. I knew this would be challenging but I thought I'd investigate what was out there. Some googling led to a photoelectric simulation program called PVFORM that was supposedly open source. I wrote letters off to all the usual suspects asking for a copy of the code and wouldn't you know it, the next thing I knew I had a copy of code. That was bitchin. After a few weeks I had broken apart the FORTRAN and transferred what I needed onto an excel spreadsheet. I didn't know any FORTRAN at the beginning of this process so that was a fun little adventure. My initial prototype had trouble running the Fuentes Thermal loop so I rewrote the code in VBA, yet another language I knew nothing about.

On the one hand the process was frustrating but on the other I was having fun tooling around and learning stuff. It's sorta like golf I guess. You don't need to be good at it to have fun playing it. But I digress... Somewhere along the way I started getting emails from the Intellectual Property people at Sandia (iPal). I had contacted them as part of my "Can I have a copy of PVFORM?" spam campaign. The exchange went something like this:

Me: I heard PVFORM is in the public domain. Can I have a copy.
iPal: PVFORM is not in the public domain. Sorry, we cannot give you a copy of the source code.
Me: No worries. I found a copy. I've already striped it apart and rewritten it.
iPal: Wait? What? Somebody screwed up by giving you that source code. My bosses are pissed. What do you plan to do with this work?
Me: I thought I might upload it into the internet machine.
iPal: You will need to get a license to distribute our program

Enter Dave Menicucci

Dr. Meniccuci: That program is 20+ years old and well passed its prime. Those guys are full of it. All the code you used has been repeatedly published.
Me: Would you mind talking to them?
Dr. Meniccuci: Sure.

Something, Something, Something...

iPal: We don't care if Dr. Menicucci is one of the original architects of the progam. He does not own the rights to PVFORM. We do.
Me: Fair enough but I don't want to sign these licensing papers you've sent me. I guess I just won't distribute your code then.
iPal: Please reconsider... You'll have to get a license if you want to distribute our code.
Me: What I'm saying is that I don't need your license because I won't be distributing your code. I'd rather build an entirely new model that doesn't use your code and distribute that on my own terms.

The exchange was unfortunate but that's just how life goes sometimes. By the end of all that emailing I had been studying photoelectric modeling for several months and already had a paper in mind that I could use to build a new model. This new model I was looking at described the workings of a popular photoelectric performance program (that's a lotta pees) called the Solar Advisor Model (SAM). Ironically enough, SAM just so happens to be "owned" by iPal. The key difference between copying PVFORM and copying SAM was that I could use the King et al. paper I had as an instruction guide. The important point here is that the mathematical equations in the paper aren't copyrightable material so if I used them to build the model they described I could publish/distribute that model without having to worry about getting permission from anybody. Bam... Lawyered.

After a few months of sporadic coding and increasingly less interesting debugging I've finally finished off a rough draft of PEPE. He's ready to be uploaded into the internet machine.

Remaining issues:

1. Find out or estimate what the boundary conditions are for sunrise and sunset hour calculations.
2. Refine the day angle, hour angle, declination, zenith, azimuth and incidence angle formulas such that the proper level of accuracy is achieved.

When I have the time (which I'm running short on at the moment) here are my plans to improve PEPE:

1. Add an optimization algorithm
2. Add an internal weather generator
3. Incorporate additional models for radiation, inverter performance etc. I specifically want to incorporate the 5-parameter model.
4. Break up the program into sub-routines
5. Move the Financial calculations into VBA
5. Decryptify the interface
7. I could keep going here. The primary reason it took me so long to get PEPE up to beta was that I was getting distracted by all these bells and whistles that I wanted to add in.

PEPE was not a one man project. I've been a translator of other people's work for the most part. I should be honest... for the whole part really. For their encouragement and technical assistance I have to thank all those who have helped with PEPE so far. They made it possible. They made it fun.

Chris Cameron
Chris Gueymard
Paul Gilman
Alfred K├Ârblein
Bill Marion
David Menicucci
Daryl Myers
Joshua Stein
Frank Vignola

No comments:

Post a Comment