Skip to content

Commit c68f623

Browse files
committed
Fix initial field values for thermal efficiencies on hess
1 parent 79ed602 commit c68f623

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

app/dashboard/views.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -793,27 +793,35 @@ def view_asset_parameters(request, scen_id, asset_type_name, asset_uuid):
793793
ess_discharging_power_asset = ess_asset_children.get(
794794
asset_type__asset_type="discharging_power"
795795
)
796+
797+
initial = {
798+
"name": existing_ess_asset.name,
799+
"installed_capacity": ess_capacity_asset.installed_capacity,
800+
"age_installed": ess_capacity_asset.age_installed,
801+
"capex_fix": ess_capacity_asset.capex_fix,
802+
"capex_var": ess_capacity_asset.capex_var,
803+
"opex_fix": ess_capacity_asset.opex_fix,
804+
"opex_var": ess_capacity_asset.opex_var,
805+
"lifetime": ess_capacity_asset.lifetime,
806+
"crate": ess_capacity_asset.crate,
807+
"efficiency": ess_capacity_asset.efficiency,
808+
"dispatchable": ess_capacity_asset.dispatchable,
809+
"optimize_cap": ess_capacity_asset.optimize_cap,
810+
"soc_max": ess_capacity_asset.soc_max,
811+
"soc_min": ess_capacity_asset.soc_min,
812+
}
813+
814+
# Add thermal loss rate fields to initial if hess
815+
if asset_type_name == "hess":
816+
for field in [
817+
"thermal_loss_rate",
818+
"fixed_thermal_losses_relative",
819+
"fixed_thermal_losses_absolute",
820+
]:
821+
initial[field] = getattr(ess_capacity_asset, field)
822+
796823
# also get all child assets
797-
form = StorageForm(
798-
asset_type=asset_type_name,
799-
view_only=True,
800-
initial={
801-
"name": existing_ess_asset.name,
802-
"installed_capacity": ess_capacity_asset.installed_capacity,
803-
"age_installed": ess_capacity_asset.age_installed,
804-
"capex_fix": ess_capacity_asset.capex_fix,
805-
"capex_var": ess_capacity_asset.capex_var,
806-
"opex_fix": ess_capacity_asset.opex_fix,
807-
"opex_var": ess_capacity_asset.opex_var,
808-
"lifetime": ess_capacity_asset.lifetime,
809-
"crate": ess_capacity_asset.crate,
810-
"efficiency": ess_capacity_asset.efficiency,
811-
"dispatchable": ess_capacity_asset.dispatchable,
812-
"optimize_cap": ess_capacity_asset.optimize_cap,
813-
"soc_max": ess_capacity_asset.soc_max,
814-
"soc_min": ess_capacity_asset.soc_min,
815-
},
816-
)
824+
form = StorageForm(asset_type=asset_type_name, view_only=True, initial=initial)
817825
optimized_cap = ess_capacity_asset.optimize_cap
818826
existing_asset = existing_ess_asset
819827

0 commit comments

Comments
 (0)