Skip to content

Always force initial SOC = final SOC#495

Draft
hdunham wants to merge 4 commits intodevelopfrom
init-final-soc
Draft

Always force initial SOC = final SOC#495
hdunham wants to merge 4 commits intodevelopfrom
init-final-soc

Conversation

@hdunham
Copy link
Collaborator

@hdunham hdunham commented Apr 30, 2025

Code used to test off grid test expected value changes (the two results JSONs are before and after adding the init=final SOC constraint, but for a 1 to 1 comparison both are after removing land/area limits from the test post):

old = JSON.parsefile("./debug_offgrid_results1_old.json")
new = JSON.parsefile("./debug_offgrid_results1.json")
internal_efficiency_fraction = 0.975
inverter_efficiency_fraction = 0.96
rectifier_efficiency_fraction = 0.96
battery_RT_effic = internal_efficiency_fraction * inverter_efficiency_fraction * rectifier_efficiency_fraction
discharge_effic = inverter_efficiency_fraction * internal_efficiency_fraction^0.5
free_energy = old["ElectricStorage"]["size_kwh"] * (1 - old["ElectricStorage"]["soc_series_fraction"][8760]) * discharge_effic
old_pv_used = sum(old["PV"]["electric_to_load_series_kw"]) + sum(old["PV"]["electric_to_storage_series_kw"]) * battery_RT_effic
new_pv_used = sum(new["PV"]["electric_to_load_series_kw"]) + sum(new["PV"]["electric_to_storage_series_kw"]) * battery_RT_effic
old_gen_used = sum(old["Generator"]["electric_to_load_series_kw"]) + sum(old["Generator"]["electric_to_storage_series_kw"]) * battery_RT_effic
new_gen_used = sum(new["Generator"]["electric_to_load_series_kw"]) + sum(new["Generator"]["electric_to_storage_series_kw"]) * battery_RT_effic
println(free_energy)
println(new_pv_used + new_gen_used - old_pv_used - old_gen_used)
@test free_energy  new_pv_used + new_gen_used - old_pv_used - old_gen_used rtol=0.01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant