Closed dpinney closed 9 years ago
Task list massively updated.
Example cashflow curves for the 5 financing options:
AC clipping by the inverter example:
Remove all the fields in the image below.
How to set the value of those fields? Set as default values?
Yes, set as the PVwatts default. It should be the same as what's currently shown in the GUI.
Add a derating section to the input with all variables described in the wireframes document section "GOSED Wirefram for Performance Analysis".
Where is the GOSED wireframe fro performance analysis?
https://www.dropbox.com/s/49061mowkvzevul/3.%20GOSED%20Wireframes.docx?dl=0
Relevant part is the box labeled "Losses" with the variables "PV Module derate", etc.
Add an SREC cashflow. Input variable is a vector e.g. [10,10,10,10,5]. This becomes another cashflow on the cash flow chart.
What is SREC?
Solar Renewable Energy Credit. We just need to pass the input vector into the cash flow chart as a new series.
change heatmap z-axis unit to watts, and make it average over the given monthXhour bin.
What do you mean by changing it to watts? Just add watts there? And what the average processing? Is that the shading_mxh field?
We need to average instead of sum for each box on the heatmap. Adding a "Average kW" label to the legend would be good (nice-to-have).
Nameplate line disappears when system size is fractional. Change scaling to always include nameplate line.
Which nameplate you referrers to?
Not an issue. I can't reproduce the bug.
Can we send lat/lon as input to PVWatts? Right now we think the TMY2 file might be the only way to specify lat/lon.
Currently the answer is NO, there is no API for providing an alternative location besides weather file. But just as you mensioned , we can use zipcode, lat/lon location and TMY to find out the nearest location, or just as the latest version of pvwatts, we can provide a address interface. Efforts needed on that.
Let's create a new issue for this. David will log this.
Implement NPV and IRR.
Can you specify more about this?
NPV and IRR are functions that take cash flow vectors to scalars.
I've got an xls that calculates them: https://www.dropbox.com/s/lu3pkapm45o8tud/NPV%20of%20Solar%20Farm.xlsx?dl=0
Is the TMY3 data good? We need a python function that graphs the climate variables in a TMY3 or TMY2 file. And then we need to look at a bunch of them.
I know there is a software to convert TMY3 to TMY2.
I just mark them down, and we can discuss them through meeting.
David will log another issue for this.
My comments added to the above questions.
Solving the IRR costs too much, since the the equation has high power. Is there any simple approach to get it?
What's the python code you're currently using to calculate the IRR?
Oh my god real math IVE BEEN WAITING FOR THIS DAY. :neckbeard:
Solving a function like this:
from sympy import Eq, Symbol, solve
r = Symbol("r")
eqn = Eq(sum([outData["netCashFlow"][i]/(1+r)**i for i in range(30)]), 0)
res = solve(eqn)
I bet we can find a power series solution that we can do without sympy.
Give me a sec to do the algebra...
I feel obliged to find the result using Newton-Raphson. (Lol.) Sorry about just doing it in Python, I don't remember enough Latex to make this pretty.
''' snippet to calclate IRR. '''
# An example set of cashflows:
flows = [-20,10,10,10,10]
# The equation we want to find the roots of.
f = lambda r:sum([C/(1+r)**(1+i) for i, C in enumerate(flows)])
# The NR equivalence says we can calculate: r_n+1 = r_n - f(r_n)/f'(r_n)
# And we can do some calculus to get f'(r):
dfdr = lambda r:sum([(-i-1)*C/(1+r)**(i+2) for i, C in enumerate(flows)])
# Our r_0 guess:
rn = 0.01
# Now converge!
for step in range(100):
rn = rn - f(rn)/dfdr(rn)
print "IRR is", rn
# Test against what Excel comes up with:
excelIrr = 0.349034
print "We're off by ", 1-excelIrr/rn
I knew Newton's method, what a genius you are. :+1:
genius idiot.
numpy.irr
xlwt
package to dump data. I will follow the example here: https://github.com/python-excel/xlwt/blob/master/xlwt/examples/formulas.pyThanks, this is great progress.
SRECs: We should do SRECs as simply as possible. The HTML interface should have an input box labeled "SREC Cashflow" that the user types in a string like "5,5,5,3,2".
Then when the model is run, we interpret this as:
#EXAMPLE FOR SOLARFINANCIAL.PY
outData["srecCashFlow"] = map(float,inputDict.get("srecCashflow","").split(","))
# This should now be true (but only for this example):
assert outData["srecCashFlow"] == [5.0,5.0,5.0,3.0,2.0]
# And then we need to make sure this new cashflow is in the net:
outData["netCashFlow"] = [roundSig(x+y+z+a,2) for (x,y,z,a) in zip(outData["lifeGenerationDollars"], outData["lifeOmCosts"], outData["lifePurchaseCosts", outData["srecCashFlow"]])]
So what we're doing is adding another cashflow that represents money the PV owner gets from SRECs. Cashflow means how many dollars the owner gains or loses each year. But we're not calculating it--we're letting the user specify it. This is because SREC income is too complicated for us to calculate right now.
Excel: We should create the xls in the model directory when the model is run. Then the user can download it via a button in the model interface.
To get the file to the user, don't use S3. There's a way to do this with flask. I think what's needed is the send_from_directory function. But it might be easier to do what the CVR model used to do, which is base64 encode the file and insert it directly into the HTML. That way solarFinancial.py doesn't need to have flask code in it, and we don't have to put special logic in web.py.
Don't worry about getting the equations into the Excel. We can work on that much later.
Approach to serving static files from web.py:
@app.route("/downloadModelData/<owner>/<modelName>/<fileName>")
@flask_login.login_required
def downloadModelData(owner, modelName, fileName):
send_from_directory("data/"+owner+"/"+modelName, fileName)
pass # return a correct redirect here.
The actual download link would look like:
<a href="/downloadModelData/{{owner}}...
A few todos added. We're close to closing this.
Last todos finished. Tooltips waiting on #277.
TODO (IN PRIORITY ORDER)
Add option to set tilt manually. Change Tile = Latitude control to a true/false dropdown. Add a new box "Manual Tilt". Pass the variable in there to Pvwatts's tilt option. Tilt should be an integer. If tilt=latitude is set to false then we'll use the manual, otherwise.Change spelling of "degredation" to "degradation". It's in a bunch of places in the code.Take frontend percentage values in percentages, divide by 100 when actually running PVWatts. E.g. Annual degradation when user inputs should be 0.5 but then input to PVWatts should be 0.005. Also see inverter efficiency.Add a derating section to the input with all variables described in the wireframes document section "GOSED Wirefram for Performance Analysis".Upgrade OMF highcharts version to 4 and make sure all the other charts in the OMF work with 4 (they're currently using version 3).Note on azimuth degrees: "180 degrees equals due south." This should be in a tooltip. There is a separate tooltip issue.Remove all the fields in the image below.Change units on monthly system perf chart to "Energy (Wh-AC)". Make sure it's actually Wh and not some weird sum of Watts.Add "-AC" to all watt or Wh outputs.change heatmap z-axis unit to watts, and make it average over the given monthXhour bin.Make all the simulations run for 8760 hours. Start Jan 1. Remove all sim start date/length/lengthUnits variables.Nameplate line--rename it Nameplate (kWp-DC).Nameplate line disappears when system size is fractional. Change scaling to always include nameplate line.Rename input "retail energy cost..." to "energy value...".Add an SREC cashflow. Input variable is a vector e.g. [10,10,10,10,5]. This becomes another cashflow on the cash flow chart.Can we send lat/lon as input to PVWatts? Right now we think the TMY2 file might be the only way to specify lat/lon.Implement NPV and IRR.Add a map of site location to the outputs. Put dot where TMY data is from.Remove derate input separate from other derates.Remove wind stow speed input, take it to be infinite by default.Need axis labels on 24*12 output chart. Need legend for colors.HARD TODO LIST
We must do Excel export with some formulas and charts. How?Implement the ultimate location chooser. Remove TMY2 input. Add 3 new inputs: lat/lon pair, Zipcode, tmyManual. Radio button to mark choice. On backend, choose closest TMY2 site to marked input. Live map feedback of TMY and site.Investigate what Wind Stow Speed means.It's not relevant to us. See this comment for the full details.Is the TMY3 data good? We need a python function that graphs the climate variables in a TMY3 or TMY2 file. And then we need to look at a bunch of them.NICE TO HAVE FEATURES FOR LATER