Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cea/default.config
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ buffer = 50
buffer.type = RealParameter
buffer.help = Perimeter buffer (m) around sample buildings .

[occupancy-helper]
[occupancy]

occupancy-model = deterministic
occupancy-model.type = ChoiceParameter
Expand Down
10 changes: 5 additions & 5 deletions cea/demand/occupancy_helper.py → cea/demand/occupancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
from cea.utilities.standardize_coordinates import get_projected_coordinate_system, get_lat_lon_projected_shapefile


def occupancy_helper_main(locator: cea.inputlocator.InputLocator, config: cea.config.Configuration, building=None):
def occupancy_main(locator: cea.inputlocator.InputLocator, config: cea.config.Configuration, building=None):
migrate_void_deck_data(locator)
# local variables
buildings: List[str] = config.occupancy_helper.buildings
occupancy_model: str = config.occupancy_helper.occupancy_model
buildings: List[str] = config.occupancy.buildings
occupancy_model: str = config.occupancy.occupancy_model

Comment on lines +35 to 40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Rename + config path switch look good; ensure [occupancy] section exists at runtime

The function rename and move to config.occupancy.* read cleanly. Please confirm the default/user config files define an occupancy section with buildings and occupancy_model, and that all callers/tests set these under occupancy (not occupancy_helper).

Run:


🏁 Script executed:

#!/bin/bash
# 1) Find any stale references that might break at runtime
rg -nP -C2 '\boccupancy_helper_main\b|\bconfig\.occupancy_helper\b|occupancy[_-]helper' 

# 2) Verify [occupancy] section exists in config templates
rg -nP -n '^\[occupancy\]' -C2

Length of output: 2451


Remove stale occupancy-helper references and introduce [occupancy] config section

  • Rename config section: in cea/default.config, change [occupancy-helper] to [occupancy] and ensure buildings and occupancy_model are defined.
  • Update CLI commands: in cea/scripts.yml (around lines 175–179 and 185–189), replace name: occupancy-helper and related script entries with the new command (e.g. occupancy).
  • Adjust workflow code: in cea/utilities/batch_process_workflow.py (line 122), update ['cea', 'occupancy-helper', …] to ['cea', 'occupancy', …].
  • Fix tests: in cea/tests/workflows/zug_heating.yml and sg_cooling.yml (line 31), change - script: occupancy-helper to - script: occupancy.

