Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pvsystemprofiler/algorithms/performance_model_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""


def find_fit_costheta(data_matrix, clear_index, doy):
def find_fit_costheta(data_matrix, clear_index, doy, solver="CLARABEL"):
"""
Fits a 'cos(theta)' curve to the given power, which is assumed to be smooth, yearly periodic, and symmetric around
the summer solstice. Previous versions of this function did not enforce the symmetric constraint.
Expand Down Expand Up @@ -35,15 +35,18 @@ def find_fit_costheta(data_matrix, clear_index, doy):
constraints.append(cvx.diff(x2, k=1) == z)
phi3 = 1e3 * cvx.sum_squares(cvx.diff(x3, k=2)) + 1e-6 * cvx.norm1(x3)
for val in set(solstice_centered_index(doy)):
constraints.append(cvx.diff(x3[solstice_centered_index(doy) == val]) == 0)
try:
constraints.append(cvx.diff(x3[solstice_centered_index(doy) == val]) == 0)
except ValueError:
pass
constraints.append(x3 <= 0)
phi4 = 1e3 * cvx.sum_squares(cvx.diff(x4, k=2)) + 1e-3 * cvx.sum_squares(x4)
constraints.append(x4[:-365] == x4[365:])
constraints.append(x4 <= 0)
objective = phi1 + phi2 + phi3 + phi4

problem = cvx.Problem(cvx.Minimize(objective), constraints)
problem.solve(solver="OSQP")
problem.solve(solver=solver)
normalized_data = data_matrix / np.exp(x2.value + x4.value)
costheta_est = x3.value
return normalized_data, costheta_est
Expand Down
2 changes: 1 addition & 1 deletion solardatatools/data_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ def score_data_set(self):
self.data_clearness_score = None
return

def clipping_check(self, solver="OSQP"):
def clipping_check(self, solver="CLARABEL"):
if self.clipping_analysis is None:
self.clipping_analysis = ClippingDetection()
self.clipping_analysis.check_clipping(
Expand Down
Loading