Skip to content

Commit ea2e33a

Browse files
committed
Add a scaling factor
1 parent 73057e8 commit ea2e33a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

switch_model/policies/wind_to_solar_ratio.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ def define_components(mod):
4747
within=NonNegativeReals
4848
)
4949

50+
# We use a scaling factor to improve the numerical properties
51+
# of the model.
52+
# Learn more by reading the documentation on Numerical Issues.
53+
# 1e-3 was picked since this value is normally on the order of GW instead of MW
54+
scaling_factor = 1e-3
5055
mod.wind_to_solar_ratio_const = Constraint(
5156
mod.PERIODS,
5257
rule=lambda m, p: Constraint.skip if m.wind_to_solar_ratio == 0 else (
53-
m.WindCapacity[p] == m.SolarCapacity[p] * m.wind_to_solar_ratio[p]
58+
m.WindCapacity[p] * scaling_factor == m.SolarCapacity[p] * m.wind_to_solar_ratio[p] * scaling_factor
5459
)
5560
)
5661

0 commit comments

Comments
 (0)