Skip to content

Commit

Permalink
update sys-param tests to match new schema
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnate committed Sep 26, 2024
1 parent 5639795 commit 99b9fbe
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tests/model_connectors/test_time_series_heating_indirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def setUp(self):
heating_indirect_system = HeatingIndirect(sys_params, geojson_load_id)
ts_hi_coupling = Coupling(time_series_load, heating_indirect_system)

assert time_series_load is not None
assert time_series_load.building is not None
assert time_series_load.system_parameters.get_param("buildings")[0]["load_model"] == "time_series"

# create heated water stub for the ets
heated_water_stub = NetworkHeatedWaterStub(sys_params)
hi_hw_coupling = Coupling(heating_indirect_system, heated_water_stub)
Expand Down
45 changes: 42 additions & 3 deletions tests/system_parameters/test_system_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,40 @@ def test_errors(self):
SystemParameters.loadd(incomplete_teaser_params)

sp = SystemParameters.loadd(incomplete_teaser_params, validate_on_load=False)
assert len(sp.validate()) == 6
assert "'None' is not one of ['Indirect Heating and Cooling', 'Fifth Gen Heat Pump']" in sp.validate()
assert "'fraction_latent_person' is a required property" in sp.validate()
assert "'temp_hw_supply' is a required property" in sp.validate()
assert "'temp_setpoint_cooling' is a required property" in sp.validate()
assert "'temp_setpoint_heating' is a required property" in sp.validate()
assert "5 is not one of [1, 2, 3, 4]" in sp.validate()
assert len(sp.validate()) == 8

def test_get_param(self):
data = {
"weather": "path/to/weatherfile.mos",
"buildings": [
{
"geojson_id": "asdf",
"ets_model": "None",
"ets_model": "Indirect Heating and Cooling",
"ets_indirect_parameters": {
"heat_flow_nominal": 8000,
"heat_exchanger_efficiency": 0.8,
"nominal_mass_flow_district": 0.5,
"nominal_mass_flow_building": 0.5,
"valve_pressure_drop": 6000,
"heat_exchanger_secondary_pressure_drop": 500,
"heat_exchanger_primary_pressure_drop": 500,
"cooling_supply_water_temperature_building": 7,
"heating_supply_water_temperature_building": 50,
"delta_temp_chw_building": 5,
"delta_temp_chw_district": 8,
"delta_temp_hw_building": 15,
"delta_temp_hw_district": 20,
"cooling_controller_y_max": 1,
"cooling_controller_y_min": 0,
"heating_controller_y_max": 1,
"heating_controller_y_min": 0,
},
"load_model": "rc",
"load_model_parameters": {
"rc": {
Expand All @@ -133,7 +153,26 @@ def test_get_param(self):
assert value == [
{
"geojson_id": "asdf",
"ets_model": "None",
"ets_model": "Indirect Heating and Cooling",
"ets_indirect_parameters": {
"heat_flow_nominal": 8000,
"heat_exchanger_efficiency": 0.8,
"nominal_mass_flow_district": 0.5,
"nominal_mass_flow_building": 0.5,
"valve_pressure_drop": 6000,
"heat_exchanger_secondary_pressure_drop": 500,
"heat_exchanger_primary_pressure_drop": 500,
"cooling_supply_water_temperature_building": 7,
"heating_supply_water_temperature_building": 50,
"delta_temp_chw_building": 5,
"delta_temp_chw_district": 8,
"delta_temp_hw_building": 15,
"delta_temp_hw_district": 20,
"cooling_controller_y_max": 1,
"cooling_controller_y_min": 0,
"heating_controller_y_max": 1,
"heating_controller_y_min": 0,
},
"load_model": "rc",
"load_model_parameters": {
"rc": {
Expand Down

0 comments on commit 99b9fbe

Please sign in to comment.