I have a project I'm trying to put into Python, but am not very strong with coding.
I have an array for sunset in local solar time, and want to use that to calculate an hourly load. I am given that the load runs from 2 hours before sunset until 10pm.
I'd like to set up an if statement that says if((sunset - 2) < hour < 22): then x calculation occurs. But it doesn't want to let me do that since sunset is an array.
days = np.arange (1, 366) #days to 365
day_no = np.repeat(days, 24)
declination = pv.declination(day_no)
sunrise, sunset = pv.sun_rise_set(latitude, declination, 0)
print('Local Solar Time of Sunrise and Sunset (24h): ', sunrise, sunset)
for idx, PV_Ah in enumerate(PV_Array_Ah):
day_number = np.floor(idx/24)
hour = (idx - day_number*24)
if ((sunset-2) < hour < 22):
load = (4*3 + 20)*.93
answer.append(load)
else:
load = 0
I'll also end up using my 'load' value in a plot, load on the y-axis vs every hour of the year on the x-axis.
How would I go about setting up the if statement for this calculation? And then recording the load in an array to plot?
Aucun commentaire:
Enregistrer un commentaire