Skip to content

Commit

Permalink
Merge branch 'develop' into gridRE-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hdunham committed Dec 20, 2024
2 parents 699abdd + 8510b03 commit 7bde370
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Classify the change according to the following categories:
### Fixed
- Make **ElectricTariff** **export_rate_beyond_net_metering_limit** and **wholesale_rate** with sub-hour time step work

## Develop
### Fixed
- Constrained export to grid in the NEM bin (`dvProductionToGrid"*_n)][t, :NEM, ts`) to be 0 when system is sized over NEM limit (i.e., when binNEM =0)

## v0.48.2
### Added
- Battery residual value if choosing replacement strategy for degradation
Expand Down
8 changes: 7 additions & 1 deletion src/constraints/electric_utility_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function add_export_constraints(m, p; _n="")
max_bene = sum([ld*rate for (ld,rate) in zip(p.s.electric_load.loads_kw, p.s.electric_tariff.export_rates[:NEM])])*p.pwf_e*p.hours_per_time_step*10
NEM_benefit = @variable(m, lower_bound = max_bene)


# If choosing to take advantage of NEM, must have total capacity less than net_metering_limit_kw
if solver_is_compatible_with_indicator_constraints(p.s.settings.solver_name)
@constraint(m,
Expand Down Expand Up @@ -92,13 +91,20 @@ function add_export_constraints(m, p; _n="")
}
)
@constraint(m, !binNEM => {NEM_benefit >= 0})
@constraint(m,[ts in p.time_steps_with_grid, t in p.techs_by_exportbin[:NEM]],
!binNEM => { m[Symbol("dvProductionToGrid"*_n)][t, :NEM, ts] == 0
}
)
else
@constraint(m,
NEM_benefit >= p.pwf_e * p.hours_per_time_step *
sum( sum(p.s.electric_tariff.export_rates[:NEM][ts] * m[Symbol("dvProductionToGrid"*_n)][t, :NEM, ts]
for t in p.techs_by_exportbin[:NEM]) for ts in p.time_steps)
)
@constraint(m, NEM_benefit >= max_bene * binNEM)
@constraint(m,[ts in p.time_steps_with_grid, t in p.techs_by_exportbin[:NEM]],
m[Symbol("dvProductionToGrid"*_n)][t, :NEM, ts] <= binNEM * sum(p.s.electric_load.loads_kw)
)
end

EXC_benefit = 0
Expand Down
10 changes: 9 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,15 @@ else # run HiGHS tests
m = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false))
results = run_reopt(m, d)
@test results["PV"]["size_kw"] 7440.0 atol=1e-3 #max benefit provides the upper bound


#case 3: net metering limit is exceeded, no WHL, and min RE %
d["ElectricTariff"]["wholesale_rate"] = 0
d["PV"]["min_kw"] = 50
d["Site"]["renewable_electricity_min_fraction"] = 0.35
m = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false))
results = run_reopt(m, d)
@test sum(results["PV"]["electric_to_grid_series_kw"]) 0.0 atol=1e-3
@test results["ElectricTariff"]["lifecycle_export_benefit_after_tax"] 0.0 atol=1e-3
end
end

Expand Down

0 comments on commit 7bde370

Please sign in to comment.