I have been happily using Julia for a year or so now after being a python user for many more years.
The only thing I am really missing is a substitute for pvlib. pvlib is a popular toolbox for photovoltaic systems modelling. Given all the other modelling tools available in Julia it seems like the perfect activity to do in Julia, yet nothing exists (as far as I have found).
Ofcourse I could use PyCall.jl or some other kind of glue layer but to the honest, the python package began development in 2013 by Sandia National Laboratories and even though it is still in active development its API feels quite dated.
So that brings me to my question. Is there any interest from the Julia community to build a new library for modelling solar systems in native Julia? I imagine (or hope) this is something many scientists and engineers working in energy would be interested in.
I checked out their repositories but I donāt see anything specific to photovoltaics modelling. However, given NRELās involvement with pvlib Iām sure they have thought about it.
I am more into wind energy, but writing something like pvlib in Julia should be straightforward. If you find a student who wants to do it I could supervise him or her (I am electrical engineer by training with a focus on renewable energies, now postdoc).
If youāre going to write a new library in this space, I would definitely try to make it differentiable by AD. (A colleague of mine supervised a student who did a differentiable PV simulator of this sort, albeit in Python; itās not that hard to set up if you plan for it from the beginning.)
Now that I finally have some time I have started the project here: PVSim.jl
At this point I am still laying out a plan for the package, I need to think about how Iām going to structure it.
More specifically I need to think about what the shortcomings and strengths of pvlib are, since thatās what it will be benchmarked against. I also want to fix all my annoyances with pvlib, like inconsistent data formats and API calls and lack of proper data handling tools. Data handling is a big thing and automating that part will be a huge time saver. Inspired by: https://github.com/pvlib/pvanalytics
I expect to make quite some mistakes, and I may even have to rewrite the whole thing once I have learned enough but thatās fine, it wouldnāt be the first time that has happened to me
I also take interest in PV modelling/simulation, even though my background is not in EE.
Not sure if thatās an issue, as I would have to cover some basic materials to get up to speed in PV sim., but I would like to join the quest in developing this package
Apart from PV itself, the data handling and AD aspects are also very interesting to me as they provide an opportunity to develop some Julia skills Iāve been wanting to tackle for a while.
Thanks for showing interest, I was beginning to think I was the only one haha.
Data handling will be done in a second package: PVData.jl
Right now there is not much to program yet. PV simulators are built on something called the model chain, which is a collection of modelling components required to go from irradiance to finally DC or AC power output. In between there are a million choices you can make, depending on the application.
This image (M.J. Mayer, 2021) shows all the steps really well I think:
Having built an energy efficient house, I used ESP-r as an open source building thermal modeling tool (written in Fortran). In that field they have done a lot of thinking about climate files, ie what kind of shading can you expect in your locale. These are based on the statistics of weather data for many years. ESP-r has one of a couple of standardized data files for this function.
And since I had the author of WATSUN as a professor in university, I canāt help but point you to it.
Both of these are primarily thermal simulation tools, which I as an ME am more excited about, but the solar insolation part is the same for both thermal and PV.
Interesting, thanks. My MSc thesis was about thermal modelling of buildings to enable energy flexibility of heat pumps, so I studied these kinds of models quite a bit.
This image (M.J. Mayer, 2021) shows all the steps really well I think:
Awesome! Not sure what else would have been more effective than a diagram like this for a newcomer to the field. Lots of room for modularization right up front btw.
A couple of questions (some for future discussion):
Do we expect to have many more components than the ones in the diagram?
If I understand correctly, these components would live in PVSim.jl while all other data-related operations would be implemented in PVData.jl. Should the actual simulation (components + data) be implemented inside PVSim.jl too or somewhere else?
Any suggestions on how/where can we start sketching some roadmap/feature list to get started with a basic prototype?
I want to make as much use of the Julia ecosystem as possible. For example we can build the cell model using MTK.
Yup! Thatās what I am thinking about right now. I like what DifferentialEquations.jl has done with how they packaged things, only import the solvers you need saves a lot of overhead. But such package level optimizations are probably best to do later down the line when there actually are choices.
No, this is it. All the model components should fit in one of these light blue boxes. The green box is what PVData.jl is responsible for. I will try to make a better image to explain what I mean.
One thing I especially want to prioritize is system modularity. This is one of the main problems with PVLib, there is no good separation between DC and AC domains. For example I tried making a setup in PVLib which had DC optimizers, like solaredge systems have. That was not possible. I want to be able to drop in an inverter wherever I see fit. I want parellel setups, series setups, DC optimizers, AC optimizers, string optimizers, I have seen all these combinations in the field.
All data related operations should remain in PVData.jl. The simulation in PVSim.jl should just take a dataframe with the right columns, it will not care where that dataframe came from. I think thatās the best way to completely decouple the data operations and simulation domains.
Let me get some basic stuff working first. I am trying to merge the thermal diode component into MTK so I can build the solar panel model. The PV panel model will be based on the single diode model, which is ubiquitous in PV literature and industry (see image below, from Cordeiro 2023). It is important to use this model because solar PV manufacturers provide parameter values for them.
This is super easy to build in ModelingToolkit.jl but we are still missing the diode. Once we have a solar panel model, we can start adding all the other modelling components and it will really start to take shape. The amazing thing about using MTK is now that I can just put an electric port and a thermal port on my solar panel model and I have full modularity in how I connect those to the rest of the system.
Hi @langestefan, Iām one of the maintainers of pvlib-python (kandersolar (Kevin Anderson) Ā· GitHub). Iām only a beginner julia programmer, but have quite some experience in PV modeling and writing PV simulation software, and have daydreamed about making a āpvlib.jlā for years. I made some small steps in that direction (solar position calculation, e.g.) some years ago, and perhaps that code could be reused here.
Anyway, I may be interested in collaborating. Would you be interested in having a call sometime to share ideas?
Great. I just added the diode with temperature dependent behaviour to the PR. Hopefully somebody at SciML can look at the PR soon but no rush. I added a few unit tests but this part will need some more thorough testing as everything else is derived from it. In the meantime I will implement the solar module/panel model.
I think itās too much to cover all of it. The parts about semiconductors are tough if you dont have an EE/physics background. Itās also not really necessary because weāre not simulation at the silicon level. I would focus on chapters 2, 4, 7 and 8.