diff --git a/lib/urbanopt/geojson/schema/thermal_connector_properties.json b/lib/urbanopt/geojson/schema/thermal_connector_properties.json index ef674f4..254a91e 100644 --- a/lib/urbanopt/geojson/schema/thermal_connector_properties.json +++ b/lib/urbanopt/geojson/schema/thermal_connector_properties.json @@ -59,7 +59,7 @@ "$ref": "#/definitions/TemperatureType" }, "flow_direction": { - "description": "Charcterization of connector, relative to the central plant", + "description": "Characterization of connector, relative to the central plant", "$ref": "#/definitions/FlowDirection" }, "user_data": { @@ -67,12 +67,10 @@ } }, "required": [ + "id", "type", - "connector_type", "startJunctionId", - "endJunctionId", - "fluid_temperature_type", - "flow_direction" + "endJunctionId" ], "additionalProperties": false, "definitions": { diff --git a/lib/urbanopt/geojson/schema/thermal_junction_properties.json b/lib/urbanopt/geojson/schema/thermal_junction_properties.json index 5211250..fa3e755 100644 --- a/lib/urbanopt/geojson/schema/thermal_junction_properties.json +++ b/lib/urbanopt/geojson/schema/thermal_junction_properties.json @@ -60,9 +60,8 @@ } }, "required": [ - "type", - "junction_type", - "connection_type" + "id", + "type" ], "additionalProperties": false, "definitions": { diff --git a/spec/files/example_project_with_ghe.json b/spec/files/example_project_with_ghe.json new file mode 100644 index 0000000..7b3f8f0 --- /dev/null +++ b/spec/files/example_project_with_ghe.json @@ -0,0 +1,977 @@ +{ + "type": "FeatureCollection", + "project": { + "id": "7c33a001-bccb-413e-ac87-67558b5d4b07", + "name": "New Project", + "surface_elevation": null, + "weather_filename": "USA_NY_Buffalo-Greater.Buffalo.Intl.AP.725280_TMY3.epw", + "climate_zone": "6A", + "cec_climate_zone": null, + "begin_date": "2017-01-01T07:00:00.000Z", + "end_date": "2017-12-31T07:00:00.000Z", + "timesteps_per_hour": 1, + "default_template": "90.1-2013" + }, + "features": [ + { + "type": "Feature", + "properties": { + "id": "53340c2c-ab20-40db-aba1-11ac607c52a7", + "name": "Site Origin", + "type": "Site Origin", + "begin_date": "2017-01-01T07:00:00.000Z", + "end_date": "2017-12-31T07:00:00.000Z", + "cec_climate_zone": null, + "climate_zone": "6A", + "default_template": "90.1-2013", + "import_surrounding_buildings_as_shading": null, + "surface_elevation": null, + "tariff_filename": null, + "timesteps_per_hour": 1, + "weather_filename": "USA_NY_Buffalo-Greater.Buffalo.Intl.AP.725280_TMY3.epw" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.84948467732347, + 42.81677154451123 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "1", + "name": "Mixed_use 1", + "type": "Building", + "building_type": "Mixed use", + "floor_area": 752184, + "footprint_area": 188046, + "number_of_stories": 4, + "mixed_type_1": "Office", + "mixed_type_1_percentage": 50, + "mixed_type_2": "Food service", + "mixed_type_2_percentage": 50, + "mixed_type_3": "Strip shopping mall", + "mixed_type_3_percentage": 0, + "mixed_type_4": "Lodging", + "mixed_type_4_percentage": 0 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84650338745196, + 42.81331301863236 + ], + [ + -78.84652443964629, + 42.81463974371101 + ], + [ + -78.84680142363833, + 42.815293654042534 + ], + [ + -78.84744455124724, + 42.81514110006128 + ], + [ + -78.84728610028628, + 42.81478165791734 + ], + [ + -78.84786797764677, + 42.814643631760134 + ], + [ + -78.84721106637106, + 42.813153418927016 + ], + [ + -78.84650338745196, + 42.81331301863236 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "2", + "name": "Restaurant 1", + "type": "Building", + "building_type": "Food service", + "floor_area": 22313, + "footprint_area": 22313, + "number_of_stories": 1, + "ev_charging": true, + "ev_charging_behavior": "Business as Usual", + "ev_percent": 100, + "ev_curtailment_frac": 0.5, + "ev_use_model_occupancy": true + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.8500120420453, + 42.81812185529549 + ], + [ + -78.85038975191084, + 42.81803226424341 + ], + [ + -78.850630729414, + 42.81857888627522 + ], + [ + -78.85025301954843, + 42.81866847653532 + ], + [ + -78.8500120420453, + 42.81812185529549 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "3", + "name": "Restaurant 10", + "type": "Building", + "building_type": "Food service", + "floor_area": 125631, + "footprint_area": 41877, + "number_of_stories": 3, + "ev_charging": true, + "ev_charging_station_type": "Typical Public" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84962224800356, + 42.81329273502644 + ], + [ + -78.84929833482822, + 42.81337083838241 + ], + [ + -78.84983265832118, + 42.814563298664666 + ], + [ + -78.85015657149653, + 42.81448519681467 + ], + [ + -78.84962224800356, + 42.81329273502644 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "4", + "name": "Restaurant 12", + "type": "Building", + "building_type": "Food service", + "floor_area": 31623, + "footprint_area": 10541, + "number_of_stories": 3, + "ev_charging": true, + "ev_charging_station_type": "Typical Public" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84907318596754, + 42.81342719667407 + ], + [ + -78.84862090048105, + 42.81353625345659 + ], + [ + -78.84871721918239, + 42.813751210926796 + ], + [ + -78.84916950466888, + 42.81364215452331 + ], + [ + -78.84907318596754, + 42.81342719667407 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "5", + "name": "District Office 1", + "type": "Building", + "building_type": "Office", + "system_type": "VAV district chilled water with district hot water reheat", + "floor_area": 8804, + "footprint_area": 8804, + "number_of_stories": 1, + "ev_charging": true, + "ev_charging_station_type": "Typical Work" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84809175426629, + 42.81367038997507 + ], + [ + -78.84848670778973, + 42.81357515750889 + ], + [ + -78.84857883872144, + 42.81378076888831 + ], + [ + -78.84818388519801, + 42.81387600103781 + ], + [ + -78.84809175426629, + 42.81367038997507 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "6", + "name": "District Office 2", + "type": "Building", + "building_type": "Office", + "system_type": "VAV district chilled water with district hot water reheat", + "floor_area": 10689, + "footprint_area": 10689, + "number_of_stories": 1, + "ev_charging": true + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84846106738529, + 42.814495803077364 + ], + [ + -78.8486903952376, + 42.81444050756261 + ], + [ + -78.8484977578349, + 42.81401059666683 + ], + [ + -78.84826842998261, + 42.81406589256599 + ], + [ + -78.84846106738529, + 42.814495803077364 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "7", + "name": "Office 1", + "type": "Building", + "building_type": "Office", + "system_type": "VAV district chilled water with district hot water reheat", + "number_of_stories": 6, + "detailed_model_filename": "7.osm" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84733878006863, + 42.816466983030836 + ], + [ + -78.84854275129324, + 42.81617669028003 + ], + [ + -78.848356395545, + 42.81576080994094 + ], + [ + -78.84715242432038, + 42.81605110464406 + ], + [ + -78.84733878006863, + 42.816466983030836 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "8", + "name": "Hospital 1", + "type": "Building", + "building_type": "Outpatient health care", + "system_type": "VAV district chilled water with district hot water reheat", + "number_of_stories": 10, + "detailed_model_filename": "8.osm" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84973966335251, + 42.8154441454509 + ], + [ + -78.85049562542395, + 42.81525669280299 + ], + [ + -78.85078257620685, + 42.81588131780643 + ], + [ + -78.8505086568277, + 42.81594736368234 + ], + [ + -78.85041233812638, + 42.815732413845666 + ], + [ + -78.84991755499783, + 42.81585689105046 + ], + [ + -78.84973966335251, + 42.8154441454509 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "9", + "name": "Hospital 2", + "type": "Building", + "building_type": "Inpatient health care", + "number_of_stories": 3, + "detailed_model_filename": "9.osm" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.85083627755732, + 42.81600678613279 + ], + [ + -78.85056039001891, + 42.816076133580566 + ], + [ + -78.85072568130569, + 42.816450649528036 + ], + [ + -78.84940134236577, + 42.81677160705479 + ], + [ + -78.84958014898304, + 42.81716858994267 + ], + [ + -78.8507262115271, + 42.816890840117026 + ], + [ + -78.8508565789851, + 42.81719595796099 + ], + [ + -78.85132137101688, + 42.81708331517635 + ], + [ + -78.85083627755732, + 42.81600678613279 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "10", + "name": "Mixed use 2", + "type": "Building", + "building_type": "Mixed use", + "floor_area": 1278384, + "footprint_area": 159798, + "number_of_stories": 8, + "mixed_type_1": "Strip shopping mall", + "mixed_type_1_percentage": 25, + "mixed_type_2": "Food service", + "mixed_type_2_percentage": 25, + "mixed_type_3": "Office", + "mixed_type_3_percentage": 15, + "mixed_type_4": "Lodging", + "mixed_type_4_percentage": 35 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.85115264550463, + 42.81786093060211 + ], + [ + -78.85163483958878, + 42.81774467026972 + ], + [ + -78.85246596719499, + 42.819583261120755 + ], + [ + -78.85082390085432, + 42.819979162017745 + ], + [ + -78.85060552295334, + 42.81947573727234 + ], + [ + -78.85174564783776, + 42.81920483484765 + ], + [ + -78.85115264550463, + 42.81786093060211 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "11", + "name": "Restaurant 13", + "type": "Building", + "building_type": "Food service", + "floor_area": 32511, + "footprint_area": 10837, + "number_of_stories": 3 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84961163640645, + 42.81460851835703 + ], + [ + -78.84914661048371, + 42.81472064501696 + ], + [ + -78.84905029178236, + 42.81450569091638 + ], + [ + -78.84951531770513, + 42.81439356386673 + ], + [ + -78.84961163640645, + 42.81460851835703 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "12", + "name": "Mall 1", + "type": "Building", + "building_type": "Strip shopping mall", + "floor_area": 374409, + "footprint_area": 124803, + "number_of_stories": 3 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.84768338040897, + 42.817161656757065 + ], + [ + -78.8482630702579, + 42.8170218879136 + ], + [ + -78.84915297130291, + 42.81900776764229 + ], + [ + -78.84857328145401, + 42.81914753199706 + ], + [ + -78.84768338040897, + 42.817161656757065 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "13", + "name": "Hotel 1", + "type": "Building", + "building_type": "Lodging", + "floor_area": 316160, + "footprint_area": 31616, + "number_of_stories": 10 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.8494955083645, + 42.819748790984335 + ], + [ + -78.84891089471263, + 42.81989327725856 + ], + [ + -78.8491389243777, + 42.82038967009544 + ], + [ + -78.84972353802956, + 42.82024518498119 + ], + [ + -78.8494955083645, + 42.819748790984335 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "dd69549c-ecfc-4245-96dc-5b6127f34f46", + "geometryType": "Rectangle", + "name": "New District System_1", + "type": "District System", + "district_system_type": "Ground Heat Exchanger", + "footprint_area": 128302, + "footprint_perimeter": 1455, + "floor_area": 128302 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.85403977359493, + 42.81807386711816 + ], + [ + -78.8535331235525, + 42.81695894709998 + ], + [ + -78.85247458344057, + 42.81721776905695 + ], + [ + -78.852981233483, + 42.81833268440852 + ], + [ + -78.85403977359493, + 42.81807386711816 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "47fd01d3-3d72-46c0-85f2-a12854783764", + "geometryType": "Rectangle", + "name": "New District System_2", + "type": "District System", + "district_system_type": "Ground Heat Exchanger", + "footprint_area": 104693, + "footprint_perimeter": 1332, + "floor_area": 104693 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.85273990319104, + 42.81588851783172 + ], + [ + -78.85224049713851, + 42.81481606407624 + ], + [ + -78.85134704694869, + 42.81503993895839 + ], + [ + -78.85184645300123, + 42.81611238883147 + ], + [ + -78.85273990319104, + 42.81588851783172 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "d18cf419-a301-4e1e-9694-613cff741e70", + "type": "ThermalJunction", + "DSId": "dd69549c-ecfc-4245-96dc-5b6127f34f46" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.8527736847739, + 42.81787596282345 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "6cf3a36e-705e-4b98-83ef-7f97d1981583", + "type": "ThermalJunction", + "buildingId": "10" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85180303988922, + 42.81811676138841 + ] + } + }, + { + "type": "Feature", + "properties": { + "type": "ThermalConnector", + "id": "1c63c10c-2315-4353-b3e9-3127651e6f45", + "startJunctionId": "d18cf419-a301-4e1e-9694-613cff741e70", + "endJunctionId": "6cf3a36e-705e-4b98-83ef-7f97d1981583", + "startFeatureId": "dd69549c-ecfc-4245-96dc-5b6127f34f46", + "endFeatureId": "10", + "total_length": 274 + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -78.8527736847739, + 42.81787596282345 + ], + [ + -78.85180303988922, + 42.81811676138841 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "e3369697-5c01-4482-bb5e-8a9e05627bbb", + "type": "ThermalJunction", + "buildingId": "10" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.8513884548927, + 42.8178040753532 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "e783b345-44b4-4151-b053-65071f2b039a", + "type": "ThermalJunction", + "buildingId": "9" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85111253604609, + 42.81713392655267 + ] + } + }, + { + "type": "Feature", + "properties": { + "type": "ThermalConnector", + "id": "5ba09731-2efa-4bb8-ba72-1803706f7113", + "startJunctionId": "e3369697-5c01-4482-bb5e-8a9e05627bbb", + "endJunctionId": "e783b345-44b4-4151-b053-65071f2b039a", + "startFeatureId": "10", + "endFeatureId": "9", + "total_length": 255 + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -78.8513884548927, + 42.8178040753532 + ], + [ + -78.85111253604609, + 42.81713392655267 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "4f3a0cec-9210-41e1-955d-c5946dd03524", + "type": "ThermalJunction", + "buildingId": "9" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.8506984750904, + 42.81604142434846 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "9d94ded1-1bd1-48b2-b658-99062d736297", + "type": "ThermalJunction", + "buildingId": "8" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85063590298351, + 42.815916682824934 + ] + } + }, + { + "type": "Feature", + "properties": { + "type": "ThermalConnector", + "id": "a4c11fec-937f-43e2-8a3b-6c1f5c187856", + "startJunctionId": "4f3a0cec-9210-41e1-955d-c5946dd03524", + "endJunctionId": "9d94ded1-1bd1-48b2-b658-99062d736297", + "startFeatureId": "9", + "endFeatureId": "8", + "total_length": 48 + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -78.8506984750904, + 42.81604142434846 + ], + [ + -78.85063590298351, + 42.815916682824934 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "1673f36c-14be-40f4-a84c-ad8be10e19af", + "type": "ThermalJunction", + "buildingId": "8" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85063680133233, + 42.815564000654184 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "3fc1a51f-a61f-4557-b854-735008a460ce", + "type": "ThermalJunction", + "DSId": "47fd01d3-3d72-46c0-85f2-a12854783764" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85148763351005, + 42.81534184354775 + ] + } + }, + { + "type": "Feature", + "properties": { + "type": "ThermalConnector", + "id": "b0537b13-c6db-4b58-b2b6-fcb69343a640", + "startJunctionId": "1673f36c-14be-40f4-a84c-ad8be10e19af", + "endJunctionId": "3fc1a51f-a61f-4557-b854-735008a460ce", + "startFeatureId": "8", + "endFeatureId": "47fd01d3-3d72-46c0-85f2-a12854783764", + "total_length": 242 + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -78.85063680133233, + 42.815564000654184 + ], + [ + -78.85148763351005, + 42.81534184354775 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "013105e1-a2ca-4044-918e-3b89f354f729", + "type": "ThermalJunction", + "DSId": "47fd01d3-3d72-46c0-85f2-a12854783764" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85229580141997, + 42.81599979610906 + ] + } + }, + { + "type": "Feature", + "properties": { + "id": "712e9a48-3867-43c7-a4cc-bdaf41ad78f1", + "type": "ThermalJunction", + "DSId": "dd69549c-ecfc-4245-96dc-5b6127f34f46" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -78.85281180727274, + 42.817135315112374 + ] + } + }, + { + "type": "Feature", + "properties": { + "type": "ThermalConnector", + "id": "4a8e9d32-6811-433f-a8bd-7efbbb994794", + "startJunctionId": "013105e1-a2ca-4044-918e-3b89f354f729", + "endJunctionId": "712e9a48-3867-43c7-a4cc-bdaf41ad78f1", + "startFeatureId": "47fd01d3-3d72-46c0-85f2-a12854783764", + "endFeatureId": "dd69549c-ecfc-4245-96dc-5b6127f34f46", + "total_length": 437 + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -78.85229580141997, + 42.81599979610906 + ], + [ + -78.85281180727274, + 42.817135315112374 + ] + ] + } + } + ] + } diff --git a/spec/urbanopt/geojson/geo_file_spec.rb b/spec/urbanopt/geojson/geo_file_spec.rb index 301141d..ca59c49 100644 --- a/spec/urbanopt/geojson/geo_file_spec.rb +++ b/spec/urbanopt/geojson/geo_file_spec.rb @@ -60,7 +60,7 @@ expect(geojson_errors).to be_empty end - it 'validate geojson file with two ground heat exchangers' do + it 'validate geojson file with two ground heat exchangers_1' do geojson_file = File.open(File.join(@spec_files_dir, 'example_project_combine_GHE_2.json')) do |f| result = JSON.parse(f.read, symbolize_names: true) end @@ -74,6 +74,21 @@ expect(geojson_errors).to be_empty end + it 'validate geojson file with two ground heat exchangers_2' do + geojson_file = File.open(File.join(@spec_files_dir, 'example_project_with_ghe.json')) do |f| + result = JSON.parse(f.read, symbolize_names: true) + end + + schema = File.open(File.dirname(__FILE__) + '/../../../lib/urbanopt/geojson/schema/geojson_schema.json') do |f| + result = JSON.parse(f.read, symbolize_names: true) + end + + geojson_errors = URBANopt::GeoJSON::GeoFile.validate(schema, geojson_file) + + expect(geojson_errors).to be_empty + end + + it 'raise error' do geojson_file = File.open(File.join(@spec_files_dir, 'invalid.geojson')) do |f| result = JSON.parse(f.read, symbolize_names: true)