-
Notifications
You must be signed in to change notification settings - Fork 38
make battery charge positive and add demand component to plm opt exam… #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for adding more subtests! This will definitely help with any future debugging of this example if it fails! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3027,4 +3027,11 @@ def test_plm_optimized_dispatch_example(subtests, temp_copy_of_example): | |
| with subtests.test("Check total energy charged"): | ||
| battery_charge = model.prob.get_val("battery.storage_electricity_charge", units="kW") | ||
| total_energy_charged = battery_charge.sum() * (1 / 60) # kWh, 1 min timestep | ||
| assert pytest.approx(total_energy_charged, rel=1e-3) == -2663.0 | ||
| assert pytest.approx(total_energy_charged, rel=1e-3) == 2663.0 | ||
|
|
||
| with subtests.test("Check energy balance with battery and grid"): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need more tests to make sure the wiring and energy balance is correct? Maybe this could be a follow on PR but this is good for #664. Examples I can think of: i) No grid purchase during discharge timesteps. ii) Grid purchase equals unmet demand |
||
| battery_charge_power_series = model.prob.get_val( | ||
| "battery.storage_electricity_charge", units="kW" | ||
| ) | ||
| grid_purchase_power_series = model.prob.get_val("grid_buy.electricity_out") | ||
| assert pytest.approx(battery_charge_power_series) == grid_purchase_power_series | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a feeling this will break things in Gen's tests as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this solution but I still think we should think about adding a new storage output rather than changing the existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this different from - [battery, electrical_load_demand, [electricity_out, electricity_in]]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
electricity_outfrom storage is negative when charging and positive when discharging. Meaning thatelectricity_into the demand component (which should be the electricity supplied to the demand component) would be positive and negative, which would increase theunmet_electricity_demand_outwould be greater than the total demand when the battery is charging. So, actually I do think that[battery, electrical_load_demand, [electricity_out, electricity_in]]would be a feasible solution!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh what I have in PR #664 based on @vijay092 suggestion.