if occupancy_model == 'deterministic':
stochastic_schedule = False
Expand Down Expand Up @@ -477,9 +477,9 @@ def calc_hourly_value(date, array_week, array_sat, array_sun, norm_weekday_max,
def main(config):
assert os.path.exists(config.scenario), 'Scenario not found: %s' % config.scenario
print('Running occupancy model for scenario %s' % config.scenario)
print('Running occupancy model with schedule model=%s' % config.occupancy_helper.occupancy_model)
print('Running occupancy model with schedule model=%s' % config.occupancy.occupancy_model)
locator = cea.inputlocator.InputLocator(config.scenario)
occupancy_helper_main(locator, config)
occupancy_main(locator, config)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion cea/inputlocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def get_building_weekly_schedules(self, building):
Second row contains 13 columns (MONTHLY_MULTIPLIER, <jan-multiplier>, <feb-multiplier>, etc.)
The following rows are three sets of HOUR 1-24, one set for each of DAY in {WEEKDAY, SATURDAY, SUNDAY}

These weekly schedules are used by the occupancy-helper script to create the schedules for each hour of the
These weekly schedules are used by the occupancy script to create the schedules for each hour of the
year (``get_occupancy_model_file``).

Do not read this file yourself, instead, use :py:func`cea.utilities.schedule_reader.read_cea_schedule`
Expand Down
31 changes: 15 additions & 16 deletions cea/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ get_building_architecture:
- demand
- emissions
- radiation
- occupancy_helper
- occupancy
get_building_comfort:
created_by:
- archetypes_mapper
Expand Down Expand Up @@ -1821,7 +1821,7 @@ get_building_comfort:
min: 5.5 #accodding to this Singaporean Guidelinehttps://escholarship.org/content/qt7k1796zv/qt7k1796zv.pdf
used_by:
- demand
- occupancy_helper
- occupancy
get_building_internal:
created_by:
- archetypes_mapper
Expand Down Expand Up @@ -1915,7 +1915,7 @@ get_building_internal:
min: 0.0
used_by:
- demand
- occupancy_helper
- occupancy
get_building_supply:
created_by:
- archetypes_mapper
Expand Down Expand Up @@ -2110,7 +2110,7 @@ get_building_weekly_schedules:
type: float
used_by:
- demand
- occupancy_helper
- occupancy

get_costs_operation_file:
created_by:
Expand Down Expand Up @@ -2405,7 +2405,7 @@ get_database_assemblies_envelope_mass:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_floor:
created_by:
Expand Down Expand Up @@ -2454,7 +2454,7 @@ get_database_assemblies_envelope_floor:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_roof:
created_by:
Expand Down Expand Up @@ -2525,7 +2525,7 @@ get_database_assemblies_envelope_roof:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_shading:
created_by:
Expand Down Expand Up @@ -2556,7 +2556,7 @@ get_database_assemblies_envelope_shading:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_tightness:
created_by:
Expand Down Expand Up @@ -2587,7 +2587,7 @@ get_database_assemblies_envelope_tightness:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_wall:
created_by:
Expand Down Expand Up @@ -2657,7 +2657,7 @@ get_database_assemblies_envelope_wall:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_envelope_window:
created_by:
Expand Down Expand Up @@ -2729,7 +2729,7 @@ get_database_assemblies_envelope_window:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy

get_database_assemblies_hvac_controller:
created_by:
Expand Down Expand Up @@ -10568,7 +10568,7 @@ get_database_envelope_systems:
used_by:
- demand
- radiation
- occupancy_helper
- occupancy
get_database_feedstocks:
created_by:
- database_helper
Expand Down Expand Up @@ -19161,7 +19161,7 @@ get_radiation_metadata:
- solar_collector
get_occupancy_model_file:
created_by:
- occupancy_helper
- occupancy
file_path: outputs/data/occupancy/B001.csv
file_type: csv
schema:
Expand Down Expand Up @@ -19439,7 +19439,6 @@ get_terrain:
values: TODO
used_by:
- radiation
- occupancy_helper
get_thermal_demand_csv_file:
created_by:
- thermal_network
Expand Down Expand Up @@ -21037,7 +21036,7 @@ get_weather_file:
- photovoltaic
- photovoltaic_thermal
- radiation
- occupancy_helper
- occupancy
- shallow_geothermal_potential
- solar_collector
- thermal_network
Expand Down Expand Up @@ -21171,7 +21170,7 @@ get_zone_geometry:
- photovoltaic
- photovoltaic_thermal
- radiation
- occupancy_helper
- occupancy
- sewage_potential
- shallow_geothermal_potential
- solar_collector
Expand Down
6 changes: 3 additions & 3 deletions cea/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,17 @@ Renewable Energy Potential Assessment:
- [get_demand_results_file, building_name]

Energy Demand Forecasting:
- name: occupancy-helper
- name: occupancy
label: "Energy Demand Part 1: building occupancy"
short_description: Estimate building occupancy profiles using CEA models
description: This Feature uses CEA models and input schedules to estimate the occupancy profile of buildings.
interfaces: [dashboard, cli]
module: cea.demand.occupancy_helper
module: cea.demand.occupancy
parameters: ['general:scenario',
'general:multiprocessing',
'general:number-of-cpus-to-keep-free',
'general:debug',
occupancy-helper]
occupancy]
input-files:
- [get_building_internal]
- [get_building_comfort]
Expand Down
6 changes: 3 additions & 3 deletions cea/tests/create_unittest_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from cea.config import Configuration, DEFAULT_CONFIG
from cea.demand.building_properties import BuildingProperties
from cea.demand.occupancy_helper import occupancy_helper_main
from cea.demand.occupancy import occupancy_main
from cea.demand.thermal_loads import calc_thermal_loads
from cea.inputlocator import ReferenceCaseOpenLocator
from cea.utilities import epwreader
Expand Down Expand Up @@ -53,7 +53,7 @@ def main(output_file):
print("data for test_calc_thermal_loads:")
print(building_properties.list_building_names())

occupancy_helper_main(locator, config, building='B1011')
occupancy_main(locator, config, building='B1011')

