Skip to content

Commit

Permalink
fix(xml_schemas): Fix Heating-Params %-covered bug
Browse files Browse the repository at this point in the history
- Update Boilers and Elec-heating to support % heating covered
- Update tests
  • Loading branch information
ed-p-may committed Nov 13, 2023
1 parent c71ab5e commit 3649798
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
32 changes: 26 additions & 6 deletions PHX/to_WUFI_XML/xml_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,13 @@ def _PhxDeviceHeaterElec(_d: hvac.PhxHeaterElectric) -> List[xml_writable]:
XML_Object("PH_Parameters", _d.params, _schema_name="_DeviceHeaterElecPhParams"),
XML_Object("DHW_Parameters", _d, _schema_name="_DeviceHeaterElecDeviceParams"),
XML_Object(
"Heating_Parameters", _d, _schema_name="_DeviceHeaterElecDeviceParams"
"Heating_Parameters", _d, _schema_name="_DeviceHeaterHeatingDeviceParams"
),
]


def _DeviceHeaterElecPhParams(_p: hvac.PhxMechanicalDeviceParams) -> List[xml_writable]:

return [
XML_Node("AuxiliaryEnergy", _p.aux_energy),
XML_Node("AuxiliaryEnergyDHW", _p.aux_energy_dhw),
Expand All @@ -1039,8 +1040,18 @@ def _DeviceHeaterElecPhParams(_p: hvac.PhxMechanicalDeviceParams) -> List[xml_wr


def _DeviceHeaterElecDeviceParams(_d: hvac.PhxHeaterElectric) -> List[xml_writable]:
_d.usage_profile.space_heating_percent
return [
XML_Node("CoverageWithinSystem", _d.percent_coverage),
XML_Node("CoverageWithinSystem", _d.usage_profile.dhw_heating_percent),
XML_Node("Unit", _d.unit),
XML_Node("Selection", 1),
]


def _DeviceHeaterHeatingDeviceParams(_d: hvac.PhxHeaterElectric) -> List[xml_writable]:
_d.usage_profile.space_heating_percent
return [
XML_Node("CoverageWithinSystem", _d.usage_profile.space_heating_percent),
XML_Node("Unit", _d.unit),
XML_Node("Selection", 1),
]
Expand Down Expand Up @@ -1070,9 +1081,9 @@ def _PhxDeviceHeaterBoiler(_d: hvac.AnyPhxHeaterBoiler) -> List[xml_writable]:
XML_Object(
"PH_Parameters", _d.params, _schema_name=ph_params[_d.params.fuel.name]
),
XML_Object("DHW_Parameters", _d, _schema_name="_DeviceHeaterBoilerDeviceParams"),
XML_Object("DHW_Parameters", _d, _schema_name="_DeviceHeaterBoilerDHWParams"),
XML_Object(
"Heating_Parameters", _d, _schema_name="_DeviceHeaterBoilerDeviceParams"
"Heating_Parameters", _d, _schema_name="_DeviceHeaterBoilerHeatingParams"
),
]

Expand Down Expand Up @@ -1126,9 +1137,17 @@ def _DeviceHeaterBoilerFossilPhParams(
]


def _DeviceHeaterBoilerDeviceParams(_d: hvac.AnyPhxHeaterBoiler) -> List[xml_writable]:
def _DeviceHeaterBoilerDHWParams(_d: hvac.AnyPhxHeaterBoiler) -> List[xml_writable]:
return [
XML_Node("CoverageWithinSystem", _d.percent_coverage),
XML_Node("CoverageWithinSystem", _d.usage_profile.dhw_heating_percent),
XML_Node("Unit", _d.unit),
XML_Node("Selection", 1),
]


def _DeviceHeaterBoilerHeatingParams(_d: hvac.AnyPhxHeaterBoiler) -> List[xml_writable]:
return [
XML_Node("CoverageWithinSystem", _d.usage_profile.space_heating_percent),
XML_Node("Unit", _d.unit),
XML_Node("Selection", 1),
]
Expand Down Expand Up @@ -1267,6 +1286,7 @@ def _DeviceHotWaterHeatPumpDeviceParams(_d: hvac.PhxHeatPumpDevice) -> List[xml_
XML_Node("Selection", 1),
]


def _DeviceHeaterHeatPumpDeviceParams(_d: hvac.PhxHeatPumpDevice) -> List[xml_writable]:
return [
XML_Node("CoverageWithinSystem", _d.usage_profile.space_heating_percent),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_default_PhxHeaterBoilerFossil(reset_class_counters):
"<Selection>1</Selection>",
"</DHW_Parameters>",
"<Heating_Parameters>",
"<CoverageWithinSystem>0.0</CoverageWithinSystem>",
"<CoverageWithinSystem>1.0</CoverageWithinSystem>",
"<Unit>0.0</Unit>",
"<Selection>1</Selection>",
"</Heating_Parameters>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_default_PhxHeaterBoilerWood(reset_class_counters):
"<Selection>1</Selection>",
"</DHW_Parameters>",
"<Heating_Parameters>",
"<CoverageWithinSystem>0.0</CoverageWithinSystem>",
"<CoverageWithinSystem>1.0</CoverageWithinSystem>",
"<Unit>0.0</Unit>",
"<Selection>1</Selection>",
"</Heating_Parameters>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_default_PhxHeaterElectric(reset_class_counters):
"<Selection>1</Selection>",
"</DHW_Parameters>",
"<Heating_Parameters>",
"<CoverageWithinSystem>0.0</CoverageWithinSystem>",
"<CoverageWithinSystem>1.0</CoverageWithinSystem>",
"<Unit>0.0</Unit>",
"<Selection>1</Selection>",
"</Heating_Parameters>",
Expand Down

0 comments on commit 3649798

Please sign in to comment.