Skip to content

Commit

Permalink
fixed window size bug in json parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophGehbauer committed Mar 26, 2024
1 parent a93b5be commit fc014ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 80 deletions.
7 changes: 4 additions & 3 deletions afc/externalConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ def config_from_dict(config):
wpi_min = 250 + max(0, (config['occupant_brightness'] - 80) * 5)

# Upload default_parameter with arguments from json
window_full_width = config['window_width'] * config['window_count']
parameter = default_parameter(tariff_name=config['tariff_name'],
facade_type=config['system_type'],
room_height=config['room_height'],
room_width=config['room_width'],
room_depth=config['room_depth'],
window_height=config['window_height'],
window_sill=config['window_sill'],
window_width=config['room_width'],
window_width=window_full_width,
system_cooling_eff=1/config['system_cooling_eff'],
location_latitude=config['location_latitude'],
location_longitude=config['location_longitude'],
Expand All @@ -90,11 +91,11 @@ def config_from_dict(config):
# Update windows position and dimensions
for wz in parameter['facade']['windows']:
# all windows have same width
window_width = ft_to_m(config['window_width'])
window_width = ft_to_m(window_full_width)
# all windows have same height
window_height = ft_to_m(config['window_height'] / len(parameter['facade']['windows']))
# need to make sure windows are centered
x_origin = ft_to_m((config['room_width'] - config['window_width']) / 2)
x_origin = ft_to_m((config['room_width'] - window_full_width) / 2)
# new window starts at sill + X*windows
y_origin = ft_to_m(config['window_sill']) + wz * window_height
window = f'{x_origin} {y_origin} {window_width} {window_height}'
Expand Down
2 changes: 1 addition & 1 deletion afc/resources/config/example_config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"system_id": "Test-AAA", "location_state": "CA", "location_city": "Berkeley", "location_orientation": 180, "room_width": 10, "room_height": 11, "room_depth": 15, "occupant_1_direction": 0, "occupant_brightness": 100, "occupant_glare": 100, "window_width": 4.5, "window_height": 8.5, "window_sill": 0.5, "window_count": 2, "system_type": "ec-71t", "system_light": "FLU", "system_cooling": "el", "system_cooling_eff": 3.5, "system_heating": "el", "system_heating_eff": 0.95, "location_latitude": 37.85, "location_longitude": -122.24, "occupant_number": 1, "debug": "False", "tariff_name": "e19-2020", "building_age": "new_constr", "interface_status": "Updated Configuration."}
{"system_id": "Test-AAA", "location_state": "CA", "location_city": "Berkeley", "location_orientation": 180, "room_width": 10, "room_height": 11, "room_depth": 15, "occupant_1_direction": 0, "occupant_brightness": 100, "occupant_glare": 100, "window_width": 4.5, "window_height": 8.5, "window_sill": 0.5, "window_count": 2, "system_type": "ec-71t", "system_light": "FLU", "system_cooling": "el", "system_cooling_eff": 3.5, "system_heating": "el", "system_heating_eff": 0.95, "location_latitude": 37.85, "location_longitude": -122.24, "occupant_number": 1, "debug": false, "tariff_name": "e19-2020", "building_age": "new_constr", "interface_status": "Updated Configuration."}
87 changes: 11 additions & 76 deletions dev/Development-JsonParser.ipynb

Large diffs are not rendered by default.

0 comments on commit fc014ee

Please sign in to comment.