bpr = building_properties['B1011']
result = calc_thermal_loads('B1011', bpr, weather_data, date_range, locator,
Expand Down Expand Up @@ -126,7 +126,7 @@ def run_for_single_building(building, bpr: BuildingPropertiesRow, weather_data,
use_dynamic_infiltration_calculation, resolution_outputs, loads_output,
massflows_output, temperatures_output, config, debug):
config.multiprocessing = False
occupancy_helper_main(locator, config, building=building)
occupancy_main(locator, config, building=building)
calc_thermal_loads(building, bpr, weather_data, date_range, locator,
use_dynamic_infiltration_calculation, resolution_outputs, loads_output, massflows_output,
temperatures_output, config, debug)
Expand Down
8 changes: 4 additions & 4 deletions cea/tests/test_calc_thermal_loads.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from cea.config import DEFAULT_CONFIG, Configuration
from cea.demand.building_properties import BuildingProperties
from cea.demand.occupancy_helper import occupancy_helper_main
from cea.demand.occupancy import occupancy_main
from cea.demand.thermal_loads import calc_thermal_loads
from cea.inputlocator import ReferenceCaseOpenLocator
from cea.utilities import epwreader
Expand Down Expand Up @@ -63,8 +63,8 @@ def setUp(self):
def test_calc_thermal_loads(self):
bpr = self.building_properties['B1011']
self.config.general.multiprocessing = False
self.config.occupancy_helper.occupancy_model = "deterministic"
occupancy_helper_main(self.locator, self.config, building='B1011')
self.config.occupancy.occupancy_model = "deterministic"
occupancy_main(self.locator, self.config, building='B1011')

result = calc_thermal_loads('B1011', bpr, self.weather_data, self.date_range, self.locator,
self.use_dynamic_infiltration_calculation, self.resolution_output,
Expand Down Expand Up @@ -119,7 +119,7 @@ def run_for_single_building(building, bpr: BuildingPropertiesRow, weather_data,
use_dynamic_infiltration_calculation, resolution_output, loads_output,
massflows_output, temperatures_output, config, debug):
config.general.multiprocessing = False
occupancy_helper_main(locator, config, building=building)
occupancy_main(locator, config, building=building)
calc_thermal_loads(building, bpr, weather_data, date, locator,
use_dynamic_infiltration_calculation, resolution_output, loads_output,
massflows_output, temperatures_output, config, debug)
Expand Down
6 changes: 3 additions & 3 deletions cea/tests/test_schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import cea.config
from cea.datamanagement.archetypes_mapper import calculate_average_multiuse
from cea.datamanagement.databases_verification import COLUMNS_ZONE_TYPOLOGY
from cea.demand.occupancy_helper import occupancy_helper_main
from cea.demand.occupancy import occupancy_main
from cea.inputlocator import ReferenceCaseOpenLocator

REFERENCE_TIME = 3456
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_mixed_use_schedules(self):
database_helper(config)

# calculate schedules
occupancy_helper_main(locator, config)
occupancy_main(locator, config)
calculated_schedules = pd.read_csv(locator.get_occupancy_model_file('B1011')).set_index('date')

test_config = configparser.ConfigParser()
Expand Down Expand Up @@ -132,7 +132,7 @@ def create_data():
# weather_path = locator.get_weather_file()
# weather_data = epwreader.epw_reader(weather_path)

calculated_schedules = occupancy_helper_main(locator, config)
calculated_schedules = occupancy_main(locator, config)
if not test_config.has_section('test_mixed_use_schedules'):
test_config.add_section('test_mixed_use_schedules')
test_config.set('test_mixed_use_schedules', 'reference_results', json.dumps(
Expand Down
2 changes: 1 addition & 1 deletion cea/tests/workflows/sg_cooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- script: radiation
parameters:
neglect-adjacent-buildings: false
- script: occupancy-helper
- script: occupancy
- script: demand
- script: emissions
- script: system-costs
Expand Down
2 changes: 1 addition & 1 deletion cea/tests/workflows/zug_heating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- script: radiation
parameters:
neglect-adjacent-buildings: false
- script: occupancy-helper
- script: occupancy
- script: demand
- script: emissions
- script: system-costs
Expand Down
2 changes: 1 addition & 1 deletion cea/utilities/batch_process_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def exec_cea_commands(config, cea_scenario):
capture_output=True)

if demand_forecasting:
subprocess.run(['cea', 'occupancy-helper', '--scenario', cea_scenario], env=my_env, check=True,
subprocess.run(['cea', 'occupancy', '--scenario', cea_scenario], env=my_env, check=True,
capture_output=True)
subprocess.run(['cea', 'demand', '--scenario', cea_scenario], env=my_env, check=True, capture_output=True)

Expand Down
Loading