Skip to content
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

Add prime_gen_kw output and logic #463

Merged
merged 1 commit into from
Apr 14, 2023
Merged
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
15 changes: 14 additions & 1 deletion job/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,26 @@ def queryset_for_summary(api_metas,summary_dict:dict):
for m in gen:
summary_dict[str(m.meta.run_uuid)]['gen_kw'] = m.size_kw

# assumes run_uuids exist in both CHPInputs and CHPOutputs
chpInputs = CHPInputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
'thermal_efficiency_full_load'
)
thermal_efficiency_full_load = dict()
if len(chpInputs) > 0:
for m in chpInputs:
thermal_efficiency_full_load[str(m.meta.run_uuid)] = m.thermal_efficiency_full_load

chpOutputs = CHPOutputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
'size_kw'
)
if len(chpOutputs) > 0:
for m in chpOutputs:
summary_dict[str(m.meta.run_uuid)]['chp_kw'] = m.size_kw
if thermal_efficiency_full_load[str(m.meta.run_uuid)] == 0:
summary_dict[str(m.meta.run_uuid)]['prime_gen_kw'] = m.size_kw
else:
summary_dict[str(m.meta.run_uuid)]['chp_kw'] = m.size_kw

return summary_dict

Expand Down