Feature: added start of PV Solar design tools.

This commit is contained in:
Jeff MacKinnon 2026-02-18 12:37:49 -04:00
parent 0b360c9e0e
commit f893955616
3 changed files with 67 additions and 3 deletions

View file

@ -25,11 +25,12 @@ Currently the tools use the CEC, in most cases this will match the NEC, but some
# Future Features
- [x] Web app (this is started at [Digital Power Systems Toolbox](http://toolbox.digitalpowersystems.net))
- [x] Web app (this is started at [Digital Power Systems Toolbox](http://toolbox.digitalpowersystems.net)
- [x] Installable package [The first releases are here](https://git.jmkengineering.com/JMK_Engineering_Inc/JMKTools/releases)
- [ ] Add NEC to the calculations
- [ ] Re-do and add PV functions to the package.
- [x] Re-do and add PV functions to the package.
- [ ] Detailed documentation (the source is started in this repo)
- [ ] Electrical Safety Calculations
- [ ] Basic Load flow tools
- [ ] Basic Shortcircuit tools
- [ ] Basic Short circuit tools
- [ ] Continue developing the DPS Toolbox

View file

@ -1,6 +1,7 @@
from .circuits import *
from .general import *
from .grounding import *
from .pvsolar import *
from .tables import *
def main() -> None:

62
src/jmktools/pvsolar.py Normal file
View file

@ -0,0 +1,62 @@
'''
JMK Engineering Inc. Python Tools
by: Jeff MacKinnon
email: jeff@jmkengineering.com
PV Design functions
'''
def temp_adj_Voc(Voc,temp,beta=-0.5,STCtemp = 25):
'''
The Voc of a panel will increase as the temperature decreases.
The datasheet Voc is typically at STC, or 25C. As the temperature decreases this Voc needs to be adjusted.
This adjustment is linear based on the beta value with the units %/C.
This beta value will be shown as a negative indicating that as the temperature increases, then the Voc will decrease.
This Voc decrease results in derating of power during temperature above 25C.
Voc = The STC panel open circuit voltage
temp = The min or max temperature for the PV plant.
beta = The panel temperature coefficient. default -0.5%/C, typical values will range from -0.2 to -0.45.
The adjusted Voc is Voc minus the voltage shift. When the outside temperature is above the STC value then the Vocadj will be lower.
'''
tempadj = STCtemp - temp #-
percent_shift = tempadj * beta/100 #+
volt_shift = Voc * percent_shift
Vocadj = Voc - volt_shift # The voltage adjust is the
return Vocadj
def panels_per_string(Vmax,Voc,beta=-0.5,temp = 25,STCtemp = 25):
'''
This function calculates the maximum number of panels that a string can have.
It will automatically calculate the temperature shifted number when beta and temp are given.
'''
Vocadj = temp_adj_Voc(Voc, temp,beta, STCtemp = 25)
panels_per_string_max = Vmax // Vocadj
return int(panels_per_string_max)
def voltage_per_string(panels,Voc,beta=-0.5,temp = 25,STCtemp = 25):
'''
This function calculates the temperature adjusted string voltage based on the number of panels, open-circuit voltage (Voc).
By default it assumes a beta of -0.5, tem of 25C and a tested STCtemp of 25C.
'''
vocadj = temp_adj_Voc(Voc, temp,beta, STCtemp = 25)
voltage = vocadj * panels
return round(voltage,4)